Skip to content

Commit 157056e

Browse files
committed
tests: Add new subdir "stress/" specifically for stress tests.
1 parent ab69ed7 commit 157056e

4 files changed

Lines changed: 23 additions & 2 deletions

File tree

tests/run-tests

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -365,15 +365,15 @@ def main():
365365
if args.test_dirs is None:
366366
if args.target == 'pyboard':
367367
# run pyboard tests
368-
test_dirs = ('basics', 'micropython', 'float', 'misc', 'extmod', 'pyb', 'pybnative', 'inlineasm')
368+
test_dirs = ('basics', 'micropython', 'float', 'misc', 'stress', 'extmod', 'pyb', 'pybnative', 'inlineasm')
369369
elif args.target == 'esp8266':
370370
test_dirs = ('basics', 'micropython', 'float', 'misc', 'extmod')
371371
elif args.target == 'wipy':
372372
# run WiPy tests
373373
test_dirs = ('basics', 'micropython', 'misc', 'extmod', 'wipy')
374374
else:
375375
# run PC tests
376-
test_dirs = ('basics', 'micropython', 'float', 'import', 'io', 'misc', 'unicode', 'extmod', 'unix', 'cmdline')
376+
test_dirs = ('basics', 'micropython', 'float', 'import', 'io', 'misc', 'stress', 'unicode', 'extmod', 'unix', 'cmdline')
377377
else:
378378
# run tests from these directories
379379
test_dirs = args.test_dirs

tests/stress/dict_copy.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# copying a large dictionary
2+
3+
a = {i:2*i for i in range(1000)}
4+
b = a.copy()
5+
for i in range(1000):
6+
print(i, b[i])
7+
print(len(b))

tests/stress/dict_create.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# create a large dictionary
2+
3+
d = {}
4+
x = 1
5+
while x < 1000:
6+
d[x] = x
7+
x += 1
8+
print(d[500])

tests/stress/list_sort.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# test large list sorting (should not stack overflow)
2+
l = list(range(2000))
3+
l.sort()
4+
print(l[0], l[-1])
5+
l.sort(reverse=True)
6+
print(l[0], l[-1])

0 commit comments

Comments
 (0)