From 24032ac9ae0dc688267411dfc047e03c0ff8a94e Mon Sep 17 00:00:00 2001
From: smlng <s@mlng.net>
Date: Fri, 19 Oct 2018 12:12:55 +0200
Subject: [PATCH] tests/heatshrink: move from unittests to regular test

This moves tests for the heatshrink package from unittests to a regular
test, which should help to decrease binary size of unittests.
---
 tests/pkg_heatshrink/Makefile                  | 11 +++++++++++
 .../main.c}                                    | 12 ++++++++----
 tests/pkg_heatshrink/tests/01-run.py           | 18 ++++++++++++++++++
 tests/unittests/tests-heatshrink/Makefile      |  1 -
 .../tests-heatshrink/Makefile.include          |  1 -
 5 files changed, 37 insertions(+), 6 deletions(-)
 create mode 100644 tests/pkg_heatshrink/Makefile
 rename tests/{unittests/tests-heatshrink/tests-heatshrink.c => pkg_heatshrink/main.c} (95%)
 create mode 100755 tests/pkg_heatshrink/tests/01-run.py
 delete mode 100644 tests/unittests/tests-heatshrink/Makefile
 delete mode 100644 tests/unittests/tests-heatshrink/Makefile.include

diff --git a/tests/pkg_heatshrink/Makefile b/tests/pkg_heatshrink/Makefile
new file mode 100644
index 0000000000..a2a5a8985f
--- /dev/null
+++ b/tests/pkg_heatshrink/Makefile
@@ -0,0 +1,11 @@
+include ../Makefile.tests_common
+
+BOARD_INSUFFICIENT_MEMORY := arduino-duemilanove \
+                             arduino-uno \
+                             nucleo-f031k6 \
+                             #
+
+USEPKG += heatshrink
+USEMODULE += embunit
+
+include $(RIOTBASE)/Makefile.include
diff --git a/tests/unittests/tests-heatshrink/tests-heatshrink.c b/tests/pkg_heatshrink/main.c
similarity index 95%
rename from tests/unittests/tests-heatshrink/tests-heatshrink.c
rename to tests/pkg_heatshrink/main.c
index add0e1770a..077b47d6b5 100644
--- a/tests/unittests/tests-heatshrink/tests-heatshrink.c
+++ b/tests/pkg_heatshrink/main.c
@@ -7,7 +7,7 @@
  */
 
 /**
- * @ingroup     unittests
+ * @ingroup     tests
  * @{
  * @file
  * @brief       Tests for the heatshrink compression library package
@@ -106,7 +106,7 @@ static void test_heatshrink(void)
     TEST_ASSERT_EQUAL_INT(_comp_uncomp((const uint8_t*)_data, strlen(_data)), 0);
 }
 
-TestRef test_heatshrink_all(void)
+TestRef tests_heatshrink(void)
 {
     EMB_UNIT_TESTFIXTURES(fixtures) {
         new_TestFixture(test_heatshrink),
@@ -116,7 +116,11 @@ TestRef test_heatshrink_all(void)
     return (TestRef) & HeatshrinkTest;
 }
 
-void tests_heatshrink(void)
+int main(void)
 {
-    TESTS_RUN(test_heatshrink_all());
+    TESTS_START();
+    TESTS_RUN(tests_heatshrink());
+    TESTS_END();
+
+    return 0;
 }
diff --git a/tests/pkg_heatshrink/tests/01-run.py b/tests/pkg_heatshrink/tests/01-run.py
new file mode 100755
index 0000000000..4e70aa35dd
--- /dev/null
+++ b/tests/pkg_heatshrink/tests/01-run.py
@@ -0,0 +1,18 @@
+#!/usr/bin/env python3
+
+# Copyright (C) 2017 Freie Universität Berlin
+#
+# 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('OK \(\d+ tests\)')
+
+
+if __name__ == "__main__":
+    sys.exit(run(testfunc))
diff --git a/tests/unittests/tests-heatshrink/Makefile b/tests/unittests/tests-heatshrink/Makefile
deleted file mode 100644
index 48422e909a..0000000000
--- a/tests/unittests/tests-heatshrink/Makefile
+++ /dev/null
@@ -1 +0,0 @@
-include $(RIOTBASE)/Makefile.base
diff --git a/tests/unittests/tests-heatshrink/Makefile.include b/tests/unittests/tests-heatshrink/Makefile.include
deleted file mode 100644
index 78eebac93e..0000000000
--- a/tests/unittests/tests-heatshrink/Makefile.include
+++ /dev/null
@@ -1 +0,0 @@
-USEPKG += heatshrink
-- 
GitLab