Skip to content
Permalink
Browse files

tests: stackprot: don't set main stack size

This test uses ztest anyway, the default should be fine
just like any other test running under ztest.

k_thread_create() uses a lot of stack, and the main
stack size is very small if ztest is enabled. Do it in
another ztest task instead.

We don't need to mess with the main thread's priority,
just have the alt thread run cooperatively.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
  • Loading branch information...
andrewboie committed May 1, 2019
1 parent 0f6c9a5 commit 94851726775a534a0aa9283ccbbf8d24973e8f1c
Showing with 6 additions and 5 deletions.
  1. +0 −2 tests/kernel/mem_protect/stackprot/prj.conf
  2. +6 −3 tests/kernel/mem_protect/stackprot/src/main.c
@@ -2,6 +2,4 @@ CONFIG_ZTEST=y
CONFIG_STACK_CANARIES=y
CONFIG_ENTROPY_GENERATOR=y
CONFIG_TEST_RANDOM_GENERATOR=y
CONFIG_MAIN_THREAD_PRIORITY=7
CONFIG_MAIN_STACK_SIZE=640
CONFIG_TEST_USERSPACE=y
@@ -11,7 +11,6 @@


#define STACKSIZE (2048 + CONFIG_TEST_EXTRA_STACKSIZE)
#define PRIORITY 5

ZTEST_BMEM static int count;
ZTEST_BMEM static int ret = TC_PASS;
@@ -113,14 +112,18 @@ void test_stackprot(void)
print_loop(__func__);
}

void test_main(void)
void test_create_alt_thread(void)
{
/* Start thread */
k_thread_create(&alt_thread_data, alt_thread_stack_area, STACKSIZE,
(k_thread_entry_t)alternate_thread, NULL, NULL, NULL,
K_PRIO_PREEMPT(PRIORITY), K_USER, K_NO_WAIT);
K_PRIO_COOP(1), K_USER, K_NO_WAIT);
}

void test_main(void)
{
ztest_test_suite(stackprot,
ztest_unit_test(test_create_alt_thread),
ztest_user_unit_test(test_stackprot));
ztest_run_test_suite(stackprot);
}

0 comments on commit 9485172

Please sign in to comment.
You can’t perform that action at this time.