mirror of
https://github.com/micropython/micropython.git
synced 2025-07-21 21:11:12 +02:00
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>
This commit is contained in:
@@ -3,14 +3,18 @@
|
|||||||
body = " with f()()() as a:\n try:\n f()()()\n except Exception:\n pass\n"
|
body = " with f()()() as a:\n try:\n f()()()\n except Exception:\n pass\n"
|
||||||
|
|
||||||
# Test overflow of jump offset.
|
# Test overflow of jump offset.
|
||||||
|
# Print results at the end in case an intermediate value of n fails with MemoryError.
|
||||||
|
results = []
|
||||||
for n in (433, 432, 431, 430):
|
for n in (433, 432, 431, 430):
|
||||||
try:
|
try:
|
||||||
exec("cond = 0\nif cond:\n" + body * n + "else:\n print('cond false')\n")
|
exec("cond = 0\nif cond:\n" + body * n + "else:\n print('cond false')\n")
|
||||||
|
results.append((n, "ok"))
|
||||||
except MemoryError:
|
except MemoryError:
|
||||||
print("SKIP")
|
print("SKIP")
|
||||||
raise SystemExit
|
raise SystemExit
|
||||||
except RuntimeError:
|
except RuntimeError:
|
||||||
print("RuntimeError")
|
results.append((n, "RuntimeError"))
|
||||||
|
print(results)
|
||||||
|
|
||||||
# Test changing size of code info (source line/bytecode mapping) due to changing
|
# Test changing size of code info (source line/bytecode mapping) due to changing
|
||||||
# bytecode size in the final passes. This test is very specific to how the
|
# bytecode size in the final passes. This test is very specific to how the
|
||||||
|
@@ -1,5 +1,4 @@
|
|||||||
RuntimeError
|
|
||||||
RuntimeError
|
|
||||||
cond false
|
cond false
|
||||||
cond false
|
cond false
|
||||||
|
[(433, 'RuntimeError'), (432, 'RuntimeError'), (431, 'ok'), (430, 'ok')]
|
||||||
[123]
|
[123]
|
||||||
|
Reference in New Issue
Block a user