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 <damien@micropython.org>
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

Lines changed: 5 additions & 1 deletion
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

Lines changed: 1 addition & 2 deletions
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)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy