1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2025-12-18 02:53:52 +01:00
RIOT/tests/heap_cmd/tests/01-run.py
Francisco Molina 416c048737 tests: add test_utils_interactive_sync when possible
- Define test_utils_interactive_sync as DEFAULT_MODULE in Makefile.tests_common
- For tests disabling autoinit, add test_utils_interactive_sync to main
- Add DISABLE_MODULE += test_utils_interactive_sync for tests requiring
  sudo,  `tests/shell`, `tests/minimal` and `tests/stdin`
- Add shell_commands to tests/periph_wdt and tests/struct_tm_utility to
  pull `r` and `s` commands
- Remove includes and usage in `tests/main.c` for tests that where
  already using test_utils_interactive_sync
2019-11-27 15:07:42 +01:00

35 lines
993 B
Python
Executable File

#!/usr/bin/env python3
# Copyright (C) 2019 Gunar Schorcht <gunar@schorcht.net>
#
# This file is subject to the terms and conditions of the GNU Lesser
# General Public License v2.1. See the file LICENSE in the top level
# directory for more details.
import sys
from testrunner import run
def testfunc(child):
# check startup message
child.sendline('heap')
ret = child.expect([r'heap: \d+ \(used \d+, free \d+\) \[bytes\]', 'heap statistics are not supported'])
if ret == 1:
return
child.sendline('malloc 100')
child.expect('allocated 0x')
addr = child.readline()
addr = addr[:-2]
child.expect_exact('> ')
child.sendline('heap')
child.expect(r'heap: \d+ \(used \d+, free \d+\) \[bytes\]')
child.sendline('free 0x' + addr)
child.expect('freed 0x' + addr)
child.expect_exact('>')
child.sendline('heap')
child.expect(r'heap: \d+ \(used \d+, free \d+\) \[bytes\]')
if __name__ == "__main__":
sys.exit(run(testfunc))