summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDamien George <damien@micropython.org>2022-06-08 14:51:19 +1000
committerDamien George <damien@micropython.org>2022-06-08 15:00:59 +1000
commit182256dc13479223160c2b463abf9d6539504503 (patch)
tree7182f79ef544be8980a3f8c18fcf7637270e0044
parentc7271a86caf0418c180164f8d87cf57cf8ac416b (diff)
tests/stress: Adjust bytecode_limit test so it can SKIP if no memory.
Signed-off-by: Damien George <damien@micropython.org>
-rw-r--r--tests/stress/bytecode_limit.py17
-rw-r--r--tests/stress/bytecode_limit.py.exp2
2 files changed, 11 insertions, 8 deletions
diff --git a/tests/stress/bytecode_limit.py b/tests/stress/bytecode_limit.py
index 49f7cd2ca..8cca413cf 100644
--- a/tests/stress/bytecode_limit.py
+++ b/tests/stress/bytecode_limit.py
@@ -2,6 +2,16 @@
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
# 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
@@ -24,10 +34,3 @@ x = [1 if x else 123]
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")
diff --git a/tests/stress/bytecode_limit.py.exp b/tests/stress/bytecode_limit.py.exp
index b2d9737d8..74ab06c09 100644
--- a/tests/stress/bytecode_limit.py.exp
+++ b/tests/stress/bytecode_limit.py.exp
@@ -1,5 +1,5 @@
-[123]
cond false
cond false
RuntimeError
RuntimeError
+[123]