zephyriot / zep-jira14

0 stars 0 forks source link

schedule_api test uses zassert without cleaning up properly #2066

Open nashif opened 7 years ago

nashif commented 7 years ago

Reported by Andrew Boie:

see tests/kernel/threads_scheduling/schedule_api/src/test_sched_timeslice_and_lock.c

The problem is the zassert() calls in the test functions. If any fail, the functions are immediately aborted without calling teardown_threads().

Then, in the next test case, it will try to spawn the same threads again, which leads to undefined behavior, on ARM we are seeing hardfaults. See GH-2057

Either fix the test case so that all cleanup is done before zasserts are called, or introduce variant zassert APIs which additionally take a cleanup function pointer.

(Imported from Jira ZEP-2230)

nashif commented 7 years ago

by Sharron LIU:

The test case itself supposed to keep the original logic to ensure assertion is made before test exiting, which is expected in the normal test flow. Introducing variant zassert APIs to support a cleanup function pointer would be the way to go. Will need visit from ztest framework. I removed myself from the assignee. Thanks.

nashif commented 7 years ago

by Mark Linkmeyer:

Since this was previously assigned to Sharron, I'm reassigning it to Chandrakala Kempanna .