Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork8.2k
tests/thread: Adjust thread tests so most are able to run on rp2 port.#13351
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Merged
Uh oh!
There was an error while loading.Please reload this page.
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
This test was removed long ago ineb0e3ba.Signed-off-by: Damien George <damien@micropython.org>
The aim of this commit is to make it so that the existing thread tests canbe used to test the _thread module on the rp2 port. The rp2 port onlyallows up to one thread to be created at a time, and does not have the GILenabled.The following changes have been made:- run-tests.py skips mutation tests on rp2, because there's no GIL.- run-tests.py skips other tests on rp2 that require more than one thread.- The tests stop trying to start a new thread after there is an OSError, which indicates that the system cannot create more threads.- Some of these tests also now run the test function on the main thread, not just the spawned threads.- In some tests the output printing is adjusted so it's the same regardless of how many threads were spawned.- Some time.sleep(1) are replaced with time.sleep(0) to make the tests run a little faster (finish sooner when the work is done).For the most part the tests are unchanged for existing platforms like esp32and unix.Signed-off-by: Damien George <damien@micropython.org>
codecovbot commentedJan 4, 2024 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@## master #13351 +/- ##======================================= Coverage 98.40% 98.40% ======================================= Files 159 159 Lines 21088 21088 ======================================= Hits 20752 20752 Misses 336 336 ☔ View full report in Codecov by Sentry. |
The existing thread_sleep1.py test only tests execution, not accuracy, oftime.sleep. Also the existing test only tests sleep(0) on targets like rp2that can only create a single thread.The new test in this commit checks for timing accuracy on the main threadand one other thread when they run at the same time.Signed-off-by: Damien George <damien@micropython.org>
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The aim of this commit is to make it so that the existing thread tests can be used to test the _thread module on the rp2 port. The rp2 port only allows up to one thread to be created at a time, and does not have the GIL enabled.
The following changes have been made:
For the most part the tests are unchanged for existing platforms like esp32 and unix.