Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

subsys: testsuite: ztest framework breaks if run in cooperative mode only #34434

Closed
mnkp opened this issue Apr 20, 2021 · 0 comments · Fixed by #33107
Closed

subsys: testsuite: ztest framework breaks if run in cooperative mode only #34434

mnkp opened this issue Apr 20, 2021 · 0 comments · Fixed by #33107
Labels
bug The issue is a bug, or the PR is fixing a bug

Comments

@mnkp
Copy link
Member

mnkp commented Apr 20, 2021

Describe the bug

When running a testcase with kernel configured to run in cooperative mode only, i.e. CONFIG_NUM_PREEMPT_PRIORITIES=0, the ztest framwork generates "ASSERTION FAIL" at runtime indicating invalid thread priority value.

To Reproduce

Run any testcase in cooperative mode only. E.g.

west build -b sam_e70_xplained -- -DCONFIG_ASSERT=y -DCONFIG_NUM_PREEMPT_PRIORITIES=0 tests/kernel/fifo/fifo_api/

Logs and console output

*** Booting Zephyr OS build zephyr-v2.5.0-1487-g8929b40b78e0  ***
Running test suite fifo_api
===================================================================
START - test_fifo_thread2thread
ASSERTION FAIL [((((prio)) == -1 && z_is_idle_thread_entry((entry))) || (((-1 - 1) >= ((-16 - 1))) && ((prio)) >= ((-16 - 1)) && ((prio)) <= (-1 - 1)))] @ WEST_TOPDIR/zephyr/kernel/thread.c:540
        invalid priority (-1); allowed range: -2 to -17
E: r0/a1:  0x00000004  r1/a2:  0x0000021c  r2/a3:  0x80000000
E: r3/a4:  0x00401aa5 r12/ip:  0x00000000 r14/lr:  0x004042c1
E:  xpsr:  0x41000000
E: Faulting instruction address (r15/pc): 0x00405200
E: >>> ZEPHYR FATAL ERROR 4: Kernel panic on CPU 0
E: Current thread: 0x20400470 (main)
E: Halting system

Expected behavior

ztest framework should work also in cooperative mode only.

Additional context

By default ztest thread is running at the priority -1. When the testcase is running in cooperative mode only the default ztest thread priority should be set to -2.

@mnkp mnkp added the bug The issue is a bug, or the PR is fixing a bug label Apr 20, 2021
@mnkp mnkp added the has-pr label Apr 20, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug The issue is a bug, or the PR is fixing a bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant