Skip to content

Commit 4ca7c14

Browse files
nashifkartben
authored andcommitted
tests: kernel: fix doxygen comments/groups for condition variables
Fix grouping and general doxygen fixups. Signed-off-by: Anas Nashif <[email protected]>
1 parent 7b3ed2f commit 4ca7c14

File tree

1 file changed

+93
-4
lines changed
  • tests/kernel/condvar/condvar_api/src

1 file changed

+93
-4
lines changed

tests/kernel/condvar/condvar_api/src/main.c

Lines changed: 93 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,15 @@ void condvar_wait_wake_task(void *p1, void *p2, void *p3)
133133

134134
k_mutex_unlock(&test_mutex);
135135
}
136-
136+
/**
137+
* @defgroup kernel_condvar_tests Condition Variables
138+
* @ingroup all_tests
139+
* @{
140+
* @}
141+
*
142+
* @addtogroup kernel_condvar_tests
143+
* @{
144+
*/
137145
/**
138146
* @brief Test k_condvar_wait() and k_condvar_wake()
139147
*/
@@ -163,7 +171,9 @@ ZTEST_USER(condvar_tests, test_condvar_wait_forever_wake)
163171
k_thread_abort(&condvar_tid);
164172
}
165173

166-
174+
/**
175+
* @brief Test k_condvar_wait() and k_condvar_wake() with timeout
176+
*/
167177
ZTEST_USER(condvar_tests, test_condvar_wait_timeout_wake)
168178
{
169179
woken = 1;
@@ -191,6 +201,9 @@ ZTEST_USER(condvar_tests, test_condvar_wait_timeout_wake)
191201
k_thread_abort(&condvar_tid);
192202
}
193203

204+
/**
205+
* @brief Test k_condvar_wait() and k_condvar_wake() with timeout
206+
*/
194207
ZTEST_USER(condvar_tests, test_condvar_wait_timeout)
195208
{
196209
timeout = k_ms_to_ticks_ceil32(50);
@@ -224,7 +237,9 @@ ZTEST_USER(condvar_tests, test_condvar_wait_forever)
224237
k_thread_abort(&condvar_tid);
225238
}
226239

227-
240+
/**
241+
* @brief Test k_condvar_wait() with no wait
242+
*/
228243
ZTEST_USER(condvar_tests, test_condvar_wait_nowait)
229244
{
230245
timeout = 0;
@@ -240,6 +255,12 @@ ZTEST_USER(condvar_tests, test_condvar_wait_nowait)
240255
}
241256

242257

258+
/**
259+
* @brief Test case for conditional variable wait and wake functionality.
260+
*
261+
* This test validates the behavior of conditional variables when a thread
262+
* waits on a condition and another thread wakes it up.
263+
*/
243264
ZTEST_USER(condvar_tests, test_condvar_wait_nowait_wake)
244265
{
245266
woken = 0;
@@ -266,6 +287,13 @@ ZTEST_USER(condvar_tests, test_condvar_wait_nowait_wake)
266287
}
267288

268289

290+
/**
291+
* @brief Test case for condition variable wait and wake functionality.
292+
*
293+
* This test verifies the behavior of a thread waiting on a condition variable
294+
* with an infinite timeout and being woken up from an interrupt service routine (ISR).
295+
*
296+
*/
269297
ZTEST(condvar_tests, test_condvar_wait_forever_wake_from_isr)
270298
{
271299
timeout = K_TICKS_FOREVER;
@@ -285,6 +313,15 @@ ZTEST(condvar_tests, test_condvar_wait_forever_wake_from_isr)
285313
k_thread_abort(&condvar_tid);
286314
}
287315

316+
/**
317+
* @brief Test case for multiple threads waiting and waking on a condition variable.
318+
*
319+
* This test initializes a condition variable and creates multiple threads that
320+
* wait on the condition variable. Another thread is created to wake up the
321+
* waiting threads. The test ensures proper synchronization and behavior of
322+
* threads waiting and waking on the condition variable.
323+
324+
*/
288325
ZTEST_USER(condvar_tests, test_condvar_multiple_threads_wait_wake)
289326
{
290327
timeout = K_TICKS_FOREVER;
@@ -353,6 +390,15 @@ void condvar_multiple_wake_task(void *p1, void *p2, void *p3)
353390
ret_value, woken_num);
354391
}
355392

