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>
diff --git a/tests/kernel/mem_protect/stackprot/prj.conf b/tests/kernel/mem_protect/stackprot/prj.conf
index e49577e..3b06bf4 100644
--- a/tests/kernel/mem_protect/stackprot/prj.conf
+++ b/tests/kernel/mem_protect/stackprot/prj.conf
@@ -2,6 +2,4 @@
 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
diff --git a/tests/kernel/mem_protect/stackprot/src/main.c b/tests/kernel/mem_protect/stackprot/src/main.c
index 1be975b..54385ad 100644
--- a/tests/kernel/mem_protect/stackprot/src/main.c
+++ b/tests/kernel/mem_protect/stackprot/src/main.c
@@ -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 @@
 	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);
 }