It seems that the interactive tests will only run the first test, when it exits the test thread, the control should be handed back to the execute_ns_interactive_tests() function in core_ns_interactive_testsuite.c as it uses osThreadJoin() which, according to https://www.keil.com/pack/doc/CMSIS/RTOS2/html/group__CMSIS__RTOS__ThreadMgmt.html#ga3fca90fb0679afeb968aa8c3d5874487 should return once the thread has terminated, but instead when the thread calls osThreadExit() the code goes to RTX's osRtxIdleThread() function where it sits in an endless loop doing nothing and so the test never progresses past the first test.
Description
Event Timeline
I took a look at this test case, the interactive test suit is disabled by default. Could you append some logs or command on your platform of TFM_CORE_TEST_2001
The test from my side on AN521 will stop after scenario 1:
Executing 'TFM_CORE_TEST_2001'
Description: 'Interactive tests'
Scenario 1 - SequentialTrying to acquire the TFM core from NS [seq_task]NS Lock: acquired [seq_task]Secure call to tfm_spm_core_test_sfn_veneer(&in_vec, 1, NULL, 0) failed, generic!NS Lock: releasing... [seq_task]Scenario 1 - test finished
The build command from my test:
#cmake -S . -B cmake_build -DTFM_PLATFORM=mps2/an521 -DTFM_TOOLCHAIN_FILE=toolchain_GNUARM.cmake -DTEST_S=ON -DTEST_NS=ON -DTFM_INTERACTIVE_TEST=ON
#cmake --build cmake_build -- install -j 8
You will need to apply this patch in order for the interactive tests to function as without it the secure part will never build with that part enabled https://review.trustedfirmware.org/c/TF-M/tf-m-tests/+/9431
After applying that and building using:
cmake -DTFM_PLATFORM=lairdconnectivity/bl5340_dvk_cpuapp -GNinja -DTFM_TOOLCHAIN_FILE=../toolchain_GNUARM.cmake -DTEST_S=off -DTEST_NS=on -DCMAKE_BUILD_TYPE=debug -DTFM_INTERACTIVE_TEST=on -DTFM_PERIPH_ACCESS_TEST=ON -DTFM_IRQ_TEST=ON ..
And running it, the first test passes but the freezes at the same point as yours does, it does not continue with the next task
Okay, I run into a fault when apply this patch on AN521, may need some investigations :
Running Test Suite Core non-secure interactive tests (TFM_CORE_TEST_2XXX)...
Executing 'TFM_CORE_TEST_2001'
Description: 'Interactive tests'
Segmentation fault
Ran into this as well when porting a new target and trying to get all constellations of test suites up and running. It seems to be an issue with how thread joins are handled during RtxThreadExit in RTX 5.5.0. Tracing the disassembly in the kernel makes me think there's some sort of optimisation bug in the precompiled libraries, since the idle thread is marked for running instead of the test thread (which was waiting on the join).
Maybe worth a conversation with the RTX people?
Hi @stevew817
If it's an RTX issue, then please contact RTX people. Thanks very much.