From ae223308bf3534f43238d175b3f85c15a2f33237 Mon Sep 17 00:00:00 2001 From: Alexandre Abadie Date: Sat, 2 Nov 2019 14:27:51 +0100 Subject: [PATCH] tests/memarray: add automatic test script --- tests/memarray/tests/01-run.py | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100755 tests/memarray/tests/01-run.py diff --git a/tests/memarray/tests/01-run.py b/tests/memarray/tests/01-run.py new file mode 100755 index 0000000000..dfef07b788 --- /dev/null +++ b/tests/memarray/tests/01-run.py @@ -0,0 +1,30 @@ +#!/usr/bin/env python3 + +# Copyright (C) 2019 Inria +# +# 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): + child.expect(r'MAX_NUMBER_BLOCKS: (\d+)\r\n') + max_number_blocks = int(child.match.group(1)) + child.expect(r'NUMBER_OF_TESTS: (\d+)\r\n') + number_of_tests = int(child.match.group(1)) + for test in range(number_of_tests): + child.expect_exact("TEST #{}:".format(test + 1)) + for i in range(max_number_blocks): + child.expect(r'\({}, @@@@@@@\) Allocated \d+ Bytes at 0x[a-z0-9]+,' + r' total [0-9]+\r\n'.format(i)) + for i in range(max_number_blocks): + child.expect(r'Free \({}\) \d+ Bytes at 0x[a-z0-9]+,' + ' total [0-9]+\r\n'.format(i)) + child.expect_exact("Finishing") + + +if __name__ == "__main__": + sys.exit(run(testfunc))