From ed4004bd0e43f260af8e960f428ebd03d64cc48d Mon Sep 17 00:00:00 2001 From: Alexandre Abadie <alexandre.abadie@inria.fr> Date: Sun, 29 Oct 2017 18:35:03 +0100 Subject: [PATCH] tests/pthread_tls: migrate to testrunner script --- tests/pthread_tls/Makefile | 3 +++ tests/pthread_tls/tests/01-run.py | 41 +++++++++++++++++++++++++++++++ 2 files changed, 44 insertions(+) create mode 100755 tests/pthread_tls/tests/01-run.py diff --git a/tests/pthread_tls/Makefile b/tests/pthread_tls/Makefile index 0fe7b4e5a8..65cc54b1d7 100644 --- a/tests/pthread_tls/Makefile +++ b/tests/pthread_tls/Makefile @@ -8,3 +8,6 @@ USEMODULE += posix USEMODULE += pthread include $(RIOTBASE)/Makefile.include + +test: + tests/01-run.py diff --git a/tests/pthread_tls/tests/01-run.py b/tests/pthread_tls/tests/01-run.py new file mode 100755 index 0000000000..12435e7b90 --- /dev/null +++ b/tests/pthread_tls/tests/01-run.py @@ -0,0 +1,41 @@ +#!/usr/bin/env python3 + +import os +import sys + +sys.path.append(os.path.join(os.environ['RIOTBASE'], 'dist/tools/testrunner')) +import testrunner + + +def _check_test_output(child): + child.expect('show tls values:') + for i in range(20): + if i != 5: + child.expect('key\[%d\]: \d+, val: %d' + % (i, i + 1 if i != 3 else 42)) + + +def testfunc(child): + child.expect('START') + child.expect('-= TEST 1 - create 20 tls with sequencial values 0...19 =-') + _check_test_output(child) + child.expect('-= TEST 2 - ' + 'delete deliberate key \(key\[5\]:\d+\) =-') + _check_test_output(child) + child.expect('-= TEST 3 - create new tls =-') + _check_test_output(child) + child.expect('-= TEST 4 - delete all keys =-') + child.expect('show tls values:') + child.expect('-= TEST 5 - try delete non-existing key =-') + child.expect('try to delete returns: 0') + child.expect('-= TEST 6 - add key and delete without a tls =-') + child.expect('created key: \d+') + child.expect('try to delete returns: 0') + child.expect('-= TEST 7 - add key without tls =-') + child.expect('created key: \d+') + child.expect('test_7_val: (0|\(nil\))') + child.expect('tls tests finished.') + child.expect('SUCCESS') + +if __name__ == "__main__": + sys.exit(testrunner.run(testfunc)) -- GitLab