summaryrefslogtreecommitdiff
path: root/tests/micropython
diff options
context:
space:
mode:
Diffstat (limited to 'tests/micropython')
-rw-r--r--tests/micropython/meminfo.py12
-rw-r--r--tests/micropython/meminfo.py.exp14
-rw-r--r--tests/micropython/memstats.py17
-rw-r--r--tests/micropython/memstats.py.exp3
4 files changed, 46 insertions, 0 deletions
diff --git a/tests/micropython/meminfo.py b/tests/micropython/meminfo.py
new file mode 100644
index 000000000..698bbbd21
--- /dev/null
+++ b/tests/micropython/meminfo.py
@@ -0,0 +1,12 @@
+# tests meminfo functions in micropython module
+
+import micropython
+
+# these functions are not always available
+if not hasattr(micropython, 'mem_info'):
+ print('SKIP')
+else:
+ micropython.mem_info()
+ micropython.mem_info(1)
+ micropython.qstr_info()
+ micropython.qstr_info(1)
diff --git a/tests/micropython/meminfo.py.exp b/tests/micropython/meminfo.py.exp
new file mode 100644
index 000000000..31a97c3e4
--- /dev/null
+++ b/tests/micropython/meminfo.py.exp
@@ -0,0 +1,14 @@
+mem: total=\\d\+, current=\\d\+, peak=\\d\+
+stack: \\d\+ out of \\d\+
+GC: total: \\d\+, used: \\d\+, free: \\d\+
+ No. of 1-blocks: \\d\+, 2-blocks: \\d\+, max blk sz: \\d\+
+mem: total=\\d\+, current=\\d\+, peak=\\d\+
+stack: \\d\+ out of \\d\+
+GC: total: \\d\+, used: \\d\+, free: \\d\+
+ No. of 1-blocks: \\d\+, 2-blocks: \\d\+, max blk sz: \\d\+
+GC memory layout; from 0x\[0-9a-f\]\+:
+########
+qstr pool: n_pool=1, n_qstr=\\d, n_str_data_bytes=\\d\+, n_total_bytes=\\d\+
+qstr pool: n_pool=1, n_qstr=\\d, n_str_data_bytes=\\d\+, n_total_bytes=\\d\+
+########
+Q(SKIP)
diff --git a/tests/micropython/memstats.py b/tests/micropython/memstats.py
new file mode 100644
index 000000000..78e4d2473
--- /dev/null
+++ b/tests/micropython/memstats.py
@@ -0,0 +1,17 @@
+# tests meminfo functions in micropython module
+
+import micropython
+
+# these functions are not always available
+if not hasattr(micropython, 'mem_total'):
+ print('SKIP')
+else:
+ t = micropython.mem_total()
+ c = micropython.mem_current()
+ p = micropython.mem_peak()
+
+ l = list(range(10000))
+
+ print(micropython.mem_total() > t)
+ print(micropython.mem_current() > c)
+ print(micropython.mem_peak() > p)
diff --git a/tests/micropython/memstats.py.exp b/tests/micropython/memstats.py.exp
new file mode 100644
index 000000000..b8ca7e7ef
--- /dev/null
+++ b/tests/micropython/memstats.py.exp
@@ -0,0 +1,3 @@
+True
+True
+True