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_pthread_test.h"
35 #include <sys/resource.h>
36
37 using namespace testing::ext;
38 namespace OHOS {
39 class ProcessPthreadTest : public testing::Test {
40 public:
SetUpTestCase(void)41 static void SetUpTestCase(void)
42 {
43 struct sched_param param = { 0 };
44 int currThreadPolicy, ret;
45 ret = pthread_getschedparam(pthread_self(), &currThreadPolicy, ¶m);
46 ICUNIT_ASSERT_EQUAL_VOID(ret, 0, -ret);
47 param.sched_priority = TASK_PRIO_TEST;
48 ret = pthread_setschedparam(pthread_self(), SCHED_RR, ¶m);
49 ICUNIT_ASSERT_EQUAL_VOID(ret, 0, -ret);
50 }
TearDownTestCase(void)51 static void TearDownTestCase(void) {}
52 };
53
54 #if defined(LOSCFG_USER_TEST_SMOKE)
55 /* *
56 * @tc.name: it_test_pthread_003
57 * @tc.desc: function for ProcessPthreadTest
58 * @tc.type: FUNC
59 */
HWTEST_F(ProcessPthreadTest, ItTestPthread003, TestSize.Level0)60 HWTEST_F(ProcessPthreadTest, ItTestPthread003, TestSize.Level0)
61 {
62 ItTestPthread003();
63 }
64
65 #ifndef LOSCFG_USER_TEST_SMP
66 /* *
67 * @tc.name: it_test_pthread_006
68 * @tc.desc: function for ProcessPthreadTest
69 * @tc.type: FUNC
70 */
HWTEST_F(ProcessPthreadTest, ItTestPthread006, TestSize.Level0)71 HWTEST_F(ProcessPthreadTest, ItTestPthread006, TestSize.Level0)
72 {
73 ItTestPthread006();
74 }
75 #endif
76
77 /* *
78 * @tc.name: it_test_pthread_007
79 * @tc.desc: function for ProcessPthreadTest
80 * @tc.type: FUNC
81 */
HWTEST_F(ProcessPthreadTest, ItTestPthread007, TestSize.Level0)82 HWTEST_F(ProcessPthreadTest, ItTestPthread007, TestSize.Level0)
83 {
84 ItTestPthread007();
85 }
86
87 /* *
88 * @tc.name: it_test_pthread_008
89 * @tc.desc: function for ProcessPthreadTest
90 * @tc.type: FUNC
91 */
HWTEST_F(ProcessPthreadTest, ItTestPthread008, TestSize.Level0)92 HWTEST_F(ProcessPthreadTest, ItTestPthread008, TestSize.Level0)
93 {
94 ItTestPthread008();
95 }
96
97 /* *
98 * @tc.name: it_test_pthread_009
99 * @tc.desc: function for ProcessPthreadTest
100 * @tc.type: FUNC
101 */
HWTEST_F(ProcessPthreadTest, ItTestPthread009, TestSize.Level0)102 HWTEST_F(ProcessPthreadTest, ItTestPthread009, TestSize.Level0)
103 {
104 ItTestPthread009();
105 }
106
107 #ifndef LOSCFG_USER_TEST_SMP
108 /* *
109 * @tc.name: it_test_pthread_010
110 * @tc.desc: function for ProcessPthreadTest
111 * @tc.type: FUNC
112 */
HWTEST_F(ProcessPthreadTest, ItTestPthread010, TestSize.Level0)113 HWTEST_F(ProcessPthreadTest, ItTestPthread010, TestSize.Level0)
114 {
115 ItTestPthread010();
116 }
117 #endif
118
119 /* *
120 * @tc.name: it_test_pthread_011
121 * @tc.desc: function for ProcessPthreadTest
122 * @tc.type: FUNC
123 */
HWTEST_F(ProcessPthreadTest, ItTestPthread011, TestSize.Level0)124 HWTEST_F(ProcessPthreadTest, ItTestPthread011, TestSize.Level0)
125 {
126 ItTestPthread011();
127 }
128
129 /* *
130 * @tc.name: it_test_pthread_012
131 * @tc.desc: function for ProcessPthreadTest
132 * @tc.type: FUNC
133 */
HWTEST_F(ProcessPthreadTest, ItTestPthread012, TestSize.Level0)134 HWTEST_F(ProcessPthreadTest, ItTestPthread012, TestSize.Level0)
135 {
136 ItTestPthread012();
137 }
138
139 /* *
140 * @tc.name: it_test_pthread_013
141 * @tc.desc: function for ProcessPthreadTest
142 * @tc.type: FUNC
143 */
HWTEST_F(ProcessPthreadTest, ItTestPthread013, TestSize.Level0)144 HWTEST_F(ProcessPthreadTest, ItTestPthread013, TestSize.Level0)
145 {
146 ItTestPthread013();
147 }
148
149 /* *
150 * @tc.name: it_test_pthread_015
151 * @tc.desc: function for ProcessPthreadTest
152 * @tc.type: FUNC
153 */
HWTEST_F(ProcessPthreadTest, ItTestPthread015, TestSize.Level0)154 HWTEST_F(ProcessPthreadTest, ItTestPthread015, TestSize.Level0)
155 {
156 ItTestPthread015();
157 }
158
159 /* *
160 * @tc.name: it_test_pthread_016
161 * @tc.desc: function for ProcessPthreadTest
162 * @tc.type: FUNC
163 */
HWTEST_F(ProcessPthreadTest, ItTestPthread016, TestSize.Level0)164 HWTEST_F(ProcessPthreadTest, ItTestPthread016, TestSize.Level0)
165 {
166 ItTestPthread016();
167 }
168
169 /* *
170 * @tc.name: it_test_pthread_018
171 * @tc.desc: function for ProcessPthreadTest
172 * @tc.type: FUNC
173 */
HWTEST_F(ProcessPthreadTest, ItTestPthread018, TestSize.Level0)174 HWTEST_F(ProcessPthreadTest, ItTestPthread018, TestSize.Level0)
175 {
176 ItTestPthread018();
177 }
178
179 /* *
180 * @tc.name: it_test_pthread_019
181 * @tc.desc: function for ProcessPthreadTest
182 * @tc.type: FUNC
183 */
HWTEST_F(ProcessPthreadTest, ItTestPthread019, TestSize.Level0)184 HWTEST_F(ProcessPthreadTest, ItTestPthread019, TestSize.Level0)
185 {
186 ItTestPthread019();
187 }
188
189 /* *
190 * @tc.name: it_test_pthread_020
191 * @tc.desc: function for ProcessPthreadTest
192 * @tc.type: FUNC
193 * @tc.require: issueI6T3P3
194 * @tc.author:
195 */
HWTEST_F(ProcessPthreadTest, ItTestPthread020, TestSize.Level0)196 HWTEST_F(ProcessPthreadTest, ItTestPthread020, TestSize.Level0)
197 {
198 ItTestPthread020();
199 }
200
201 /* *
202 * @tc.name: it_test_pthread_021
203 * @tc.desc: function for ProcessPthreadTest
204 * @tc.type: FUNC
205 * @tc.require: issueI6T3P3
206 * @tc.author:
207 */
HWTEST_F(ProcessPthreadTest, ItTestPthread021, TestSize.Level0)208 HWTEST_F(ProcessPthreadTest, ItTestPthread021, TestSize.Level0)
209 {
210 ItTestPthread021();
211 }
212
213 /* *
214 * @tc.name: it_test_pthread_022
215 * @tc.desc: function for ProcessPthreadTest
216 * @tc.type: FUNC
217 * @tc.require: issueI6T3P3
218 * @tc.author:
219 */
HWTEST_F(ProcessPthreadTest, ItTestPthread022, TestSize.Level0)220 HWTEST_F(ProcessPthreadTest, ItTestPthread022, TestSize.Level0)
221 {
222 ItTestPthread022();
223 }
224
225 /* *
226 * @tc.name: it_test_pthread_024
227 * @tc.desc: function for ProcessPthreadTest
228 * @tc.type: FUNC
229 * @tc.require: issueI6T3P3
230 * @tc.author:
231 */
HWTEST_F(ProcessPthreadTest, ItTestPthread024, TestSize.Level0)232 HWTEST_F(ProcessPthreadTest, ItTestPthread024, TestSize.Level0)
233 {
234 ItTestPthread024();
235 }
236
237 /* *
238 * @tc.name: it_test_pthread_026
239 * @tc.desc: function for ProcessPthreadTest
240 * @tc.type: FUNC
241 * @tc.require: issueI6T3P3
242 * @tc.author:
243 */
HWTEST_F(ProcessPthreadTest, ItTestPthread026, TestSize.Level0)244 HWTEST_F(ProcessPthreadTest, ItTestPthread026, TestSize.Level0)
245 {
246 ItTestPthread026();
247 }
248
249 /* *
250 * @tc.name: it_test_pthread_027
251 * @tc.desc: function for ProcessPthreadTest
252 * @tc.type: FUNC
253 * @tc.require: issueI6T3P3
254 * @tc.author:
255 */
HWTEST_F(ProcessPthreadTest, ItTestPthread027, TestSize.Level0)256 HWTEST_F(ProcessPthreadTest, ItTestPthread027, TestSize.Level0)
257 {
258 ItTestPthread027();
259 }
260
261
262 /* *
263 * @tc.name: it_test_pthread_023
264 * @tc.desc: function for ProcessPthreadTest
265 * @tc.type: FUNC
266 * @tc.require: issueI6T3P3
267 * @tc.author:
268 */
HWTEST_F(ProcessPthreadTest, ItTestPthread023, TestSize.Level0)269 HWTEST_F(ProcessPthreadTest, ItTestPthread023, TestSize.Level0)
270 {
271 ItTestPthread023();
272 }
273
274
275 /* *
276 * @tc.name: it_test_pthread_025
277 * @tc.desc: function for ProcessPthreadTest
278 * @tc.type: FUNC
279 * @tc.require: issueI6T3P3
280 * @tc.author:
281 */
HWTEST_F(ProcessPthreadTest, ItTestPthread025, TestSize.Level0)282 HWTEST_F(ProcessPthreadTest, ItTestPthread025, TestSize.Level0)
283 {
284 ItTestPthread025();
285 }
286
287 /* *
288 * @tc.name: it_test_pthread_017
289 * @tc.desc: function for ProcessPthreadTest
290 * @tc.type: FUNC
291 */
HWTEST_F(ProcessPthreadTest, ItTestPthread017, TestSize.Level0)292 HWTEST_F(ProcessPthreadTest, ItTestPthread017, TestSize.Level0)
293 {
294 ItTestPthread017();
295 }
296
297
298 /* *
299 * @tc.name: it_test_pthread_once_001
300 * @tc.desc: function for ProcessPthreadTest
301 * @tc.type: FUNC
302 */
HWTEST_F(ProcessPthreadTest, ItTestPthreadOnce001, TestSize.Level0)303 HWTEST_F(ProcessPthreadTest, ItTestPthreadOnce001, TestSize.Level0)
304 {
305 ItTestPthreadOnce001();
306 }
307
308 /* *
309 * @tc.name: it_test_pthread_atfork_001
310 * @tc.desc: function for ProcessPthreadTest
311 * @tc.type: FUNC
312 */
HWTEST_F(ProcessPthreadTest, ItTestPthreadAtfork001, TestSize.Level0)313 HWTEST_F(ProcessPthreadTest, ItTestPthreadAtfork001, TestSize.Level0)
314 {
315 ItTestPthreadAtfork001();
316 }
317
318 /* *
319 * @tc.name: it_test_pthread_atfork_002
320 * @tc.desc: function for ProcessPthreadTest
321 * @tc.type: FUNC
322 */
HWTEST_F(ProcessPthreadTest, ItTestPthreadAtfork002, TestSize.Level0)323 HWTEST_F(ProcessPthreadTest, ItTestPthreadAtfork002, TestSize.Level0)
324 {
325 ItTestPthreadAtfork002();
326 }
327
328 /* *
329 * @tc.name: it_test_pthread_cond_001
330 * @tc.desc: function for ProcessPthreadTest
331 * @tc.type: FUNC
332 */
HWTEST_F(ProcessPthreadTest, ItTestPthreadCond001, TestSize.Level0)333 HWTEST_F(ProcessPthreadTest, ItTestPthreadCond001, TestSize.Level0)
334 {
335 ItTestPthreadCond001();
336 }
337
338 /* *
339 * @tc.name: it_test_pthread_cond_002
340 * @tc.desc: function for ProcessPthreadTest
341 * @tc.type: FUNC
342 */
HWTEST_F(ProcessPthreadTest, ItTestPthreadCond002, TestSize.Level0)343 HWTEST_F(ProcessPthreadTest, ItTestPthreadCond002, TestSize.Level0)
344 {
345 ItTestPthreadCond002();
346 }
347
348 /* *
349 * @tc.name: it_test_pthread_cond_003
350 * @tc.desc: function for ProcessPthreadTest
351 * @tc.type: FUNC
352 */
HWTEST_F(ProcessPthreadTest, ItTestPthreadCond003, TestSize.Level0)353 HWTEST_F(ProcessPthreadTest, ItTestPthreadCond003, TestSize.Level0)
354 {
355 ItTestPthreadCond003();
356 }
357
358 /* *
359 * @tc.name: it_test_pthread_cond_004
360 * @tc.desc: function for ProcessPthreadTest
361 * @tc.type: FUNC
362 */
HWTEST_F(ProcessPthreadTest, ItTestPthreadCond004, TestSize.Level0)363 HWTEST_F(ProcessPthreadTest, ItTestPthreadCond004, TestSize.Level0)
364 {
365 ItTestPthreadCond004();
366 }
367
368 #endif
369
370 #if defined(LOSCFG_USER_TEST_FULL)
371 /* *
372 * @tc.name: it_test_pthread_001
373 * @tc.desc: function for ProcessPthreadTest
374 * @tc.type: FUNC
375 */
HWTEST_F(ProcessPthreadTest, ItTestPthread001, TestSize.Level0)376 HWTEST_F(ProcessPthreadTest, ItTestPthread001, TestSize.Level0)
377 {
378 ItTestPthread001();
379 }
380
381 #ifndef LOSCFG_USER_TEST_SMP
382 /* *
383 * @tc.name: it_test_pthread_002
384 * @tc.desc: function for ProcessPthreadTest
385 * @tc.type: FUNC
386 */
HWTEST_F(ProcessPthreadTest, ItTestPthread002, TestSize.Level0)387 HWTEST_F(ProcessPthreadTest, ItTestPthread002, TestSize.Level0)
388 {
389 ItTestPthread002();
390 }
391 #endif
392 /* *
393 * @tc.name: it_test_pthread_004
394 * @tc.desc: function for ProcessPthreadTest
395 * @tc.type: FUNC
396 */
HWTEST_F(ProcessPthreadTest, ItTestPthread004, TestSize.Level0)397 HWTEST_F(ProcessPthreadTest, ItTestPthread004, TestSize.Level0)
398 {
399 ItTestPthread004();
400 }
401
402 /* *
403 * @tc.name: it_test_pthread_005
404 * @tc.desc: function for ProcessPthreadTest
405 * @tc.type: FUNC
406 */
HWTEST_F(ProcessPthreadTest, ItTestPthread005, TestSize.Level0)407 HWTEST_F(ProcessPthreadTest, ItTestPthread005, TestSize.Level0)
408 {
409 ItTestPthread005();
410 }
411
412 #ifndef LOSCFG_USER_TEST_SMP
413 /* *
414 * @tc.name: it_test_pthread_014
415 * @tc.desc: function for ProcessPthreadTest
416 * @tc.type: FUNC
417 */
HWTEST_F(ProcessPthreadTest, ItTestPthread014, TestSize.Level0)418 HWTEST_F(ProcessPthreadTest, ItTestPthread014, TestSize.Level0)
419 {
420 ItTestPthread014();
421 }
422 #endif
423
424 #endif
425 } // namespace OHOS
426