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 */ 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 */ 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 */ 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 */ 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 */ 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 */ 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 */ 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 */ 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 */ 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 */ 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 */ 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 */ 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 */ 184 HWTEST_F(ProcessPthreadTest, ItTestPthread019, TestSize.Level0) 185 { 186 ItTestPthread019(); 187 } 188 189 /* * 190 * @tc.name: it_test_pthread_017 191 * @tc.desc: function for ProcessPthreadTest 192 * @tc.type: FUNC 193 */ 194 HWTEST_F(ProcessPthreadTest, ItTestPthread017, TestSize.Level0) 195 { 196 ItTestPthread017(); 197 } 198 199 200 /* * 201 * @tc.name: it_test_pthread_once_001 202 * @tc.desc: function for ProcessPthreadTest 203 * @tc.type: FUNC 204 */ 205 HWTEST_F(ProcessPthreadTest, ItTestPthreadOnce001, TestSize.Level0) 206 { 207 ItTestPthreadOnce001(); 208 } 209 210 /* * 211 * @tc.name: it_test_pthread_atfork_001 212 * @tc.desc: function for ProcessPthreadTest 213 * @tc.type: FUNC 214 */ 215 HWTEST_F(ProcessPthreadTest, ItTestPthreadAtfork001, TestSize.Level0) 216 { 217 ItTestPthreadAtfork001(); 218 } 219 220 /* * 221 * @tc.name: it_test_pthread_atfork_002 222 * @tc.desc: function for ProcessPthreadTest 223 * @tc.type: FUNC 224 */ 225 HWTEST_F(ProcessPthreadTest, ItTestPthreadAtfork002, TestSize.Level0) 226 { 227 ItTestPthreadAtfork002(); 228 } 229 230 /* * 231 * @tc.name: it_test_pthread_cond_001 232 * @tc.desc: function for ProcessPthreadTest 233 * @tc.type: FUNC 234 */ 235 HWTEST_F(ProcessPthreadTest, ItTestPthreadCond001, TestSize.Level0) 236 { 237 ItTestPthreadCond001(); 238 } 239 240 /* * 241 * @tc.name: it_test_pthread_cond_002 242 * @tc.desc: function for ProcessPthreadTest 243 * @tc.type: FUNC 244 */ 245 HWTEST_F(ProcessPthreadTest, ItTestPthreadCond002, TestSize.Level0) 246 { 247 ItTestPthreadCond002(); 248 } 249 250 /* * 251 * @tc.name: it_test_pthread_cond_003 252 * @tc.desc: function for ProcessPthreadTest 253 * @tc.type: FUNC 254 */ 255 HWTEST_F(ProcessPthreadTest, ItTestPthreadCond003, TestSize.Level0) 256 { 257 ItTestPthreadCond003(); 258 } 259 260 /* * 261 * @tc.name: it_test_pthread_cond_004 262 * @tc.desc: function for ProcessPthreadTest 263 * @tc.type: FUNC 264 */ 265 HWTEST_F(ProcessPthreadTest, ItTestPthreadCond004, TestSize.Level0) 266 { 267 ItTestPthreadCond004(); 268 } 269 270 #endif 271 272 #if defined(LOSCFG_USER_TEST_FULL) 273 /* * 274 * @tc.name: it_test_pthread_001 275 * @tc.desc: function for ProcessPthreadTest 276 * @tc.type: FUNC 277 */ 278 HWTEST_F(ProcessPthreadTest, ItTestPthread001, TestSize.Level0) 279 { 280 ItTestPthread001(); 281 } 282 283 #ifndef LOSCFG_USER_TEST_SMP 284 /* * 285 * @tc.name: it_test_pthread_002 286 * @tc.desc: function for ProcessPthreadTest 287 * @tc.type: FUNC 288 */ 289 HWTEST_F(ProcessPthreadTest, ItTestPthread002, TestSize.Level0) 290 { 291 ItTestPthread002(); 292 } 293 #endif 294 /* * 295 * @tc.name: it_test_pthread_004 296 * @tc.desc: function for ProcessPthreadTest 297 * @tc.type: FUNC 298 */ 299 HWTEST_F(ProcessPthreadTest, ItTestPthread004, TestSize.Level0) 300 { 301 ItTestPthread004(); 302 } 303 304 /* * 305 * @tc.name: it_test_pthread_005 306 * @tc.desc: function for ProcessPthreadTest 307 * @tc.type: FUNC 308 */ 309 HWTEST_F(ProcessPthreadTest, ItTestPthread005, TestSize.Level0) 310 { 311 ItTestPthread005(); 312 } 313 314 #ifndef LOSCFG_USER_TEST_SMP 315 /* * 316 * @tc.name: it_test_pthread_014 317 * @tc.desc: function for ProcessPthreadTest 318 * @tc.type: FUNC 319 */ 320 HWTEST_F(ProcessPthreadTest, ItTestPthread014, TestSize.Level0) 321 { 322 ItTestPthread014(); 323 } 324 #endif 325 326 #endif 327 } // namespace OHOS 328