-
Notifications
You must be signed in to change notification settings - Fork 7.3k
tests/kernel/preempt: Add yield and sleep cases #8133
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
tests/kernel/preempt: Add yield and sleep cases #8133
Conversation
Scheduler choice is subtle across yield and k_sleep(), add calls to those to the state table and validate that we're making the right decisions. Signed-off-by: Andy Ross <[email protected]>
Codecov Report
@@ Coverage Diff @@
## master #8133 +/- ##
==========================================
- Coverage 64.54% 64.54% -0.01%
==========================================
Files 420 420
Lines 40142 40142
Branches 6765 6765
==========================================
- Hits 25911 25910 -1
Misses 11110 11110
- Partials 3121 3122 +1
Continue to review full report at Codecov.
|
last_thread = NULL; | ||
k_sem_give(&worker_sems[id]); | ||
|
||
while (do_sleep | ||
&& !(worker_threads[id].base.thread_state & _THREAD_PENDING)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Won't this test immediately break when you submit the k_sleep re-write for v1.13?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Likely, yes. :) But I'm whiteboxing the thread states here anyway and this is the easiest way to make sure the thread is blocked on the semaphore again before going to the next test case.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds good. Removing my -1.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. But we should track for updates in v1.13.
[Added test cases to try to catch the k_sleep() bug that Michael Scott and I were sure he had found in #8128. Alas, this test PASSES, and I've now convinced myself that the bug wasn't real (though the symptoms are and there may be a similar issue elsewhere, just now with k_sleep()). But they're useful regression cases and untested in current code, so worth commiting regardless]
Scheduler choice is subtle across yield and k_sleep(), add calls to
those to the state table and validate that we're making the right
decisions.
Signed-off-by: Andy Ross [email protected]