mirror of
https://github.com/licsber/micropython.git
synced 2024-09-20 00:50:24 +08:00
tests/stress: Adjust bytecode_limit test so it can SKIP if no memory.
Signed-off-by: Damien George <damien@micropython.org>
This commit is contained in:
parent
c7271a86ca
commit
182256dc13
@ -2,6 +2,16 @@
|
|||||||
|
|
||||||
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.
|
||||||
|
for n in (430, 431, 432, 433):
|
||||||
|
try:
|
||||||
|
exec("cond = 0\nif cond:\n" + body * n + "else:\n print('cond false')\n")
|
||||||
|
except MemoryError:
|
||||||
|
print("SKIP")
|
||||||
|
raise SystemExit
|
||||||
|
except RuntimeError:
|
||||||
|
print("RuntimeError")
|
||||||
|
|
||||||
# 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
|
||||||
# code info is encoded, and how jump offsets shrink in the final passes. This
|
# code info is encoded, and how jump offsets shrink in the final passes. This
|
||||||
@ -24,10 +34,3 @@ x = [1 if x else 123]
|
|||||||
print(x)
|
print(x)
|
||||||
"""
|
"""
|
||||||
)
|
)
|
||||||
|
|
||||||
# Test overflow of jump offset.
|
|
||||||
for n in (430, 431, 432, 433):
|
|
||||||
try:
|
|
||||||
exec("cond = 0\nif cond:\n" + body * n + "else:\n print('cond false')\n")
|
|
||||||
except RuntimeError:
|
|
||||||
print("RuntimeError")
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
|
cond false
|
||||||
|
cond false
|
||||||
|
RuntimeError
|
||||||
|
RuntimeError
|
||||||
[123]
|
[123]
|
||||||
cond false
|
|
||||||
cond false
|
|
||||||
RuntimeError
|
|
||||||
RuntimeError
|
|
||||||
|
Loading…
Reference in New Issue
Block a user