summaryrefslogtreecommitdiffstats
path: root/testsuites/libtests
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2022-10-06 08:26:47 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2022-10-14 10:48:23 +0200
commit6a8208533d80339d20fb36258abac84357811152 (patch)
tree42955d0a5ae96bfe5d9574f1545d0c3975e6cf2d /testsuites/libtests
parentstackchk: Add rtems_stack_checker_iterate() (diff)
downloadrtems-6a8208533d80339d20fb36258abac84357811152.tar.bz2
stackchk01: Check CPU_STACK_MINIMUM_SIZE
Ensure that the CPU_STACK_MINIMUM_SIZE is suffiently larger than the stack usage in simple applications.
Diffstat (limited to 'testsuites/libtests')
-rw-r--r--testsuites/libtests/stackchk01/init.c30
-rw-r--r--testsuites/libtests/stackchk01/stackchk01.doc12
2 files changed, 33 insertions, 9 deletions
diff --git a/testsuites/libtests/stackchk01/init.c b/testsuites/libtests/stackchk01/init.c
index 9e58409b17..b87b6baa2d 100644
--- a/testsuites/libtests/stackchk01/init.c
+++ b/testsuites/libtests/stackchk01/init.c
@@ -35,14 +35,18 @@
const char rtems_test_name[] = "STACKCHK 1";
-/* forward declarations to avoid warnings */
-rtems_task Init(rtems_task_argument argument);
+static void stack_visitor( const rtems_stack_checker_info *info, void *arg )
+{
+ if ( rtems_object_id_get_api( info->id ) == 1 ) {
+ *(uintptr_t *) arg = info->used;
+ }
+}
-rtems_task Init(
- rtems_task_argument argument
-)
+static rtems_task Init( rtems_task_argument argument )
{
- bool blown;
+ bool blown;
+ uintptr_t used;
+ uintptr_t limit;
TEST_BEGIN();
@@ -50,14 +54,26 @@ rtems_task Init(
blown = rtems_stack_checker_is_blown();
rtems_test_assert(!blown);
+ rtems_task_wake_after( 2 );
+ used = 0;
+ rtems_stack_checker_iterate( stack_visitor, &used );
+ limit = CPU_STACK_MINIMUM_SIZE / 4;
+ printf(
+ "check used IDLE stack size: 0 < %" PRIuPTR " <= %" PRIuPTR "\n",
+ used,
+ limit
+ );
+ rtems_test_assert( used > 0 );
+ rtems_test_assert( used <= limit );
+
TEST_END();
rtems_test_exit(0);
}
/* configuration information */
+#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
#define CONFIGURE_APPLICATION_NEEDS_SIMPLE_CONSOLE_DRIVER
-#define CONFIGURE_APPLICATION_DOES_NOT_NEED_CLOCK_DRIVER
#define CONFIGURE_MAXIMUM_TASKS 1
#define CONFIGURE_INITIAL_EXTENSIONS RTEMS_TEST_INITIAL_EXTENSION
diff --git a/testsuites/libtests/stackchk01/stackchk01.doc b/testsuites/libtests/stackchk01/stackchk01.doc
index 5b3d9c894b..cbb9fb62f9 100644
--- a/testsuites/libtests/stackchk01/stackchk01.doc
+++ b/testsuites/libtests/stackchk01/stackchk01.doc
@@ -30,9 +30,17 @@ This file describes the directives and concepts tested by this test set.
test set name: stackchk01
directives:
- rtems_stack_checker_is_blown
+
+* CPU_STACK_MINIMUM_SIZE
+
+* rtems_stack_checker_is_blown
+
+* rtems_stack_checker_iterate
concepts:
-+ ensure that dynamic checks for a blown stack work both when the stack
+* Ensure that dynamic checks for a blown stack work both when the stack
is not blown and when it is.
+
+* Ensure that the CPU_STACK_MINIMUM_SIZE is suffiently larger than the stack
+ usage in simple applications.