From 8b9ddf403119100d6bbd4c6d77bd4a334032b893 Mon Sep 17 00:00:00 2001 From: Damien George Date: Tue, 31 May 2016 17:36:06 +0100 Subject: [PATCH] tests/thread: Allow some tests to run on ports with not much heap. --- tests/thread/mutate_bytearray.py | 3 ++- tests/thread/mutate_instance.py | 2 +- tests/thread/thread_qstr1.py | 3 ++- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/tests/thread/mutate_bytearray.py b/tests/thread/mutate_bytearray.py index 25f7c70714..f3276f1b2d 100644 --- a/tests/thread/mutate_bytearray.py +++ b/tests/thread/mutate_bytearray.py @@ -26,10 +26,11 @@ def th(n, lo, hi): lock = _thread.allocate_lock() n_thread = 4 n_finished = 0 +n_repeat = 4 # use 40 for more stressful test (uses more heap) # spawn threads for i in range(n_thread): - _thread.start_new_thread(th, (40, i * 256 // n_thread, (i + 1) * 256 // n_thread)) + _thread.start_new_thread(th, (n_repeat, i * 256 // n_thread, (i + 1) * 256 // n_thread)) # busy wait for threads to finish while n_finished < n_thread: diff --git a/tests/thread/mutate_instance.py b/tests/thread/mutate_instance.py index 449c9f0e0c..a1ae428b54 100644 --- a/tests/thread/mutate_instance.py +++ b/tests/thread/mutate_instance.py @@ -25,7 +25,7 @@ def th(n, lo, hi): lock = _thread.allocate_lock() n_repeat = 30 -n_range = 300 +n_range = 50 # 300 for stressful test (uses more heap) n_thread = 4 n_finished = 0 diff --git a/tests/thread/thread_qstr1.py b/tests/thread/thread_qstr1.py index 0c9c2bcf0f..c0256316e5 100644 --- a/tests/thread/thread_qstr1.py +++ b/tests/thread/thread_qstr1.py @@ -22,10 +22,11 @@ def th(base, n): lock = _thread.allocate_lock() n_thread = 4 n_finished = 0 +n_qstr_per_thread = 100 # make 1000 for a more stressful test (uses more heap) # spawn threads for i in range(n_thread): - _thread.start_new_thread(th, (i * 1000, 1000)) + _thread.start_new_thread(th, (i * n_qstr_per_thread, n_qstr_per_thread)) # busy wait for threads to finish while n_finished < n_thread: