1 /*
2 * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
3 * Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without modification,
6 * are permitted provided that the following conditions are met:
7 *
8 * 1. Redistributions of source code must retain the above copyright notice, this list of
9 * conditions and the following disclaimer.
10 *
11 * 2. Redistributions in binary form must reproduce the above copyright notice, this list
12 * of conditions and the following disclaimer in the documentation and/or other materials
13 * provided with the distribution.
14 *
15 * 3. Neither the name of the copyright holder nor the names of its contributors may be used
16 * to endorse or promote products derived from this software without specific prior written
17 * permission.
18 *
19 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
21 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
23 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
24 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
25 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
26 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
27 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
28 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
29 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 */
31 #include "stdio.h"
32 #include <climits>
33 #include <gtest/gtest.h>
34 #include "it_test_process.h"
35
Wait(const char * ptr,int scount)36 void Wait(const char *ptr, int scount)
37 {
38 int count = 0xffffffff;
39 while (scount > 0) {
40 while (count > 0) {
41 printf("\r");
42 count--;
43 }
44 count = 0xffffffff;
45 scount--;
46 if (ptr) {
47 printf("%s\n", ptr);
48 }
49 }
50 }
51
GetCpuCount(void)52 int GetCpuCount(void)
53 {
54 cpu_set_t cpuset;
55
56 CPU_ZERO(&cpuset);
57 int temp = sched_getaffinity(getpid(), sizeof(cpu_set_t), &cpuset);
58 if (temp != 0) {
59 printf("%s %d Error : %d\n", __FUNCTION__, __LINE__, temp);
60 }
61
62 return CPU_COUNT(&cpuset);
63 }
64
65 using namespace testing::ext;
66 namespace OHOS {
67 class ProcessProcessTest : public testing::Test {
68 public:
SetUpTestCase(void)69 static void SetUpTestCase(void) {}
TearDownTestCase(void)70 static void TearDownTestCase(void) {}
71 };
72
73 #if defined(LOSCFG_USER_TEST_SMOKE)
74 /* *
75 * @tc.name: it_test_process_001
76 * @tc.desc: function for ProcessProcessTest
77 * @tc.type: FUNC
78 */
79 HWTEST_F(ProcessProcessTest, ItTestProcess001, TestSize.Level0)
80 {
81 ItTestProcess001();
82 }
83
84 /* *
85 * @tc.name: it_test_process_002
86 * @tc.desc: function for ProcessProcessTest
87 * @tc.type: FUNC
88 */
89 HWTEST_F(ProcessProcessTest, ItTestProcess002, TestSize.Level0)
90 {
91 ItTestProcess002();
92 }
93
94 /* *
95 * @tc.name: it_test_process_004
96 * @tc.desc: function for ProcessProcessTest
97 * @tc.type: FUNC
98 */
99 HWTEST_F(ProcessProcessTest, ItTestProcess004, TestSize.Level0)
100 {
101 ItTestProcess004();
102 }
103
104 /* *
105 * @tc.name: it_test_process_005
106 * @tc.desc: function for ProcessProcessTest
107 * @tc.type: FUNC
108 */
109 HWTEST_F(ProcessProcessTest, ItTestProcess005, TestSize.Level0)
110 {
111 ItTestProcess005();
112 }
113
114 /* *
115 * @tc.name: it_test_process_006
116 * @tc.desc: function for ProcessProcessTest
117 * @tc.type: FUNC
118 */
119 HWTEST_F(ProcessProcessTest, ItTestProcess006, TestSize.Level0)
120 {
121 ItTestProcess006();
122 }
123
124 /* *
125 * @tc.name: it_test_process_008
126 * @tc.desc: function for ProcessProcessTest
127 * @tc.type: FUNC
128 */
129 HWTEST_F(ProcessProcessTest, ItTestProcess008, TestSize.Level0)
130 {
131 ItTestProcess008();
132 }
133
134 /* *
135 * @tc.name: it_test_process_010
136 * @tc.desc: function for ProcessProcessTest
137 * @tc.type: FUNC
138 */
139 HWTEST_F(ProcessProcessTest, ItTestProcess010, TestSize.Level0)
140 {
141 ItTestProcess010();
142 }
143
144 /* *
145 * @tc.name: it_test_process_009
146 * @tc.desc: function for ProcessProcessTest
147 * @tc.type: FUNC
148 */
149 HWTEST_F(ProcessProcessTest, ItTestProcess009, TestSize.Level0)
150 {
151 ItTestProcess009();
152 }
153
154 /* *
155 * @tc.name: it_test_process_011
156 * @tc.desc: function for ProcessProcessTest
157 * @tc.type: FUNC
158 */
159 HWTEST_F(ProcessProcessTest, ItTestProcess011, TestSize.Level0)
160 {
161 ItTestProcess011();
162 }
163
164 /* *
165 * @tc.name: it_test_process_012
166 * @tc.desc: function for ProcessProcessTest
167 * @tc.type: FUNC
168 */
169 HWTEST_F(ProcessProcessTest, ItTestProcess012, TestSize.Level0)
170 {
171 ItTestProcess012();
172 }
173
174 /* *
175 * @tc.name: it_test_process_013
176 * @tc.desc: function for ProcessProcessTest
177 * @tc.type: FUNC
178 */
179 HWTEST_F(ProcessProcessTest, ItTestProcess013, TestSize.Level0)
180 {
181 ItTestProcess013();
182 }
183
184 /* *
185 * @tc.name: it_test_process_014
186 * @tc.desc: function for ProcessProcessTest
187 * @tc.type: FUNC
188 */
189 HWTEST_F(ProcessProcessTest, ItTestProcess014, TestSize.Level0)
190 {
191 ItTestProcess014();
192 }
193
194 /* *
195 * @tc.name: it_test_process_015
196 * @tc.desc: function for ProcessProcessTest
197 * @tc.type: FUNC
198 */
199 HWTEST_F(ProcessProcessTest, ItTestProcess015, TestSize.Level0)
200 {
201 ItTestProcess015();
202 }
203
204 /* *
205 * @tc.name: it_test_process_016
206 * @tc.desc: function for ProcessProcessTest
207 * @tc.type: FUNC
208 */
209 HWTEST_F(ProcessProcessTest, ItTestProcess016, TestSize.Level0)
210 {
211 ItTestProcess016();
212 }
213
214 /* *
215 * @tc.name: it_test_process_017
216 * @tc.desc: function for ProcessProcessTest
217 * @tc.type: FUNC
218 */
219 HWTEST_F(ProcessProcessTest, ItTestProcess017, TestSize.Level0)
220 {
221 ItTestProcess017();
222 }
223
224 /* *
225 * @tc.name: it_test_process_018
226 * @tc.desc: function for ProcessProcessTest
227 * @tc.type: FUNC
228 */
229 HWTEST_F(ProcessProcessTest, ItTestProcess018, TestSize.Level0)
230 {
231 ItTestProcess018();
232 }
233
234 /* *
235 * @tc.name: it_test_process_019
236 * @tc.desc: function for ProcessProcessTest
237 * @tc.type: FUNC
238 */
239 HWTEST_F(ProcessProcessTest, ItTestProcess019, TestSize.Level0)
240 {
241 ItTestProcess019();
242 }
243
244 /* *
245 * @tc.name: it_test_process_020
246 * @tc.desc: function for ProcessProcessTest
247 * @tc.type: FUNC
248 */
249 HWTEST_F(ProcessProcessTest, ItTestProcess020, TestSize.Level0)
250 {
251 ItTestProcess020();
252 }
253
254 /* *
255 * @tc.name: it_test_process_021
256 * @tc.desc: function for ProcessProcessTest
257 * @tc.type: FUNC
258 */
259 HWTEST_F(ProcessProcessTest, ItTestProcess021, TestSize.Level0)
260 {
261 ItTestProcess021();
262 }
263
264 /* *
265 * @tc.name: it_test_process_022
266 * @tc.desc: function for ProcessProcessTest
267 * @tc.type: FUNC
268 */
269 HWTEST_F(ProcessProcessTest, ItTestProcess022, TestSize.Level0)
270 {
271 ItTestProcess022();
272 }
273
274 /* *
275 * @tc.name: it_test_process_023
276 * @tc.desc: function for ProcessProcessTest
277 * @tc.type: FUNC
278 */
279 HWTEST_F(ProcessProcessTest, ItTestProcess023, TestSize.Level0)
280 {
281 ItTestProcess023();
282 }
283
284 /* *
285 * @tc.name: it_test_process_024
286 * @tc.desc: function for ProcessProcessTest
287 * @tc.type: FUNC
288 */
289 HWTEST_F(ProcessProcessTest, ItTestProcess024, TestSize.Level0)
290 {
291 ItTestProcess024();
292 }
293
294 /* *
295 * @tc.name: it_test_process_025
296 * @tc.desc: function for ProcessProcessTest
297 * @tc.type: FUNC
298 */
299 HWTEST_F(ProcessProcessTest, ItTestProcess025, TestSize.Level0)
300 {
301 ItTestProcess025();
302 }
303
304 /* *
305 * @tc.name: it_test_process_026
306 * @tc.desc: function for ProcessProcessTest
307 * @tc.type: FUNC
308 */
309 HWTEST_F(ProcessProcessTest, ItTestProcess026, TestSize.Level0)
310 {
311 ItTestProcess026();
312 }
313
314 /* *
315 * @tc.name: it_test_process_027
316 * @tc.desc: function for ProcessProcessTest
317 * @tc.type: FUNC
318 */
319 HWTEST_F(ProcessProcessTest, ItTestProcess027, TestSize.Level0)
320 {
321 ItTestProcess027();
322 }
323
324 /* *
325 * @tc.name: it_test_process_029
326 * @tc.desc: function for ProcessProcessTest
327 * @tc.type: FUNC
328 */
329 HWTEST_F(ProcessProcessTest, ItTestProcess029, TestSize.Level0)
330 {
331 ItTestProcess029();
332 }
333
334 /* *
335 * @tc.name: it_test_process_030
336 * @tc.desc: function for ProcessProcessTest
337 * @tc.type: FUNC
338 */
339 HWTEST_F(ProcessProcessTest, ItTestProcess030, TestSize.Level0)
340 {
341 ItTestProcess030();
342 }
343
344 /* *
345 * @tc.name: it_test_process_038
346 * @tc.desc: function for ProcessProcessTest
347 * @tc.type: FUNC
348 */
349 HWTEST_F(ProcessProcessTest, ItTestProcess038, TestSize.Level0)
350 {
351 ItTestProcess038();
352 }
353
354 /* *
355 * @tc.name: it_test_process_039
356 * @tc.desc: function for ProcessProcessTest
357 * @tc.type: FUNC
358 */
359 HWTEST_F(ProcessProcessTest, ItTestProcess039, TestSize.Level0)
360 {
361 ItTestProcess039();
362 }
363
364 /* *
365 * @tc.name: it_test_process_043
366 * @tc.desc: function for ProcessProcessTest
367 * @tc.type: FUNC
368 */
369 HWTEST_F(ProcessProcessTest, ItTestProcess043, TestSize.Level0)
370 {
371 ItTestProcess043();
372 }
373
374 /* *
375 * @tc.name: it_test_process_044
376 * @tc.desc: function for ProcessProcessTest
377 * @tc.type: FUNC
378 */
379 HWTEST_F(ProcessProcessTest, ItTestProcess044, TestSize.Level0)
380 {
381 ItTestProcess044();
382 }
383
384 /* *
385 * @tc.name: it_test_process_045
386 * @tc.desc: function for ProcessProcessTest
387 * @tc.type: FUNC
388 */
389 HWTEST_F(ProcessProcessTest, ItTestProcess045, TestSize.Level0)
390 {
391 ItTestProcess045();
392 }
393
394 /* *
395 * @tc.name: it_test_process_046
396 * @tc.desc: function for ProcessProcessTest
397 * @tc.type: FUNC
398 */
399 HWTEST_F(ProcessProcessTest, ItTestProcess046, TestSize.Level0)
400 {
401 ItTestProcess046();
402 }
403
404 /* *
405 * @tc.name: it_test_process_047
406 * @tc.desc: function for ProcessProcessTest
407 * @tc.type: FUNC
408 */
409 HWTEST_F(ProcessProcessTest, ItTestProcess047, TestSize.Level0)
410 {
411 ItTestProcess047();
412 }
413
414 /* *
415 * @tc.name: it_test_process_048
416 * @tc.desc: function for ProcessProcessTest
417 * @tc.type: FUNC
418 */
419 HWTEST_F(ProcessProcessTest, ItTestProcess048, TestSize.Level0)
420 {
421 ItTestProcess048();
422 }
423
424 /* *
425 * @tc.name: it_test_process_054
426 * @tc.desc: function for waitid: The waitid parameter is incorrect and the error code is verified.
427 * @tc.type: FUNC
428 */
429 HWTEST_F(ProcessProcessTest, ItTestProcess054, TestSize.Level0)
430 {
431 ItTestProcess054();
432 }
433
434 /* *
435 * @tc.name: it_test_process_061
436 * @tc.desc: function for killpg: The killpg parameter is incorrect and the error code is verified.
437 * @tc.type: FUNC
438 */
439 HWTEST_F(ProcessProcessTest, ItTestProcess061, TestSize.Level0)
440 {
441 ItTestProcess061();
442 }
443
444 #ifdef LOSCFG_USER_TEST_SMP
445 /* *
446 * @tc.name: it_test_process_smp_001
447 * @tc.desc: function for ProcessProcessTest
448 * @tc.type: FUNC
449 */
450 HWTEST_F(ProcessProcessTest, ItTestProcessSmp001, TestSize.Level0)
451 {
452 ItTestProcessSmp001();
453 }
454
455 /* *
456 * @tc.name: it_test_process_smp_002
457 * @tc.desc: function for ProcessProcessTest
458 * @tc.type: FUNC
459 */
460 HWTEST_F(ProcessProcessTest, ItTestProcessSmp002, TestSize.Level0)
461 {
462 ItTestProcessSmp002();
463 }
464
465 /* *
466 * @tc.name: it_test_process_smp_003
467 * @tc.desc: function for ProcessProcessTest
468 * @tc.type: FUNC
469 */
470 HWTEST_F(ProcessProcessTest, ItTestProcessSmp003, TestSize.Level0)
471 {
472 ItTestProcessSmp003();
473 }
474
475 /* *
476 * @tc.name: it_test_process_smp_004
477 * @tc.desc: function for ProcessProcessTest
478 * @tc.type: FUNC
479 */
480 HWTEST_F(ProcessProcessTest, ItTestProcessSmp004, TestSize.Level0)
481 {
482 ItTestProcessSmp004();
483 }
484
485 /* *
486 * @tc.name: it_test_process_smp_005
487 * @tc.desc: function for ProcessProcessTest
488 * @tc.type: FUNC
489 */
490 HWTEST_F(ProcessProcessTest, ItTestProcessSmp005, TestSize.Level0)
491 {
492 ItTestProcessSmp005();
493 }
494
495 /* *
496 * @tc.name: it_test_process_smp_006
497 * @tc.desc: function for ProcessProcessTest
498 * @tc.type: FUNC
499 */
500 HWTEST_F(ProcessProcessTest, ItTestProcessSmp006, TestSize.Level0)
501 {
502 ItTestProcessSmp006();
503 }
504
505 /* *
506 * @tc.name: it_test_process_smp_007
507 * @tc.desc: function for ProcessProcessTest
508 * @tc.type: FUNC
509 */
510 HWTEST_F(ProcessProcessTest, ItTestProcessSmp007, TestSize.Level0)
511 {
512 ItTestProcessSmp007();
513 }
514
515 /* *
516 * @tc.name: it_test_process_smp_008
517 * @tc.desc: function for ProcessProcessTest
518 * @tc.type: FUNC
519 */
520 HWTEST_F(ProcessProcessTest, ItTestProcessSmp008, TestSize.Level0)
521 {
522 ItTestProcessSmp008();
523 }
524 #endif
525 #endif
526
527 #if defined(LOSCFG_USER_TEST_FULL)
528 /* *
529 * @tc.name: it_test_process_007
530 * @tc.desc: function for ProcessProcessTest
531 * @tc.type: FUNC
532 */
533 HWTEST_F(ProcessProcessTest, ItTestProcess007, TestSize.Level0)
534 {
535 ItTestProcess007();
536 }
537
538 /* *
539 * @tc.name: it_test_process_031
540 * @tc.desc: function for ProcessProcessTest
541 * @tc.type: FUNC
542 */
543 HWTEST_F(ProcessProcessTest, ItTestProcess031, TestSize.Level0)
544 {
545 ItTestProcess031();
546 }
547
548 /* *
549 * @tc.name: it_test_process_032
550 * @tc.desc: function for ProcessProcessTest
551 * @tc.type: FUNC
552 */
553 HWTEST_F(ProcessProcessTest, ItTestProcess032, TestSize.Level0)
554 {
555 ItTestProcess032();
556 }
557
558 /* *
559 * @tc.name: it_test_process_033
560 * @tc.desc: function for ProcessProcessTest
561 * @tc.type: FUNC
562 */
563 HWTEST_F(ProcessProcessTest, ItTestProcess033, TestSize.Level0)
564 {
565 ItTestProcess033();
566 }
567
568 /* *
569 * @tc.name: it_test_process_034
570 * @tc.desc: function for ProcessProcessTest
571 * @tc.type: FUNC
572 */
573 HWTEST_F(ProcessProcessTest, ItTestProcess034, TestSize.Level0)
574 {
575 ItTestProcess034();
576 }
577
578 /* *
579 * @tc.name: it_test_process_035
580 * @tc.desc: function for ProcessProcessTest
581 * @tc.type: FUNC
582 */
583 HWTEST_F(ProcessProcessTest, ItTestProcess035, TestSize.Level0)
584 {
585 ItTestProcess035();
586 }
587
588 /* *
589 * @tc.name: it_test_process_036
590 * @tc.desc: function for ProcessProcessTest
591 * @tc.type: FUNC
592 */
593 HWTEST_F(ProcessProcessTest, ItTestProcess036, TestSize.Level0)
594 {
595 ItTestProcess036();
596 }
597
598 /* *
599 * @tc.name: it_test_process_037
600 * @tc.desc: function for ProcessProcessTest
601 * @tc.type: FUNC
602 */
603 HWTEST_F(ProcessProcessTest, ItTestProcess037, TestSize.Level0)
604 {
605 ItTestProcess037();
606 }
607
608 /* *
609 * @tc.name: it_test_process_040
610 * @tc.desc: function for ProcessProcessTest
611 * @tc.type: FUNC
612 */
613 HWTEST_F(ProcessProcessTest, ItTestProcess040, TestSize.Level0)
614 {
615 ItTestProcess040();
616 }
617
618 /* *
619 * @tc.name: it_test_process_041
620 * @tc.desc: function for ProcessProcessTest
621 * @tc.type: FUNC
622 */
623 HWTEST_F(ProcessProcessTest, ItTestProcess041, TestSize.Level0)
624 {
625 ItTestProcess041();
626 }
627
628 /* *
629 * @tc.name: it_test_process_042
630 * @tc.desc: function for ProcessProcessTest
631 * @tc.type: FUNC
632 */
633 HWTEST_F(ProcessProcessTest, ItTestProcess042, TestSize.Level0)
634 {
635 ItTestProcess042();
636 }
637
638 /* *
639 * @tc.name: it_test_process_053
640 * @tc.desc: function for killpg:Sends a signal to the process group,
641 * Other processes in the process group can receive the signal.
642 * @tc.type: FUNC
643 */
644 HWTEST_F(ProcessProcessTest, ItTestProcess053, TestSize.Level0)
645 {
646 ItTestProcess053();
647 }
648
649 /* *
650 * @tc.name: it_test_process_055
651 * @tc.desc: function for waitid:To test the function of transferring different parameters of the waitid.
652 * @tc.type: FUNC
653 */
654 HWTEST_F(ProcessProcessTest, ItTestProcess055, TestSize.Level0)
655 {
656 ItTestProcess055();
657 }
658
659 /* *
660 * @tc.name: it_test_process_062
661 * @tc.desc: function for killpg:Fork two processes. The killpg sends a signal to the current process group.
662 * The other two processes can receive the signal.
663 * @tc.type: FUNC
664 */
665 HWTEST_F(ProcessProcessTest, ItTestProcess062, TestSize.Level0)
666 {
667 ItTestProcess062();
668 }
669 #endif
670 } // namespace OHOS
671