Skip to content

Commit 8b9ddf4

Browse files
committed
tests/thread: Allow some tests to run on ports with not much heap.
1 parent 63d0522 commit 8b9ddf4

File tree

3 files changed

+5
-3
lines changed

3 files changed

+5
-3
lines changed

tests/thread/mutate_bytearray.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,11 @@ def th(n, lo, hi):
2626
lock = _thread.allocate_lock()
2727
n_thread = 4
2828
n_finished = 0
29+
n_repeat = 4 # use 40 for more stressful test (uses more heap)
2930

3031
# spawn threads
3132
for i in range(n_thread):
32-
_thread.start_new_thread(th, (40, i * 256 // n_thread, (i + 1) * 256 // n_thread))
33+
_thread.start_new_thread(th, (n_repeat, i * 256 // n_thread, (i + 1) * 256 // n_thread))
3334

3435
# busy wait for threads to finish
3536
while n_finished < n_thread:

tests/thread/mutate_instance.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ def th(n, lo, hi):
2525

2626
lock = _thread.allocate_lock()
2727
n_repeat = 30
28-
n_range = 300
28+
n_range = 50 # 300 for stressful test (uses more heap)
2929
n_thread = 4
3030
n_finished = 0
3131

tests/thread/thread_qstr1.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,11 @@ def th(base, n):
2222
lock = _thread.allocate_lock()
2323
n_thread = 4
2424
n_finished = 0
25+
n_qstr_per_thread = 100 # make 1000 for a more stressful test (uses more heap)
2526

2627
# spawn threads
2728
for i in range(n_thread):
28-
_thread.start_new_thread(th, (i * 1000, 1000))
29+
_thread.start_new_thread(th, (i * n_qstr_per_thread, n_qstr_per_thread))
2930

3031
# busy wait for threads to finish
3132
while n_finished < n_thread:

0 commit comments

Comments
 (0)