thread_tc.c 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743
  1. /*
  2. * Copyright (c) 2006-2021, RT-Thread Development Team
  3. *
  4. * SPDX-License-Identifier: Apache-2.0
  5. *
  6. * Change Logs:
  7. * Date Author Notes
  8. * 2021-09.01 yangjie the firet version
  9. * 2021-10.11 mazhiyuan add idle, yield, suspend, control, priority, delay_until
  10. */
  11. #include <rtthread.h>
  12. #include <stdlib.h>
  13. #include "utest.h"
  14. #define THREAD_STACK_SIZE UTEST_THR_STACK_SIZE
  15. #define THREAD_TIMESLICE 10
  16. rt_align(RT_ALIGN_SIZE)
  17. static char thread2_stack[UTEST_THR_STACK_SIZE];
  18. static struct rt_thread thread2;
  19. #ifdef RT_USING_HEAP
  20. static rt_thread_t tid1 = RT_NULL;
  21. static rt_thread_t tid3 = RT_NULL;
  22. static rt_thread_t tid4 = RT_NULL;
  23. static rt_thread_t tid5 = RT_NULL;
  24. static rt_thread_t tid6 = RT_NULL;
  25. static rt_thread_t tid7 = RT_NULL;
  26. #endif /* RT_USING_HEAP */
  27. static volatile rt_uint32_t tid3_delay_pass_flag = 0;
  28. static volatile rt_uint32_t tid3_finish_flag = 0;
  29. static volatile rt_uint32_t tid4_finish_flag = 0;
  30. static volatile rt_uint32_t tid6_finish_flag = 0;
  31. static volatile rt_uint32_t thread5_source = 0;
  32. #ifndef RT_USING_SMP
  33. static volatile rt_uint32_t thread_yield_flag = 0;
  34. #endif
  35. static volatile rt_uint32_t entry_idle_hook_times = 0;
  36. static rt_thread_t __current_thread;
  37. static rt_uint8_t change_priority;
  38. static volatile rt_uint32_t count = 0;
  39. void thread1_entry(void *param)
  40. {
  41. while (1);
  42. }
  43. static void test_dynamic_thread(void)
  44. {
  45. rt_err_t ret_startup = -RT_ERROR;
  46. rt_err_t ret_delete = -RT_ERROR;
  47. tid1 = rt_thread_create("thread1",
  48. thread1_entry,
  49. (void *)1,
  50. THREAD_STACK_SIZE,
  51. __current_thread->current_priority + 1,
  52. THREAD_TIMESLICE - 5);
  53. if (tid1 == RT_NULL)
  54. {
  55. uassert_false(tid1 == RT_NULL);
  56. goto __exit;
  57. }
  58. ret_startup = rt_thread_startup(tid1);
  59. if (ret_startup != RT_EOK)
  60. {
  61. uassert_false(ret_startup != RT_EOK);
  62. goto __exit;
  63. }
  64. ret_delete = rt_thread_delete(tid1);
  65. if (ret_delete != RT_EOK)
  66. {
  67. uassert_false(ret_delete != RT_EOK);
  68. goto __exit;
  69. }
  70. uassert_true(tid1 != RT_NULL && ret_startup == RT_EOK && ret_delete == RT_EOK);
  71. __exit:
  72. if (tid1 != RT_NULL && ret_delete != RT_EOK)
  73. {
  74. rt_thread_delete(tid1);
  75. }
  76. return;
  77. }
  78. void thread2_entry(void *param)
  79. {
  80. while (1);
  81. }
  82. static void test_static_thread(void)
  83. {
  84. rt_err_t ret_init = -RT_ERROR;
  85. rt_err_t ret_startup = -RT_ERROR;
  86. rt_err_t ret_detach = -RT_ERROR;
  87. ret_init = rt_thread_init(&thread2,
  88. "thread2",
  89. thread2_entry,
  90. (void *)2,
  91. &thread2_stack[0],
  92. sizeof(thread2_stack),
  93. __current_thread->current_priority + 1,
  94. THREAD_TIMESLICE);
  95. if (ret_init != RT_EOK)
  96. {
  97. uassert_false(ret_init != RT_EOK);
  98. goto __exit;
  99. }
  100. ret_startup = rt_thread_startup(&thread2);
  101. if (ret_startup != RT_EOK)
  102. {
  103. uassert_false(ret_startup != RT_EOK);
  104. goto __exit;
  105. }
  106. ret_detach = rt_thread_detach(&thread2);
  107. if (ret_detach != RT_EOK)
  108. {
  109. uassert_false(ret_detach != RT_EOK);
  110. goto __exit;
  111. }
  112. uassert_true(ret_init == RT_EOK && ret_startup == RT_EOK && ret_detach == RT_EOK);
  113. __exit:
  114. if (ret_init == RT_EOK && ret_detach != RT_EOK)
  115. {
  116. rt_thread_detach(&thread2);
  117. }
  118. return;
  119. }
  120. static void thread3_entry(void *parameter)
  121. {
  122. rt_tick_t tick;
  123. tick = rt_tick_get();
  124. rt_thread_delay(15);
  125. if (rt_tick_get() - tick > 16)
  126. {
  127. tid3_finish_flag = 1;
  128. tid3_delay_pass_flag = 0;
  129. return;
  130. }
  131. tid3_delay_pass_flag = 1;
  132. tid3_finish_flag = 1;
  133. }
  134. static void test_thread_delay(void)
  135. {
  136. rt_err_t ret_startup = -RT_ERROR;
  137. tid3 = rt_thread_create("thread3",
  138. thread3_entry,
  139. RT_NULL,
  140. THREAD_STACK_SIZE,
  141. __current_thread->current_priority - 1,
  142. THREAD_TIMESLICE);
  143. if (tid3 == RT_NULL)
  144. {
  145. LOG_E("rt_thread_create failed!");
  146. uassert_false(tid3 == RT_NULL);
  147. goto __exit;
  148. }
  149. ret_startup = rt_thread_startup(tid3);
  150. if (ret_startup != RT_EOK)
  151. {
  152. LOG_E("rt_thread_startup failed!");
  153. uassert_false(1);
  154. goto __exit;
  155. }
  156. while (tid3_finish_flag != 1);
  157. uassert_true(tid3_delay_pass_flag == 1);
  158. __exit:
  159. return;
  160. }
  161. static void idle_hook(void)
  162. {
  163. entry_idle_hook_times ++;
  164. }
  165. static void thread4_entry(void *parameter)
  166. {
  167. rt_uint32_t delay_times = 5;
  168. while (delay_times --)
  169. {
  170. rt_thread_mdelay(300);
  171. }
  172. rt_thread_idle_delhook(idle_hook);
  173. tid4_finish_flag = 1;
  174. }
  175. static void test_idle_hook(void)
  176. {
  177. rt_err_t ret_startup = -RT_ERROR;
  178. rt_thread_idle_sethook(idle_hook);
  179. tid4 = rt_thread_create("thread4",
  180. thread4_entry,
  181. RT_NULL,
  182. THREAD_STACK_SIZE,
  183. __current_thread->current_priority - 1,
  184. THREAD_TIMESLICE);
  185. if (tid4 == RT_NULL)
  186. {
  187. LOG_E("rt_thread_create failed!");
  188. uassert_false(tid4 == RT_NULL);
  189. goto __exit;
  190. }
  191. ret_startup = rt_thread_startup(tid4);
  192. if (ret_startup != RT_EOK)
  193. {
  194. LOG_E("rt_thread_startup failed!");
  195. uassert_false(1);
  196. goto __exit;
  197. }
  198. while (tid4_finish_flag != 1)
  199. {
  200. rt_thread_mdelay(200);
  201. }
  202. uassert_true(entry_idle_hook_times > 0);
  203. __exit:
  204. return;
  205. }
  206. static void thread5_entry(void *parameter)
  207. {
  208. while (1)
  209. {
  210. thread5_source ++;
  211. rt_thread_delay(5);
  212. if (thread5_source == 5)
  213. {
  214. rt_thread_yield();
  215. }
  216. }
  217. }
  218. static void thread6_entry(void *parameter)
  219. {
  220. while (++ thread5_source <= 9);
  221. tid6_finish_flag = 1;
  222. }
  223. static void test_thread_yield(void)
  224. {
  225. rt_err_t ret_startup = -RT_ERROR;
  226. thread5_source = 0;
  227. tid5 = rt_thread_create("thread5",
  228. thread5_entry,
  229. RT_NULL,
  230. THREAD_STACK_SIZE,
  231. __current_thread->current_priority - 1,
  232. THREAD_TIMESLICE);
  233. if (tid5 == RT_NULL)
  234. {
  235. LOG_E("rt_thread_create failed!");
  236. uassert_false(tid5 == RT_NULL);
  237. goto __exit;
  238. }
  239. ret_startup = rt_thread_startup(tid5);
  240. if (ret_startup != RT_EOK)
  241. {
  242. LOG_E("rt_thread_startup failed!");
  243. uassert_false(1);
  244. goto __exit;
  245. }
  246. tid6 = rt_thread_create("thread6",
  247. thread6_entry,
  248. RT_NULL,
  249. THREAD_STACK_SIZE,
  250. __current_thread->current_priority - 1,
  251. THREAD_TIMESLICE);
  252. if (tid6 == RT_NULL)
  253. {
  254. LOG_E("rt_thread_create failed!");
  255. uassert_false(tid6 == RT_NULL);
  256. goto __exit;
  257. }
  258. ret_startup = rt_thread_startup(tid6);
  259. if (ret_startup != RT_EOK)
  260. {
  261. LOG_E("rt_thread_startup failed!");
  262. uassert_false(1);
  263. goto __exit;
  264. }
  265. while (tid6_finish_flag != 1);
  266. uassert_true(thread5_source == 10);
  267. __exit:
  268. if (tid5 != RT_NULL)
  269. {
  270. rt_thread_delete(tid5);
  271. }
  272. return;
  273. }
  274. static void thread7_entry(void *parameter)
  275. {
  276. while (1);
  277. }
  278. static void test_thread_control(void)
  279. {
  280. rt_err_t ret_control = -RT_ERROR;
  281. rt_err_t rst_delete = -RT_ERROR;
  282. tid7 = rt_thread_create("thread7",
  283. thread7_entry,
  284. RT_NULL,
  285. THREAD_STACK_SIZE,
  286. __current_thread->current_priority + 1,
  287. THREAD_TIMESLICE);
  288. if (tid7 == RT_NULL)
  289. {
  290. LOG_E("rt_thread_create failed!");
  291. uassert_false(tid7 == RT_NULL);
  292. goto __exit;
  293. }
  294. ret_control = rt_thread_control(tid7, RT_THREAD_CTRL_STARTUP, RT_NULL);
  295. if (ret_control != RT_EOK)
  296. {
  297. LOG_E("rt_thread_control failed!");
  298. uassert_false(1);
  299. goto __exit;
  300. }
  301. rt_thread_mdelay(200);
  302. rt_thread_control(tid7, RT_THREAD_CTRL_CHANGE_PRIORITY, &change_priority);
  303. if (tid7->current_priority != change_priority)
  304. {
  305. LOG_E("rt_thread_control failed!");
  306. uassert_false(1);
  307. goto __exit;
  308. }
  309. rst_delete = rt_thread_control(tid7, RT_THREAD_CTRL_CLOSE, RT_NULL);
  310. if (rst_delete != RT_EOK)
  311. {
  312. LOG_E("rt_thread_control failed!");
  313. uassert_false(rst_delete != RT_EOK);
  314. goto __exit;
  315. }
  316. uassert_true(1);
  317. __exit:
  318. if (tid7 != RT_NULL && rst_delete != RT_EOK)
  319. {
  320. rt_thread_delete(tid7);
  321. }
  322. return;
  323. }
  324. static void thread8_entry(void *parameter)
  325. {
  326. for (; count < 10; count ++);
  327. }
  328. static void test_thread_priority(void)
  329. {
  330. rt_err_t ret_startup = -RT_ERROR;
  331. rt_thread_t tid8 = RT_NULL;
  332. tid8 = rt_thread_create("thread8",
  333. thread8_entry,
  334. RT_NULL,
  335. THREAD_STACK_SIZE,
  336. __current_thread->current_priority - 1,
  337. THREAD_TIMESLICE);
  338. if (tid8 == RT_NULL)
  339. {
  340. LOG_E("rt_thread_create failed!");
  341. uassert_false(tid8 == RT_NULL);
  342. return;
  343. }
  344. count = 0;
  345. ret_startup = rt_thread_startup(tid8);
  346. if (ret_startup != RT_EOK)
  347. {
  348. uassert_false(ret_startup != RT_EOK);
  349. return ;
  350. }
  351. uassert_true(count == 10);
  352. return;
  353. }
  354. static void test_delay_until(void)
  355. {
  356. rt_tick_t tick;
  357. rt_tick_t check_tick = 0;
  358. rt_tick_t delta = 0;
  359. tick = rt_tick_get();
  360. check_tick = tick;
  361. rt_thread_delay_until(&tick, 100);
  362. delta = rt_tick_get() - check_tick;
  363. rt_kprintf("delta[100] -> %d\n", delta);
  364. uassert_int_equal(delta, 100);
  365. check_tick = tick;
  366. rt_thread_delay(2);
  367. rt_thread_delay_until(&tick, 200);
  368. delta = rt_tick_get() - check_tick;
  369. rt_kprintf("delta[200] -> %d\n", delta);
  370. uassert_int_equal(delta, 200);
  371. check_tick = tick;
  372. rt_thread_delay(2);
  373. rt_thread_delay_until(&tick, 300);
  374. delta = rt_tick_get() - check_tick;
  375. rt_kprintf("delta[300] -> %d\n", delta);
  376. uassert_int_equal(delta, 300);
  377. check_tick = tick;
  378. rt_thread_delay(2);
  379. rt_thread_delay_until(&tick, 100);
  380. delta = rt_tick_get() - check_tick;
  381. uassert_int_equal(delta, 100);
  382. check_tick = tick;
  383. rt_thread_delay(2);
  384. rt_thread_delay_until(&tick, 50);
  385. delta = rt_tick_get() - check_tick;
  386. rt_kprintf("delta[50] -> %d\n", delta);
  387. uassert_int_equal(delta, 50);
  388. check_tick = tick;
  389. rt_thread_delay(2);
  390. rt_thread_delay_until(&tick, 20);
  391. delta = rt_tick_get() - check_tick;
  392. rt_kprintf("delta[20] -> %d\n", delta);
  393. uassert_int_equal(delta, 20);
  394. check_tick = tick;
  395. rt_thread_delay(2);
  396. rt_thread_delay_until(&tick, 10);
  397. delta = rt_tick_get() - check_tick;
  398. rt_kprintf("delta[10] -> %d\n", delta);
  399. uassert_int_equal(delta, 10);
  400. }
  401. static rt_thread_t tidA, tidB1, tidB2;
  402. static uint32_t timeslice_cntA, timeslice_cntB1, timeslice_cntB2;
  403. static void test_timeslice_threadA_entry(void *parameter)
  404. {
  405. while (1)
  406. {
  407. rt_thread_delay(2);
  408. timeslice_cntA++;
  409. if (timeslice_cntA > 10) return;
  410. }
  411. }
  412. static void test_timeslice_threadB1_entry(void *parameter)
  413. {
  414. while (1)
  415. {
  416. timeslice_cntB1++;
  417. if (timeslice_cntA > 10) return;
  418. }
  419. }
  420. static void test_timeslice_threadB2_entry(void *parameter)
  421. {
  422. while (1)
  423. {
  424. timeslice_cntB2++;
  425. if (timeslice_cntA > 10) return;
  426. }
  427. }
  428. void test_timeslice(void)
  429. {
  430. rt_err_t ret_startup = -RT_ERROR;
  431. uint32_t diff;
  432. timeslice_cntA = 0;
  433. timeslice_cntB1 = 0;
  434. timeslice_cntB2 = 0;
  435. tidA = rt_thread_create("timeslice", test_timeslice_threadA_entry, RT_NULL,
  436. 2048, __current_thread->current_priority + 1, 10);
  437. if (!tidA)
  438. {
  439. LOG_E("rt_thread_create failed!");
  440. return;
  441. }
  442. rt_thread_control(tidA, RT_THREAD_CTRL_BIND_CPU, (void *)1);
  443. ret_startup = rt_thread_startup(tidA);
  444. if (ret_startup != RT_EOK)
  445. {
  446. LOG_E("rt_thread_startup failed!");
  447. uassert_false(1);
  448. return ;
  449. }
  450. tidB1 = rt_thread_create("timeslice", test_timeslice_threadB1_entry, RT_NULL,
  451. 2048, __current_thread->current_priority + 2, 2);
  452. if (!tidB1)
  453. {
  454. LOG_E("rt_thread_create failed!");
  455. return;
  456. }
  457. rt_thread_control(tidB1, RT_THREAD_CTRL_BIND_CPU, (void *)1);
  458. ret_startup = rt_thread_startup(tidB1);
  459. if (ret_startup != RT_EOK)
  460. {
  461. LOG_E("rt_thread_startup failed!");
  462. uassert_false(1);
  463. return ;
  464. }
  465. tidB2 = rt_thread_create("timeslice", test_timeslice_threadB2_entry, RT_NULL,
  466. 2048, __current_thread->current_priority + 2, 2);
  467. if (!tidB2)
  468. {
  469. LOG_E("rt_thread_create failed!");
  470. return;
  471. }
  472. rt_thread_control(tidB2, RT_THREAD_CTRL_BIND_CPU, (void *)1);
  473. ret_startup = rt_thread_startup(tidB2);
  474. if (ret_startup != RT_EOK)
  475. {
  476. LOG_E("rt_thread_startup failed!");
  477. uassert_false(1);
  478. return ;
  479. }
  480. do{
  481. rt_thread_delay(2 * 20);
  482. }while(timeslice_cntA <= 10);
  483. rt_kprintf("A:%d,B1:%d,B2:%d\n", timeslice_cntA, timeslice_cntB1, timeslice_cntB2);
  484. diff = abs(timeslice_cntB1 - timeslice_cntB2);
  485. uassert_true(diff * 100 / timeslice_cntB1 < 30);
  486. uassert_true(timeslice_cntA == 11);
  487. }
  488. #ifndef RT_USING_SMP
  489. static volatile rt_uint32_t yield_count;
  490. static void test_thread_yield_inc_entry(void *parameter)
  491. {
  492. rt_uint32_t loop = 0;
  493. while (1)
  494. {
  495. if (loop++ > 10001)
  496. break;
  497. yield_count++;
  498. rt_thread_yield();
  499. }
  500. }
  501. static void test_thread_yield_entry(void *parameter)
  502. {
  503. rt_err_t ret_startup = -RT_ERROR;
  504. rt_thread_t tid;
  505. rt_uint32_t loop = 0;
  506. rt_uint32_t count_before;
  507. tid = rt_thread_create("inc", test_thread_yield_inc_entry, RT_NULL,
  508. 2048, 1, 10);
  509. if (!tid)
  510. {
  511. LOG_E("rt_thread_create failed!");
  512. return;
  513. }
  514. ret_startup = rt_thread_startup(tid);
  515. if (ret_startup != RT_EOK)
  516. {
  517. LOG_E("rt_thread_startup failed!");
  518. uassert_false(1);
  519. return ;
  520. }
  521. while (1)
  522. {
  523. if (loop++ > 10000)
  524. break;
  525. count_before = yield_count;
  526. rt_thread_yield();
  527. if (yield_count == count_before)
  528. {
  529. LOG_E("yield error!");
  530. return;
  531. }
  532. }
  533. thread_yield_flag = 1;
  534. }
  535. void test_thread_yield_nosmp(void)
  536. {
  537. rt_err_t ret_startup = -RT_ERROR;
  538. rt_thread_t tid;
  539. yield_count = 0;
  540. tid = rt_thread_create("chkcnt", test_thread_yield_entry, RT_NULL,
  541. 2048, 1, 10);
  542. if (!tid)
  543. {
  544. LOG_E("rt_thread_create failed!");
  545. return;
  546. }
  547. ret_startup = rt_thread_startup(tid);
  548. if (ret_startup != RT_EOK)
  549. {
  550. LOG_E("rt_thread_startup failed!");
  551. uassert_false(1);
  552. return ;
  553. }
  554. uassert_true(thread_yield_flag == 1);
  555. }
  556. // static rt_uint32_t thread9_count = 0;
  557. // static void thread9_entry(void *parameter)
  558. // {
  559. // while (1)
  560. // {
  561. // thread9_count ++;
  562. // }
  563. // }
  564. // static void test_thread_suspend(void)
  565. // {
  566. // static rt_thread_t tid;
  567. // rt_err_t ret_startup = -RT_ERROR;
  568. // uint32_t count_before_suspend, count_before_resume, count_after_resume;
  569. // tid = rt_thread_create("thread9",
  570. // thread9_entry,
  571. // RT_NULL,
  572. // THREAD_STACK_SIZE,
  573. // __current_thread->current_priority + 1,
  574. // THREAD_TIMESLICE);
  575. // if (tid == RT_NULL)
  576. // {
  577. // LOG_E("rt_thread_create failed!");
  578. // uassert_false(tid4 == RT_NULL);
  579. // goto __exit;
  580. // }
  581. // ret_startup = rt_thread_startup(tid);
  582. // if (ret_startup != RT_EOK)
  583. // {
  584. // LOG_E("rt_thread_startup failed!");
  585. // uassert_false(1);
  586. // goto __exit;
  587. // }
  588. // rt_thread_delay(5);
  589. // rt_thread_suspend(tid);
  590. // count_before_suspend = thread9_count;
  591. // uassert_true(count_before_suspend != 0);
  592. // rt_thread_delay(5);
  593. // count_before_resume = thread9_count;
  594. // uassert_true(count_before_suspend == count_before_resume);
  595. // rt_thread_resume(tid);
  596. // rt_thread_delay(5);
  597. // count_after_resume = thread9_count;
  598. // uassert_true(count_after_resume != count_before_resume);
  599. // __exit:
  600. // if (tid != RT_NULL)
  601. // {
  602. // rt_thread_delete(tid);
  603. // }
  604. // return;
  605. // }
  606. #endif
  607. static rt_err_t utest_tc_init(void)
  608. {
  609. __current_thread = rt_thread_self();
  610. change_priority = __current_thread->current_priority + 5;
  611. tid3_delay_pass_flag = 0;
  612. tid3_finish_flag = 0;
  613. tid4_finish_flag = 0;
  614. tid6_finish_flag = 0;
  615. entry_idle_hook_times = 0;
  616. count = 0;
  617. return RT_EOK;
  618. }
  619. static rt_err_t utest_tc_cleanup(void)
  620. {
  621. return RT_EOK;
  622. }
  623. static void testcase(void)
  624. {
  625. /* init, detach */
  626. UTEST_UNIT_RUN(test_static_thread);
  627. /* create, delete */
  628. UTEST_UNIT_RUN(test_dynamic_thread);
  629. /* delay */
  630. UTEST_UNIT_RUN(test_thread_delay);
  631. /* idle_sethook, idle_delhook */
  632. UTEST_UNIT_RUN(test_idle_hook);
  633. /* yield */
  634. UTEST_UNIT_RUN(test_thread_yield);
  635. #ifndef RT_USING_SMP
  636. /* yield_nosmp */
  637. UTEST_UNIT_RUN(test_thread_yield_nosmp);
  638. /* suspend, resume */
  639. // UTEST_UNIT_RUN(test_thread_suspend);
  640. #endif
  641. /* control */
  642. UTEST_UNIT_RUN(test_thread_control);
  643. UTEST_UNIT_RUN(test_thread_priority);
  644. /* delay_until */
  645. UTEST_UNIT_RUN(test_delay_until);
  646. /* timeslice */
  647. // UTEST_UNIT_RUN(test_timeslice); /* Can not running in Github Action QEMU */
  648. }
  649. UTEST_TC_EXPORT(testcase, "testcases.kernel.thread_tc", utest_tc_init, utest_tc_cleanup, 1000);
  650. /********************* end of file ************************/