Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

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
dpgeorge merged 3 commits intomicropython:masterfromdpgeorge:tests-rp2-thread
Jan 5, 2024

Conversation

dpgeorge
Copy link
Member

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:

  • 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 esp32 and unix.

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>
@dpgeorgedpgeorge added the testsRelates to tests/ directory in source labelJan 4, 2024
@codecovCodecov
Copy link

codecovbot commentedJan 4, 2024
edited
Loading

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base(dc2a4e3) 98.40% compared to head(a003ac2) 98.40%.

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.
📢 Have feedback on the report?Share it here.

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
Reviewers
No reviews
Assignees
No one assigned
Labels
testsRelates to tests/ directory in source
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

1 participant
@dpgeorge

[8]ページ先頭

©2009-2025 Movatter.jp