zephyr/tests/kernel
Evgeniy Paltsev 122c7be703 tests: smp: fix fatal on smp test case
After the dbe3874079 - (tests: kernel/smp: wait for threads to exits
between tests) I've started seeing sporadic kernel.multiprocessing.smp
test failures on our platforms.

------------------------------->8---------------------------------
[*snip*]
===================================================================
START - test_fatal_on_smp
E:  r0: 0x3  r1: 0x0  r2: 0x0  r3: 0x0
E:  r4: 0x80000194  r5: 0x0  r6: 0x0  r7: 0x0
E:  r8: 0x800079c4  r9: 0x82802 r10: 0x80008d8c r11: 0x8000dad8
E:  r0: 0x3  r1: 0x2712  r2: 0x114  r3: 0x0
E:  r4: 0xf4240000  r5: 0x0  r6: 0xf424  r7: 0xbe40
E:  r8: 0x2540  r9: 0x0 r10: 0x80008d8c r11: 0x8000db8c
E: r12: 0x8000ddf0 r13: 0x0  pc: 0x80000aec
E:  blink: 0x80000ae6 status32: 0x80082002
E: >>> ZEPHYR FATAL ERROR 3: Kernel oops on CPU 0
E: Current thread: 0x8000db8c (test_fatal_on_smp)
E: r12: 0x8000ddf0 r13: 0x0  pc: 0x8000019a
 PASS - test_fatal_on_smp in 0.014 seconds
===================================================================
START - test_get_cpu
E:  blink: 0x80001490 status32: 0x80082002
E: >>> ZEPHYR FATAL ERROR 3: Kernel oops on CPU 1
E: Current thread: 0x8000dad8 (unknown)
------------------------------->8---------------------------------

The rootcause if that we doesn't proper cleanup resources after
test_fatal_on_smp test case. So child thread we start test_fatal_on_smp
may continue running for some time after the test_fatal_on_smp
test case is finished.

As in the next test case (test_get_cpu) we use same thead structures
again to create new child thread we may actually rewrite some data of
thread which is still running (or vise versa).

As we trigger the crash in test_fatal_on_smp we can't simply join
child thread in the end of test case (as we never get here). We can't
simply use join child thread before we initiate crash in test_fatal_on_smp
either as we don't want to introduce reschedule point here which may break
the test logic.

So, to fix that, we'll just do k_busy_wait in test_fatal_on_smp
thread after we start child thread to wait for thread trigger
exception and being terminated.

To verify that we also assert that child thread is dead by the
time when we stop busy waiting.

Signed-off-by: Evgeniy Paltsev <PaltsevEvgeniy@gmail.com>
Signed-off-by: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
2023-01-17 21:51:26 +00:00
..
cache tests: cache: Add cache test 2022-12-01 13:40:56 -05:00
common ARC: MWDT add TLS support 2022-11-29 09:48:23 +01:00
condvar/condvar_api yamllint: fix all yamllint truthy errors 2023-01-04 01:16:45 +09:00
context tests: move to using CONFIG_MP_MAX_NUM_CPUS 2022-10-20 22:04:10 +09:00
device ztest: improve some tests 2022-09-09 07:05:38 -04:00
early_sleep tests: kernel: cleanup test meta-data 2022-11-04 22:13:54 -04:00
events yamllint: fix all yamllint truthy errors 2023-01-04 01:16:45 +09:00
fatal tests: kernel: fatal: Catch EPSR reason code 2023-01-13 12:18:05 +09:00
fifo tests: kernel: fifo_timeout: Do not print status messages during tests 2022-12-05 13:38:16 +01:00
fpu_sharing tests: use namespacing in extra_configs and drop duplicated scenarios 2023-01-13 09:42:59 +01:00
gen_isr_table tests: kernel: cleanup test meta-data 2022-11-04 22:13:54 -04:00
interrupt tests: kernel: cleanup test meta-data 2022-11-04 22:13:54 -04:00
lifo tests: kernel: cleanup test meta-data 2022-11-04 22:13:54 -04:00
mbox tests: kernel: cleanup test meta-data 2022-11-04 22:13:54 -04:00
mem_heap tests/samples: use integration_plaforms in more tests/samples 2022-11-29 16:03:23 +01:00
mem_protect tests: update expected exception codes 2023-01-12 10:01:05 +01:00
mem_slab tests/samples: use integration_plaforms in more tests/samples 2022-11-29 16:03:23 +01:00
mp tests: kernel: cleanup test meta-data 2022-11-04 22:13:54 -04:00
msgq tests: kernel: cleanup test meta-data 2022-11-04 22:13:54 -04:00
mutex tests: use ignore_fault field instead of tags 2022-11-25 06:38:05 -05:00
obj_tracking tests: Add CONFIG_PIPES to tests that use pipes 2022-08-17 19:31:25 +02:00
pending tests: move to using CONFIG_MP_MAX_NUM_CPUS 2022-10-20 22:04:10 +09:00
pipe yamllint: indentation: fix files in tests/ 2023-01-04 14:23:53 +01:00
poll tests: use ignore_fault field instead of tags 2022-11-25 06:38:05 -05:00
profiling/profiling_api test: fix more legacy #include paths 2022-08-02 16:41:41 +01:00
queue tests: use ignore_fault field instead of tags 2022-11-25 06:38:05 -05:00
sched tests: use ignore_fault field instead of tags 2022-11-25 06:38:05 -05:00
semaphore tests: use ignore_fault field instead of tags 2022-11-25 06:38:05 -05:00
sleep tests: move to using CONFIG_MP_MAX_NUM_CPUS 2022-10-20 22:04:10 +09:00
smp tests: smp: fix fatal on smp test case 2023-01-17 21:51:26 +00:00
smp_boot_delay tests/samples: use integration_plaforms in more tests/samples 2022-11-29 16:03:23 +01:00
spinlock tests: spin lock timeout test spin time 2022-12-14 13:44:36 -06:00
stack/stack tests: use ignore_fault field instead of tags 2022-11-25 06:38:05 -05:00
threads yamllint: fix all yamllint line-length errors 2023-01-04 01:16:45 +09:00
tickless/tickless_concept tests: move to using CONFIG_MP_MAX_NUM_CPUS 2022-10-20 22:04:10 +09:00
timer yamllint: indentation: fix files in tests/ 2023-01-04 14:23:53 +01:00
usage/thread_runtime_stats yamllint: fix all yamllint comments-indentation errors 2023-01-04 01:16:45 +09:00
workq yamllint: indentation: fix files in tests/ 2023-01-04 14:23:53 +01:00
xip tests: kernel: cleanup test meta-data 2022-11-04 22:13:54 -04:00