Page MenuHomePhabricator

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


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 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 --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
After applying that and building using:


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.Jun 8 2021, 3:07 AM
davidwang edited subscribers, added: davidwang; removed: karl-zh, Karl.

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.