From 7c446176a4c54d265d107d2df78a1c9ad835496b Mon Sep 17 00:00:00 2001
From: Alexandre Abadie <alexandre.abadie@inria.fr>
Date: Sun, 29 Oct 2017 11:06:26 +0100
Subject: [PATCH] tests/pthread: migrate to testrunner script

---
 tests/pthread/Makefile        |  3 +++
 tests/pthread/tests/01-run.py | 25 +++++++++++++++++++++++++
 2 files changed, 28 insertions(+)
 create mode 100755 tests/pthread/tests/01-run.py

diff --git a/tests/pthread/Makefile b/tests/pthread/Makefile
index 2e2c8e2c1c..587c462f86 100644
--- a/tests/pthread/Makefile
+++ b/tests/pthread/Makefile
@@ -8,3 +8,6 @@ USEMODULE += posix
 USEMODULE += pthread
 
 include $(RIOTBASE)/Makefile.include
+
+test:
+	tests/01-run.py
diff --git a/tests/pthread/tests/01-run.py b/tests/pthread/tests/01-run.py
new file mode 100755
index 0000000000..f2ae587229
--- /dev/null
+++ b/tests/pthread/tests/01-run.py
@@ -0,0 +1,25 @@
+#!/usr/bin/env python3
+
+import os
+import sys
+import math
+
+sys.path.append(os.path.join(os.environ['RIOTBASE'], 'dist/tools/testrunner'))
+import testrunner
+
+
+FACTORIAL_PARAM = 6
+
+
+def testfunc(child):
+    child.expect('main: parameter = {}'.format(FACTORIAL_PARAM))
+    child.expect('pthread: parameter = {}'.format(FACTORIAL_PARAM))
+    child.expect('pthread: factorial = {}'
+                 .format(math.factorial(FACTORIAL_PARAM)))
+    child.expect('main: factorial = {}'
+                 .format(math.factorial(FACTORIAL_PARAM)))
+    child.expect('SUCCESS')
+
+
+if __name__ == "__main__":
+    sys.exit(testrunner.run(testfunc))
-- 
GitLab