summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDavid Frisbee <[email protected]>2025-11-18 04:22:03 -0500
committerGitHub <[email protected]>2025-11-18 17:22:03 +0800
commit6073c22164c491f2b1b5e1e03e6a499e390a712f (patch)
tree66b479027493de6afe74fc5b4d71b08146869ba4 /src
parent0af3b3eec1a6f65d3d7e1ad4232daa708c97050d (diff)
[docs]utest]:Add standardized utest documentation to atomic_tc and mtsafe_kprint_tc #10945
Diffstat (limited to 'src')
-rw-r--r--src/utest/atomic_tc.c30
-rw-r--r--src/utest/mtsafe_kprint_tc.c33
2 files changed, 61 insertions, 2 deletions
diff --git a/src/utest/atomic_tc.c b/src/utest/atomic_tc.c
index 7322da8233..ebf050fe0d 100644
--- a/src/utest/atomic_tc.c
+++ b/src/utest/atomic_tc.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2006-2021, RT-Thread Development Team
+ * Copyright (c) 2006-2025, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
@@ -8,6 +8,34 @@
* 2022-07-27 flybreak the first version
* 2023-03-21 WangShun add atomic test
* 2023-09-15 xqyjlj change stack size in cpu64
+ * 2025-11-16 h0bbl3s Add standardized utest documentation block
+ */
+
+/**
+ * Test Case Name: Kernel Core Atomic Operations Test
+ *
+ * Test Objectives:
+ * - Validate the functional correctness of the following RT-Thread core atomic operations:
+ * rt_atomic_add, rt_atomic_sub, rt_atomic_or, rt_atomic_xor, rt_atomic_and, rt_atomic_exchange,
+ * rt_atomic_flag_test_and_set, rt_atomic_flag_clear, rt_atomic_load, rt_atomic_store,
+ * rt_atomic_compare_exchange_strong
+ * - Verify the thread-safety of rt_atomic_add under multi-threaded contention
+ *
+ * Test Scenarios:
+ * - test_atomic_api: A single-thread functional test checking all core atomic operations
+ * - test_atomic_add: Three concurrent threads, each incrementing a shared counter using rt_atomic_add
+ *
+ * Verification Metrics:
+ * - All assertions in test_atomic_api must pass
+ * - The final shared counter value in test_atomic_add must be correct
+ *
+ * Dependencies:
+ * - Enable Atomic Test (RT-Thread Utestcases -> Kernel Core -> Atomic Test)
+ * - Test on any RT-Thread supported platform
+ *
+ * Expected Results:
+ * - After executing this test in msh, the expected output should be:
+ * "[ PASSED ] [ result ] testcase (core.atomic)"
*/
#include <rtthread.h>
diff --git a/src/utest/mtsafe_kprint_tc.c b/src/utest/mtsafe_kprint_tc.c
index 5cc22723af..e64fcdfd42 100644
--- a/src/utest/mtsafe_kprint_tc.c
+++ b/src/utest/mtsafe_kprint_tc.c
@@ -1,12 +1,43 @@
/*
- * Copyright (c) 2006-2023, RT-Thread Development Team
+ * Copyright (c) 2006-2025, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
* Change Logs:
* Date Author Notes
* 2023-12-25 Shell the first version
+ * 2025-11-16 h0bbl3s Add standardized utest documentation block
*/
+
+/**
+ * Test Case Name: Kernel Core MT-Safe Kprint Test
+ *
+ * Test Objectives:
+ * - Validate the thread-safety of the rt_kprintf function
+ *
+ * Test Scenarios:
+ * - mtsafe_kprint_tc: Creates 16 concurrent threads, each calling rt_kprintf in a loop to stress test for
+ * race conditions and corruptions
+ *
+ * Verification Metrics:
+ * - All 16 threads run to completion (verified by semaphore)
+ * - The system does not crash or deadlock
+ * - Console output is not garbled or corrupted
+ *
+ * Dependencies:
+ * - Enable MT-Safe kprint Test (RT-Thread Utestcases -> Kernel Core -> MT-Safe Kprint Test)
+ * - RT_USING_THREADSAFE_PRINTF must be enabled (RT-Thread Kernel -> Enable thread safe kernel print service)
+ * - Note: This test (and MT-safe kprint) increases scheduler load. The idle thread stack
+ * size (RT-Thread Kernel -> The stack size of idle thread) may need to be increased for this test
+ * - Test on any RT-Thread supported platform
+ *
+ * Expected Results:
+ * - After executing this test in msh each thread prints its id on a single line each loop until it is finished
+ * - There should be no mixed or overlapping console outputs
+ * - When complete you should see the output:
+ * "[ PASSED ] [ result ] testcase (core.mtsafe_kprint)"
+ */
+
#include <rtthread.h>
#include "utest.h"