Skip to content

Commit ad17e41

Browse files
masz-nordicnashif
authored andcommitted
ztest: make priority of testing thread configurable
CONFIG_ZTEST_THREAD_PRIORITY can be now used to modify the ztest thread priority. Signed-off-by: Marcin Szymczyk <[email protected]>
1 parent 3ffdcf4 commit ad17e41

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

subsys/testsuite/ztest/Kconfig

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,3 +47,10 @@ config ZTEST_PARAMETER_COUNT
4747
default 1
4848
help
4949
Maximum amount of concurrent return values / expected parameters.
50+
51+
config ZTEST_THREAD_PRIORITY
52+
int "Testing thread priority"
53+
depends on ZTEST
54+
default -1
55+
help
56+
Set priority of the testing thread. Default is -1 (cooperative).

subsys/testsuite/ztest/src/ztest.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -209,8 +209,8 @@ static int run_test(struct unit_test *test)
209209
k_thread_create(&ztest_thread, ztest_thread_stack,
210210
K_THREAD_STACK_SIZEOF(ztest_thread_stack),
211211
(k_thread_entry_t) test_cb, (struct unit_test *)test,
212-
NULL, NULL, -1, test->thread_options | K_INHERIT_PERMS,
213-
0);
212+
NULL, NULL, CONFIG_ZTEST_THREAD_PRIORITY,
213+
test->thread_options | K_INHERIT_PERMS, 0);
214214
/*
215215
* There is an implicit expectation here that the thread that was
216216
* spawned is still higher priority than the current thread.

0 commit comments

Comments
 (0)