Page MenuHomePhabricator

Interactive tests fail to return to main thread after test has ran and sit in osRtxIdleThread() function
Open, NormalPublic

Description

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.

Event Timeline

lairdjm triaged this task as Normal priority.Mar 29 2021, 8:32 AM
lairdjm created this task.
davidwang assigned this task to karl-zh.Apr 6 2021, 3:06 AM
Karl claimed this task.Apr 7 2021, 6:41 AM
Karl added a subscriber: karl-zh.

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

Karl added a comment.Apr 7 2021, 7:02 AM

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

davidwang claimed this task.Tue, Jun 8, 3:07 AM