From 12f6b629b8884cf3769c0fd86552217575d08542 Mon Sep 17 00:00:00 2001
From: Alexandre Abadie <alexandre.abadie@inria.fr>
Date: Fri, 10 Nov 2017 09:23:57 +0100
Subject: [PATCH] tests/pkg_micro-ecc: migrate to testrunner

---
 tests/pkg_micro-ecc/Makefile        |  3 +++
 tests/pkg_micro-ecc/main.c          |  8 +++++---
 tests/pkg_micro-ecc/tests/01-run.py | 19 +++++++++++++++++++
 3 files changed, 27 insertions(+), 3 deletions(-)
 create mode 100755 tests/pkg_micro-ecc/tests/01-run.py

diff --git a/tests/pkg_micro-ecc/Makefile b/tests/pkg_micro-ecc/Makefile
index c2cfe59cbf..1a71f4797e 100644
--- a/tests/pkg_micro-ecc/Makefile
+++ b/tests/pkg_micro-ecc/Makefile
@@ -5,3 +5,6 @@ USEMODULE += hashes
 USEPKG += micro-ecc
 
 include $(RIOTBASE)/Makefile.include
+
+test:
+	tests/01-run.py
diff --git a/tests/pkg_micro-ecc/main.c b/tests/pkg_micro-ecc/main.c
index 2e60fe6251..0e41a82e68 100644
--- a/tests/pkg_micro-ecc/main.c
+++ b/tests/pkg_micro-ecc/main.c
@@ -164,10 +164,12 @@ int main(void)
 
     printf(" done with %d error(s)\n", errorc);
 
-    if (errorc == 0) {
-        return 0;
+    if (errorc) {
+        puts("FAILURE");
+        return 1;
     }
     else {
-        return 1;
+        puts("SUCCESS");
+        return 0;
     }
 }
diff --git a/tests/pkg_micro-ecc/tests/01-run.py b/tests/pkg_micro-ecc/tests/01-run.py
new file mode 100755
index 0000000000..d3bf065fa2
--- /dev/null
+++ b/tests/pkg_micro-ecc/tests/01-run.py
@@ -0,0 +1,19 @@
+#!/usr/bin/env python3
+
+import os
+import sys
+import math
+
+sys.path.append(os.path.join(os.environ['RIOTBASE'], 'dist/tools/testrunner'))
+import testrunner
+
+
+def testfunc(child):
+    child.expect_exact('micro-ecc compiled!')
+    child.expect_exact('Testing 16 random private key pairs and signature '
+                       'without using HWRNG')
+    child.expect_exact('................ done with 0 error(s)')
+    child.expect_exact('SUCCESS')
+
+if __name__ == "__main__":
+    sys.exit(testrunner.run(testfunc, timeout=60))
-- 
GitLab