ztest: set thread name to test name

Use the actual test name and not a hardcoded thread name. This is useful
for tracing test cases.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
This commit is contained in:
Anas Nashif 2021-05-13 09:46:28 -04:00
commit 7b9084cb4f
2 changed files with 6 additions and 2 deletions

View file

@ -354,9 +354,12 @@ static int run_test(struct unit_test *test)
(k_thread_entry_t) test_cb, (struct unit_test *)test,
NULL, NULL, CONFIG_ZTEST_THREAD_PRIORITY,
test->thread_options | K_INHERIT_PERMS,
K_NO_WAIT);
K_FOREVER);
k_thread_name_set(&ztest_thread, "ztest_thread");
if (test->name != NULL) {
k_thread_name_set(&ztest_thread, test->name);
}
k_thread_start(&ztest_thread);
k_thread_join(&ztest_thread, K_FOREVER);
} else {
test_result = 1;