Skip to content

Commit 358e501

Browse files
committed
tests/stress/bytecode_limit.py: Make test more robust with low memory.
A target may have enough RAM to run the n=433 test but then run out of RAM on the n=432 test. So allow the test to skip on the n=432 case before it prints any output. Signed-off-by: Damien George <[email protected]>
1 parent 633586a commit 358e501

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

tests/stress/bytecode_limit.py

+5-1
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,18 @@
33
body = " with f()()() as a:\n try:\n f()()()\n except Exception:\n pass\n"
44

55
# Test overflow of jump offset.
6+
# Print results at the end in case an intermediate value of n fails with MemoryError.
7+
results = []
68
for n in (433, 432, 431, 430):
79
try:
810
exec("cond = 0\nif cond:\n" + body * n + "else:\n print('cond false')\n")
11+
results.append((n, "ok"))
912
except MemoryError:
1013
print("SKIP")
1114
raise SystemExit
1215
except RuntimeError:
13-
print("RuntimeError")
16+
results.append((n, "RuntimeError"))
17+
print(results)
1418

1519
# Test changing size of code info (source line/bytecode mapping) due to changing
1620
# bytecode size in the final passes. This test is very specific to how the

tests/stress/bytecode_limit.py.exp

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
RuntimeError
2-
RuntimeError
31
cond false
42
cond false
3+
[(433, 'RuntimeError'), (432, 'RuntimeError'), (431, 'ok'), (430, 'ok')]
54
[123]

0 commit comments

Comments
 (0)