summaryrefslogtreecommitdiffstatshomepage
path: root/tests/thread/thread_exit2.py
diff options
context:
space:
mode:
authorDamien George <damien@micropython.org>2021-05-10 12:44:47 +1000
committerDamien George <damien@micropython.org>2021-05-10 13:07:16 +1000
commit4cdcbdb7531b98b2dc9a85737b760f509957e31e (patch)
treeb30210b71391afc26935198b2f7561ac3e3139c3 /tests/thread/thread_exit2.py
parentb6b39bff47b5ff1ffc322a6e795d57451d4215a8 (diff)
downloadmicropython-4cdcbdb7531b98b2dc9a85737b760f509957e31e.tar.gz
micropython-4cdcbdb7531b98b2dc9a85737b760f509957e31e.zip
tests/thread: Make exc1,exit1,exit2,stacksize1,start1 tests run on rp2.
The RP2040 has 2 cores and supports running at most 2 Python threads (the main one plus another), and will raise OSError if a thread cannot be created because core1 is already in use. This commit adjusts some thread tests to be robust against such OSError's. These tests now pass on rp2 boards. Signed-off-by: Damien George <damien@micropython.org>
Diffstat (limited to 'tests/thread/thread_exit2.py')
-rw-r--r--tests/thread/thread_exit2.py9
1 files changed, 7 insertions, 2 deletions
diff --git a/tests/thread/thread_exit2.py b/tests/thread/thread_exit2.py
index 0cd80e6909..5be7945db2 100644
--- a/tests/thread/thread_exit2.py
+++ b/tests/thread/thread_exit2.py
@@ -13,8 +13,13 @@ def thread_entry():
raise SystemExit
-_thread.start_new_thread(thread_entry, ())
-_thread.start_new_thread(thread_entry, ())
+for i in range(2):
+ while True:
+ try:
+ _thread.start_new_thread(thread_entry, ())
+ break
+ except OSError:
+ pass
# wait for threads to finish
time.sleep(1)