From f9eebce43f9fffcd818bfceb3ef51b310300d57d Mon Sep 17 00:00:00 2001 From: Koen Zandberg Date: Wed, 17 Oct 2018 22:13:53 +0200 Subject: [PATCH] tests/qdsa: Move from unittests to regular tests Stack size is changed from 4 times the default + printf to 5 times the default stack size. Only on the lpc2387 this reduces the resulting stack space. the test is not rerun for the lpc2387 and is untested. --- tests/pkg_qdsa/Makefile | 16 +++++++ .../tests-qDSA.c => pkg_qdsa/main.c} | 10 +++-- tests/pkg_qdsa/tests/01-run.py | 18 ++++++++ tests/unittests/Makefile | 4 -- tests/unittests/tests-qDSA/Makefile | 1 - tests/unittests/tests-qDSA/Makefile.include | 2 - tests/unittests/tests-qDSA/tests-qDSA.h | 44 ------------------- 7 files changed, 40 insertions(+), 55 deletions(-) create mode 100644 tests/pkg_qdsa/Makefile rename tests/{unittests/tests-qDSA/tests-qDSA.c => pkg_qdsa/main.c} (92%) create mode 100755 tests/pkg_qdsa/tests/01-run.py delete mode 100644 tests/unittests/tests-qDSA/Makefile delete mode 100644 tests/unittests/tests-qDSA/Makefile.include delete mode 100644 tests/unittests/tests-qDSA/tests-qDSA.h diff --git a/tests/pkg_qdsa/Makefile b/tests/pkg_qdsa/Makefile new file mode 100644 index 0000000000..020c095d33 --- /dev/null +++ b/tests/pkg_qdsa/Makefile @@ -0,0 +1,16 @@ +include ../Makefile.tests_common + +TEST_ON_CI_WHITELIST += all + +# qDSA is not 16 bit compatible +BOARD_BLACKLIST := chronos msb-430 msb-430h telosb wsn430-v1_3b wsn430-v1_4 z1 + +BOARD_INSUFFICIENT_MEMORY := arduino-duemilanove arduino-uno nucleo-f031k6 + +CFLAGS += -DTHREAD_STACKSIZE_MAIN=\(4*THREAD_STACKSIZE_DEFAULT\) + +USEPKG += qDSA +USEMODULE += random +USEMODULE += embunit + +include $(RIOTBASE)/Makefile.include diff --git a/tests/unittests/tests-qDSA/tests-qDSA.c b/tests/pkg_qdsa/main.c similarity index 92% rename from tests/unittests/tests-qDSA/tests-qDSA.c rename to tests/pkg_qdsa/main.c index eef117c422..61cda6c088 100644 --- a/tests/unittests/tests-qDSA/tests-qDSA.c +++ b/tests/pkg_qdsa/main.c @@ -19,7 +19,6 @@ */ #include "embUnit.h" -#include "tests-qDSA.h" #include "random.h" #include "sign.h" @@ -64,7 +63,7 @@ static void test_qDSA_sign_verify(void) TEST_ASSERT_EQUAL_INT(1, verify(m_result, 0, sm, smlen, pk)); } -Test *tests_qDSA_all(void) +Test *tests_qDSA(void) { EMB_UNIT_TESTFIXTURES(fixtures) { new_TestFixture(test_qDSA_sign_verify), @@ -74,7 +73,10 @@ Test *tests_qDSA_all(void) return (Test*)&qDSA_tests; } -void tests_qDSA(void) +int main(void) { - TESTS_RUN(tests_qDSA_all()); + TESTS_START(); + TESTS_RUN(tests_qDSA()); + TESTS_END(); + return 0; } diff --git a/tests/pkg_qdsa/tests/01-run.py b/tests/pkg_qdsa/tests/01-run.py new file mode 100755 index 0000000000..4e70aa35dd --- /dev/null +++ b/tests/pkg_qdsa/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/Makefile b/tests/unittests/Makefile index f24eb63bd1..c8dae19608 100644 --- a/tests/unittests/Makefile +++ b/tests/unittests/Makefile @@ -231,10 +231,6 @@ ifneq (,$(filter tests-cpp_%, $(UNIT_TESTS))) export CPPMIX := 1 endif -ifneq (, $(filter $(AVR_BOARDS), $(BOARD))) - LARGE_STACK_TESTS += tests-qDSA -endif - ifneq (,$(filter $(LARGE_STACK_TESTS), $(UNIT_TESTS))) CFLAGS += -DTHREAD_STACKSIZE_MAIN=\(4*THREAD_STACKSIZE_DEFAULT+THREAD_EXTRA_STACKSIZE_PRINTF\) endif diff --git a/tests/unittests/tests-qDSA/Makefile b/tests/unittests/tests-qDSA/Makefile deleted file mode 100644 index 48422e909a..0000000000 --- a/tests/unittests/tests-qDSA/Makefile +++ /dev/null @@ -1 +0,0 @@ -include $(RIOTBASE)/Makefile.base diff --git a/tests/unittests/tests-qDSA/Makefile.include b/tests/unittests/tests-qDSA/Makefile.include deleted file mode 100644 index 25bd224b7c..0000000000 --- a/tests/unittests/tests-qDSA/Makefile.include +++ /dev/null @@ -1,2 +0,0 @@ -USEMODULE += random -USEPKG += qDSA diff --git a/tests/unittests/tests-qDSA/tests-qDSA.h b/tests/unittests/tests-qDSA/tests-qDSA.h deleted file mode 100644 index d0e239afc3..0000000000 --- a/tests/unittests/tests-qDSA/tests-qDSA.h +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright (C) 2018 Kaspar Schleiser - * - * 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. - */ - -/** - * @addtogroup unittests - * @{ - * - * @file - * @brief Unittests for the qDSA package - * - * @author Kaspar Schleiser - */ -#ifndef TESTS_QDSA_H -#define TESTS_QDSA_H - -#include "embUnit/embUnit.h" - -#ifdef __cplusplus -extern "C" { -#endif - -/** -* @brief The entry point of this test suite. -*/ -void tests_qDSA(void); - -/** - * @brief Generates tests for qDSA - * - * @return embUnit tests if successful, NULL if not. - */ -Test *tests_dDSA_tests(void); - -#ifdef __cplusplus -} -#endif - -#endif /* TESTS_QDSA_H */ -/** @} */