Skip to content

Commit 016f830

Browse files
committed
tests/heapalloc, heapalloc_super: Skip in strict stackless mode.
These tests involves testing allocation-free function calling, and in strict stackless mode, it's not possible to make a function call with heap locked (because function activation record aka frame is allocated on the heap).
1 parent e02cb9e commit 016f830

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

tests/micropython/heapalloc.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,15 @@
22

33
import micropython
44

5+
# Check for stackless build, which can't call functions without
6+
# allocating a frame on heap.
7+
try:
8+
def stackless(): pass
9+
micropython.heap_lock(); stackless(); micropython.heap_unlock()
10+
except RuntimeError:
11+
print("SKIP")
12+
raise SystemExit
13+
514
def f1(a):
615
print(a)
716

tests/micropython/heapalloc_super.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,15 @@
11
# test super() operations which don't require allocation
22
import micropython
33

4+
# Check for stackless build, which can't call functions without
5+
# allocating a frame on heap.
6+
try:
7+
def stackless(): pass
8+
micropython.heap_lock(); stackless(); micropython.heap_unlock()
9+
except RuntimeError:
10+
print("SKIP")
11+
raise SystemExit
12+
413
class A:
514
def foo(self):
615
print('A foo')

0 commit comments

Comments
 (0)