Skip to content

Commit 910a569

Browse files
nashifAnas Nashif
authored andcommitted
tests: stackprot: move to ztest
Move test to use ztest instead of freestyle. Signed-off-by: Anas Nashif <[email protected]>
1 parent 0f5a88b commit 910a569

File tree

2 files changed

+11
-15
lines changed

2 files changed

+11
-15
lines changed

tests/kernel/mem_protect/stackprot/prj.conf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
CONFIG_TEST=y
1+
CONFIG_ZTEST=y
22
CONFIG_STACK_CANARIES=y
33
CONFIG_ENTROPY_GENERATOR=y
44
CONFIG_TEST_RANDOM_GENERATOR=y

tests/kernel/mem_protect/stackprot/src/main.c

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,8 @@
1717
* will not set ret to TC_FAIL.
1818
*/
1919

20-
#include <tc_util.h>
21-
2220
#include <zephyr.h>
21+
#include <ztest.h>
2322

2423

2524
#define STACKSIZE 2048
@@ -113,23 +112,20 @@ static struct k_thread alt_thread_data;
113112
* @return N/A
114113
*/
115114

116-
void main(void)
115+
void test_stackprot(void)
117116
{
118-
TC_START("Test Stack Protection Canary\n");
119-
TC_PRINT("Starts %s\n", __func__);
117+
zassert_true(ret == TC_PASS, NULL);
118+
print_loop(__func__);
119+
}
120120

121+
void test_main(void)
122+
{
121123
/* Start thread */
122124
k_thread_create(&alt_thread_data, alt_thread_stack_area, STACKSIZE,
123125
(k_thread_entry_t)alternate_thread, NULL, NULL, NULL,
124126
K_PRIO_PREEMPT(PRIORITY), 0, K_NO_WAIT);
125127

126-
if (ret == TC_FAIL) {
127-
goto errorExit;
128-
}
129-
130-
print_loop(__func__);
131-
132-
errorExit:
133-
TC_END_RESULT(ret);
134-
TC_END_REPORT(ret);
128+
ztest_test_suite(stackprot,
129+
ztest_unit_test(test_stackprot));
130+
ztest_run_test_suite(stackprot);
135131
}

0 commit comments

Comments
 (0)