393+
394+
/**
395+
* @brief Test multiple threads waiting and waking on a condition variable.
396+
*
397+
* This test creates multiple threads that wait on a condition variable and
398+
* another set of threads that wake them up. It ensures that the condition
399+
* variable mechanism works correctly when multiple threads are involved.
400+
401+
*/
356402
ZTEST_USER(condvar_tests, test_multiple_condvar_wait_wake)
357403
{
358404
woken = 1;
@@ -404,6 +450,14 @@ static void cond_init_null(void *p1, void *p2, void *p3)
404450
ztest_test_fail();
405451
}
406452

453+
454+
/**
455+
* @brief Test case for conditional variable initialization with a null parameter.
456+
*
457+
* This test verifies the behavior of the conditional variable initialization
458+
* when a null parameter is passed. It creates a thread to execute the
459+
* `cond_init_null` function and ensures the thread completes execution.
460+
*/
407461
ZTEST_USER(condvar_tests, test_condvar_init_null)
408462
{
409463
k_tid_t tid = k_thread_create(&condvar_tid, stack_1, STACK_SIZE,
@@ -460,7 +514,13 @@ static void cond_wait_null(void *p1, void *p2, void *p3)
460514
/* should not go here*/
461515
ztest_test_fail();
462516
}
463-
517+
/**
518+
* @brief Test case for signaling a condition variable with a NULL parameter.
519+
*
520+
* This test creates a thread that attempts to signal a condition variable
521+
* with a NULL parameter. It ensures that the system handles this scenario
522+
* gracefully without causing unexpected behavior or crashes.
523+
*/
464524
ZTEST_USER(condvar_tests, test_condvar_signal_null)
465525
{
466526
k_tid_t tid = k_thread_create(&condvar_tid, stack_1, STACK_SIZE,
@@ -470,6 +530,14 @@ ZTEST_USER(condvar_tests, test_condvar_signal_null)
470530
K_USER | K_INHERIT_PERMS, K_NO_WAIT);
471531
k_thread_join(tid, K_FOREVER);
472532
}
533+
534+
/**
535+
* @brief Test case for broadcasting a condition variable with a NULL parameter.
536+
*
537+
* This test creates a thread that attempts to broadcast a condition variable
538+
* with a NULL parameter. It verifies that the system can handle this edge case
539+
* correctly and does not result in undefined behavior.
540+
*/
473541
ZTEST_USER(condvar_tests, test_condvar_broadcast_null)
474542
{
475543
k_tid_t tid = k_thread_create(&condvar_tid, stack_1, STACK_SIZE,
@@ -480,6 +548,14 @@ ZTEST_USER(condvar_tests, test_condvar_broadcast_null)
480548

481549
k_thread_join(tid, K_FOREVER);
482550
}
551+
552+
/**
553+
* @brief Test case for waiting on a condition variable with a NULL parameter.
554+
*
555+
* This test creates a thread that attempts to wait on a condition variable
556+
* with a NULL parameter. It ensures that the system properly handles this
557+
* invalid operation and maintains stability.
558+
*/
483559
ZTEST_USER(condvar_tests, test_condvar_wait_null)
484560
{
485561
k_tid_t tid = k_thread_create(&condvar_tid, stack_1, STACK_SIZE,
@@ -575,11 +651,20 @@ void _condvar_usecase(long multi)
575651

576652
}
577653

654+
655+
/**
656+
* @brief Test case for conditional variable use case with signal
657+
*
658+
* This test verifies the behavior of a conditional variable in a specific
659+
* use case where a signal is used. It ensures that the conditional variable
660+
* operates correctly when signaled, validating synchronization mechanisms.
661+
*/
578662
ZTEST_USER(condvar_tests, test_condvar_usecase_signal)
579663
{
580664
_condvar_usecase(0);
581665
}
582666

667+
583668
ZTEST_USER(condvar_tests, test_condvar_usecase_broadcast)
584669
{
585670
_condvar_usecase(1);
@@ -604,4 +689,8 @@ static void *condvar_tests_setup(void)
604689
return NULL;
605690
}
606691

692+
/**
693+
* @}
694+
*/
695+
607696
ZTEST_SUITE(condvar_tests, NULL, condvar_tests_setup, NULL, NULL, NULL);

0 commit comments

Comments
 (0)