From c607b58efe9333ab92e1b721dcd974e35a9d393e Mon Sep 17 00:00:00 2001 From: Damien George Date: Fri, 2 Mar 2018 10:59:09 +1100 Subject: tests: Move heap-realloc-while-locked test from C to Python. This test for calling gc_realloc() while the GC is locked can be done in pure Python, so better to do it that way since it can then be tested on more ports. --- tests/micropython/heap_lock.py | 11 +++++++++++ tests/micropython/heap_lock.py.exp | 1 + 2 files changed, 12 insertions(+) (limited to 'tests/micropython') diff --git a/tests/micropython/heap_lock.py b/tests/micropython/heap_lock.py index 0f0a70eff..ca3f5806a 100644 --- a/tests/micropython/heap_lock.py +++ b/tests/micropython/heap_lock.py @@ -2,13 +2,24 @@ import micropython +l = [] +l2 = list(range(100)) + micropython.heap_lock() +# general allocation on the heap try: print([]) except MemoryError: print('MemoryError') +# expansion of a heap block +try: + l.extend(l2) +except MemoryError: + print('MemoryError') + micropython.heap_unlock() +# check that allocation works after an unlock print([]) diff --git a/tests/micropython/heap_lock.py.exp b/tests/micropython/heap_lock.py.exp index 67b208cfc..819c32663 100644 --- a/tests/micropython/heap_lock.py.exp +++ b/tests/micropython/heap_lock.py.exp @@ -1,2 +1,3 @@ MemoryError +MemoryError [] -- cgit v1.2.3