summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorXiuwen Cai <[email protected]>2023-05-12 10:13:42 +0800
committerGitHub <[email protected]>2023-05-12 10:13:42 +0800
commit6b8ece0ff28fb0160a2fdf51c09df09d587f4575 (patch)
tree7f1f6ba9a727d43831eedd020ea50d027c1053c8 /test
parent6d9f25fac9d091a097c70f9cbff0e50252fde52a (diff)
Add random number stack filling option. (#257)
Co-authored-by: TiejunZhou <[email protected]>
Diffstat (limited to 'test')
-rw-r--r--test/smp/cmake/CMakeLists.txt3
-rw-r--r--test/smp/regression/testcontrol.c12
-rw-r--r--test/tx/cmake/CMakeLists.txt3
-rw-r--r--test/tx/regression/testcontrol.c12
4 files changed, 28 insertions, 2 deletions
diff --git a/test/smp/cmake/CMakeLists.txt b/test/smp/cmake/CMakeLists.txt
index f50c7861..04d15ef5 100644
--- a/test/smp/cmake/CMakeLists.txt
+++ b/test/smp/cmake/CMakeLists.txt
@@ -6,7 +6,7 @@ project(threadx_smp_test LANGUAGES C)
# Set build configurations
set(BUILD_CONFIGURATIONS default_build_coverage
- disable_notify_callbacks_build stack_checking_build
+ disable_notify_callbacks_build stack_checking_build stack_checking_rand_fill_build
trace_build)
set(CMAKE_CONFIGURATION_TYPES
${BUILD_CONFIGURATIONS}
@@ -26,6 +26,7 @@ message(STATUS "Using toolchain file: ${CMAKE_TOOLCHAIN_FILE}.")
set(default_build_coverage "")
set(disable_notify_callbacks_build -DTX_DISABLE_NOTIFY_CALLBACKS)
set(stack_checking_build -DTX_ENABLE_STACK_CHECKING)
+set(stack_checking_rand_fill_build -DTX_ENABLE_STACK_CHECKING -DTX_ENABLE_RANDOM_NUMBER_STACK_FILLING)
set(trace_build -DTX_ENABLE_EVENT_TRACE)
add_compile_options(
diff --git a/test/smp/regression/testcontrol.c b/test/smp/regression/testcontrol.c
index 1813d42f..8e3d872e 100644
--- a/test/smp/regression/testcontrol.c
+++ b/test/smp/regression/testcontrol.c
@@ -519,6 +519,9 @@ UINT status;
ULONG flags;
ULONG temp;
UINT i, j;
+#if defined(TX_ENABLE_RANDOM_NUMBER_STACK_FILLING) && defined(TX_ENABLE_STACK_CHECKING)
+TX_THREAD *thread_ptr;
+#endif
/* Initialize the test error/success counters. */
@@ -1072,6 +1075,15 @@ UINT i, j;
/* Make a fake thread with a fake stack. */
test_thread2.tx_thread_id = TX_THREAD_ID;
+#if defined(TX_ENABLE_RANDOM_NUMBER_STACK_FILLING) && defined(TX_ENABLE_STACK_CHECKING)
+
+ /* Set the thread pointer. */
+ thread_ptr = &(test_thread2);
+
+ /* Initialize the stack fill value. */
+ thread_ptr -> tx_thread_stack_fill_value = (0xFEFEFEFEUL);
+
+#endif
for (i = 0; i < (sizeof(test_thread2_stack)/sizeof(ULONG)); i++)
{
/* Set the fake thread stack to the fill pattern. */
diff --git a/test/tx/cmake/CMakeLists.txt b/test/tx/cmake/CMakeLists.txt
index 02e2a41b..b440d2cf 100644
--- a/test/tx/cmake/CMakeLists.txt
+++ b/test/tx/cmake/CMakeLists.txt
@@ -6,7 +6,7 @@ project(threadx_test LANGUAGES C)
# Set build configurations
set(BUILD_CONFIGURATIONS default_build_coverage disable_notify_callbacks_build
- stack_checking_build trace_build)
+ stack_checking_build stack_checking_rand_fill_build trace_build)
set(CMAKE_CONFIGURATION_TYPES
${BUILD_CONFIGURATIONS}
CACHE STRING "list of supported configuration types" FORCE)
@@ -25,6 +25,7 @@ message(STATUS "Using toolchain file: ${CMAKE_TOOLCHAIN_FILE}.")
set(default_build_coverage "")
set(disable_notify_callbacks_build -DTX_DISABLE_NOTIFY_CALLBACKS)
set(stack_checking_build -DTX_ENABLE_STACK_CHECKING)
+set(stack_checking_rand_fill_build -DTX_ENABLE_STACK_CHECKING -DTX_ENABLE_RANDOM_NUMBER_STACK_FILLING)
set(trace_build -DTX_ENABLE_EVENT_TRACE)
add_compile_options(
diff --git a/test/tx/regression/testcontrol.c b/test/tx/regression/testcontrol.c
index ff257ca1..a53c50a5 100644
--- a/test/tx/regression/testcontrol.c
+++ b/test/tx/regression/testcontrol.c
@@ -477,6 +477,9 @@ UINT status;
ULONG flags;
ULONG temp;
UINT i, j;
+#if defined(TX_ENABLE_RANDOM_NUMBER_STACK_FILLING) && defined(TX_ENABLE_STACK_CHECKING)
+TX_THREAD *thread_ptr;
+#endif
/* Initialize the test error/success counters. */
@@ -946,6 +949,15 @@ UINT i, j;
/* Make a fake thread with a fake stack. */
test_thread2.tx_thread_id = TX_THREAD_ID;
+#if defined(TX_ENABLE_RANDOM_NUMBER_STACK_FILLING) && defined(TX_ENABLE_STACK_CHECKING)
+
+ /* Set the thread pointer. */
+ thread_ptr = &(test_thread2);
+
+ /* Initialize the stack fill value. */
+ thread_ptr -> tx_thread_stack_fill_value = (0xFEFEFEFEUL);
+
+#endif
for (i = 0; i < (sizeof(test_thread2_stack)/sizeof(ULONG)); i++)
{
/* Set the fake thread stack to the fill pattern. */