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>
diff --git a/kernel/Kconfig b/kernel/Kconfig
index 5dbb91c..8c31c14 100644
--- a/kernel/Kconfig
+++ b/kernel/Kconfig
@@ -339,6 +339,7 @@
 config THREAD_MAX_NAME_LEN
 	int "Max length of a thread name"
 	default 32
+	default 64 if ZTEST
 	range 8 128
 	depends on THREAD_NAME
 	help
diff --git a/subsys/testsuite/ztest/src/ztest.c b/subsys/testsuite/ztest/src/ztest.c
index d25eaf5..6fc1a96 100644
--- a/subsys/testsuite/ztest/src/ztest.c
+++ b/subsys/testsuite/ztest/src/ztest.c
@@ -354,9 +354,12 @@
 				(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;