summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/micropython/heap_lock.py9
-rw-r--r--tests/micropython/heap_lock.py.exp2
-rw-r--r--tests/micropython/heap_locked.py12
-rw-r--r--tests/micropython/heap_locked.py.exp2
4 files changed, 25 insertions, 0 deletions
diff --git a/tests/micropython/heap_lock.py b/tests/micropython/heap_lock.py
index ca3f5806a..6d770d9ec 100644
--- a/tests/micropython/heap_lock.py
+++ b/tests/micropython/heap_lock.py
@@ -6,6 +6,7 @@ l = []
l2 = list(range(100))
micropython.heap_lock()
+micropython.heap_lock()
# general allocation on the heap
try:
@@ -19,6 +20,14 @@ try:
except MemoryError:
print('MemoryError')
+print(micropython.heap_unlock())
+
+# Should still fail
+try:
+ print([])
+except MemoryError:
+ print('MemoryError')
+
micropython.heap_unlock()
# check that allocation works after an unlock
diff --git a/tests/micropython/heap_lock.py.exp b/tests/micropython/heap_lock.py.exp
index 819c32663..ae79c88b8 100644
--- a/tests/micropython/heap_lock.py.exp
+++ b/tests/micropython/heap_lock.py.exp
@@ -1,3 +1,5 @@
MemoryError
MemoryError
+1
+MemoryError
[]
diff --git a/tests/micropython/heap_locked.py b/tests/micropython/heap_locked.py
new file mode 100644
index 000000000..d9e5b5d40
--- /dev/null
+++ b/tests/micropython/heap_locked.py
@@ -0,0 +1,12 @@
+# test micropython.heap_locked()
+
+import micropython
+
+if not hasattr(micropython, "heap_locked"):
+ print("SKIP")
+ raise SystemExit
+
+micropython.heap_lock()
+print(micropython.heap_locked())
+micropython.heap_unlock()
+print(micropython.heap_locked())
diff --git a/tests/micropython/heap_locked.py.exp b/tests/micropython/heap_locked.py.exp
new file mode 100644
index 000000000..b261da18d
--- /dev/null
+++ b/tests/micropython/heap_locked.py.exp
@@ -0,0 +1,2 @@
+1
+0