@@ -78,7 +78,7 @@ static void customdata_entry(void *p1, void *p2, void *p3)
78
78
79
79
/**
80
80
* @ingroup kernel_thread_tests
81
- * @brief test thread custom data get/set from coop thread
81
+ * @brief Test thread custom data get/set from coop thread
82
82
*
83
83
* @see k_thread_custom_data_get(), k_thread_custom_data_set()
84
84
*/
@@ -101,7 +101,7 @@ static void thread_name_entry(void *p1, void *p2, void *p3)
101
101
102
102
/**
103
103
* @ingroup kernel_thread_tests
104
- * @brief test thread name get/set from supervisor thread
104
+ * @brief Test thread name get/set from supervisor thread
105
105
* @see k_thread_name_get(), k_thread_name_copy(), k_thread_name_set()
106
106
*/
107
107
ZTEST (threads_lifecycle , test_thread_name_get_set )
@@ -142,7 +142,7 @@ struct k_sem sem;
142
142
143
143
/**
144
144
* @ingroup kernel_thread_tests
145
- * @brief test thread name get/set from user thread
145
+ * @brief Test thread name get/set from user thread
146
146
* @see k_thread_name_copy(), k_thread_name_set()
147
147
*/
148
148
ZTEST_USER (threads_lifecycle , test_thread_name_user_get_set )
@@ -211,7 +211,7 @@ ZTEST_USER(threads_lifecycle, test_thread_name_user_get_set)
211
211
212
212
/**
213
213
* @ingroup kernel_thread_tests
214
- * @brief test thread custom data get/set from preempt thread
214
+ * @brief Test thread custom data get/set from preempt thread
215
215
* @see k_thread_custom_data_get(), k_thread_custom_data_set()
216
216
*/
217
217
ZTEST_USER (threads_lifecycle_1cpu , test_customdata_get_set_preempt )
@@ -243,7 +243,7 @@ static void umode_entry(void *thread_id, void *p2, void *p3)
243
243
244
244
/**
245
245
* @ingroup kernel_thread_tests
246
- * @brief Test k_thread_user_mode_enter() to cover when userspace
246
+ * @brief Test k_thread_user_mode_enter to cover when userspace
247
247
* is not supported/enabled
248
248
* @see k_thread_user_mode_enter()
249
249
*/
@@ -392,6 +392,11 @@ static inline int join_scenario(enum control_method m)
392
392
return join_scenario_interval (m , NULL );
393
393
}
394
394
395
+ /**
396
+ * @ingroup kernel_thread_tests
397
+ * @brief Test thread join
398
+ *
399
+ */
395
400
ZTEST_USER (threads_lifecycle , test_thread_join )
396
401
{
397
402
int64_t interval ;
@@ -415,6 +420,13 @@ ZTEST_USER(threads_lifecycle, test_thread_join)
415
420
416
421
}
417
422
423
+ /**
424
+ * @ingroup kernel_thread_tests
425
+ * @brief Test thread join from ISR
426
+ *
427
+ * @see k_thread_join()
428
+ * @see k_thread_abort()
429
+ */
418
430
ZTEST (threads_lifecycle , test_thread_join_isr )
419
431
{
420
432
zassert_equal (join_scenario (ISR_RUNNING ), - EBUSY , "failed isr running" );
@@ -447,6 +459,21 @@ static void deadlock2_entry(void *p1, void *p2, void *p3)
447
459
zassert_equal (ret , 0 , "couldn't join deadlock2_thread" );
448
460
}
449
461
462
+
463
+
464
+ /**
465
+ * @brief Test case for thread join deadlock scenarios.
466
+ *
467
+ * This test verifies the behavior of the `k_thread_join` API in scenarios
468
+ * that could lead to deadlocks. It includes the following checks:
469
+ *
470
+ * - Ensures that a thread cannot join itself, which would result in a
471
+ * self-deadlock. The API should return `-EDEADLK` in this case.
472
+ * - Creates two threads (`deadlock1_thread` and `deadlock2_thread`) and
473
+ * verifies that they can be joined successfully without causing a deadlock.
474
+ *
475
+ * @ingroup kernel_thread_tests
476
+ */
450
477
ZTEST_USER (threads_lifecycle , test_thread_join_deadlock )
451
478
{
452
479
/* Deadlock scenarios */
@@ -476,6 +503,11 @@ static void user_start_thread(void *p1, void *p2, void *p3)
476
503
{
477
504
/* do nothing */
478
505
}
506
+ /**
507
+ * @brief Test case for verifying thread timeout expiration and remaining time.
508
+ *
509
+ * @ingroup kernel_thread_tests
510
+ */
479
511
480
512
ZTEST_USER (threads_lifecycle , test_thread_timeout_remaining_expires )
481
513
{
@@ -528,10 +560,16 @@ static void foreach_callback(const struct k_thread *thread, void *user_data)
528
560
stats .execution_cycles ;
529
561
}
530
562
531
- /* This case accumulates every thread's execution_cycles first, then
563
+ /**
564
+ * @brief Test case for thread runtime statistics retrieval in Zephyr kernel
565
+ *
566
+ * This case accumulates every thread's execution_cycles first, then
532
567
* get the total execution_cycles from a global
533
568
* k_thread_runtime_stats_t to see that all time is reflected in the
534
569
* total.
570
+ *
571
+ * @ingroup kernel_thread_tests
572
+ * @see k_thread_runtime_stats_get()
535
573
*/
536
574
ZTEST (threads_lifecycle , test_thread_runtime_stats_get )
537
575
{
@@ -551,6 +589,13 @@ ZTEST(threads_lifecycle, test_thread_runtime_stats_get)
551
589
zassert_true (stats .execution_cycles <= stats_all .execution_cycles );
552
590
}
553
591
592
+
593
+ /**
594
+ * @brief Test the behavior of k_busy_wait with thread runtime statistics.
595
+ *
596
+ * This test verifies the accuracy of the `k_busy_wait` function by checking
597
+ * the thread's execution cycle statistics before and after calling the function.
598
+ */
554
599
ZTEST (threads_lifecycle , test_k_busy_wait )
555
600
{
556
601
uint64_t cycles , dt ;
@@ -589,6 +634,12 @@ static void tp_entry(void *p1, void *p2, void *p3)
589
634
tp = 100 ;
590
635
}
591
636
637
+ /**
638
+ * @brief Test the behavior of k_busy_wait with thread runtime statistics
639
+ * in user mode.
640
+ *
641
+ * @ingroup kernel_thread_tests
642
+ */
592
643
ZTEST_USER (threads_lifecycle_1cpu , test_k_busy_wait_user )
593
644
{
594
645
@@ -624,9 +675,14 @@ static int small_stack(size_t *space)
624
675
return k_thread_stack_space_get (k_current_get (), space );
625
676
}
626
677
627
- /* test k_thread_stack_sapce_get(), unused stack space in large_stack_space()
678
+ /**
679
+ * @brief Test k_thread_stack_sapce_get
680
+ *
681
+ * Test k_thread_stack_sapce_get unused stack space in large_stack_space()
628
682
* is smaller than that in small_stack() because the former function has a
629
683
* large local variable
684
+ *
685
+ * @ingroup kernel_thread_tests
630
686
*/
631
687
ZTEST_USER (threads_lifecycle , test_k_thread_stack_space_get_user )
632
688
{
0 commit comments