diff --git a/tests/pkg_libcose/Makefile b/tests/pkg_libcose/Makefile new file mode 100644 index 0000000000000000000000000000000000000000..5188a0260fdc37fede1677c414d83b2a8163e342 --- /dev/null +++ b/tests/pkg_libcose/Makefile @@ -0,0 +1,20 @@ +include ../Makefile.tests_common + +# HACL* only compiles on 32bit platforms +BOARD_BLACKLIST := arduino-duemilanove arduino-mega2560 arduino-uno \ + jiminy-mega256rfr2 mega-xplained waspmote-pro \ + chronos msb-430 msb-430h telosb wsn430-v1_3b wsn430-v1_4 z1 + +BOARD_INSUFFICIENT_MEMORY := nucleo-f030r8 nucleo-f031k6 nucleo-f042k6 \ + nucleo-l031k6 nucleo-l053r8 stm32f0discovery + +TEST_ON_CI_WHITELIST += native + +CFLAGS += -DTHREAD_STACKSIZE_MAIN=\(4*THREAD_STACKSIZE_DEFAULT\) + +USEPKG += libcose +USEMODULE += libcose_crypt_hacl +USEMODULE += memarray +USEMODULE += embunit + +include $(RIOTBASE)/Makefile.include diff --git a/tests/unittests/tests-libcose/tests-libcose.c b/tests/pkg_libcose/main.c similarity index 95% rename from tests/unittests/tests-libcose/tests-libcose.c rename to tests/pkg_libcose/main.c index d6621c2f058e147131683f17a77b83f5b4e9ef3e..bff6c52d3d34ca877657053969b163a0a4a7b4ba 100644 --- a/tests/unittests/tests-libcose/tests-libcose.c +++ b/tests/pkg_libcose/main.c @@ -12,7 +12,7 @@ * @{ * * @file - * @brief Unit tests for pkg libcose + * @brief Tests for pkg libcose * * @author Koen Zandberg <koen@bergzand.net> */ @@ -31,8 +31,6 @@ #include "memarray.h" #include "random.h" -#include "tests-libcose.h" - /* Example payload */ static char payload[] = "Input string"; /* Key ID's */ @@ -196,7 +194,7 @@ static void test_libcose_03(void) TEST_ASSERT_EQUAL_INT(plaintext_len, sizeof(payload) - 1); } -Test *tests_libcose_all(void) +Test *tests_libcose(void) { EMB_UNIT_TESTFIXTURES(fixtures) { new_TestFixture(test_libcose_01), @@ -208,9 +206,10 @@ Test *tests_libcose_all(void) return (Test *)&libcose_tests; } -void tests_libcose(void) +int main(void) { - printf("Starting libcose test, performing multiple signature operations.\n"); - printf("This can take a while (up to 2 minutes on the samr21-xpro)\n"); - TESTS_RUN(tests_libcose_all()); + TESTS_START(); + TESTS_RUN(tests_libcose()); + TESTS_END(); + return 0; } diff --git a/tests/pkg_libcose/tests/01-run.py b/tests/pkg_libcose/tests/01-run.py new file mode 100755 index 0000000000000000000000000000000000000000..d4011d0fd705bfe6f3398105b4dac63592815f04 --- /dev/null +++ b/tests/pkg_libcose/tests/01-run.py @@ -0,0 +1,22 @@ +#!/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 os +import sys +from testrunner import run + + +def testfunc(child): + board = os.environ['BOARD'] + # Increase timeout on "real" hardware + timeout = 120 if board is not 'native' else -1 + child.expect('OK \(\d+ tests\)', timeout=timeout) + + +if __name__ == "__main__": + sys.exit(run(testfunc)) diff --git a/tests/unittests/Makefile b/tests/unittests/Makefile index f714ce0e9b0e15c9fe4bae11424f1dd83083f044..3fb1c655f343715a88fcbbe1c2ce1bcb5daf3c3d 100644 --- a/tests/unittests/Makefile +++ b/tests/unittests/Makefile @@ -236,7 +236,6 @@ ifneq (, $(filter $(AVR_BOARDS), $(BOARD))) endif LARGE_STACK_TESTS += tests-hacl -LARGE_STACK_TESTS += tests-libcose LARGE_STACK_TESTS += tests-tweetnacl ifneq (,$(filter $(LARGE_STACK_TESTS), $(UNIT_TESTS))) CFLAGS += -DTHREAD_STACKSIZE_MAIN=\(4*THREAD_STACKSIZE_DEFAULT+THREAD_EXTRA_STACKSIZE_PRINTF\) diff --git a/tests/unittests/tests-libcose/Makefile b/tests/unittests/tests-libcose/Makefile deleted file mode 100644 index 48422e909a47d7cd428d10fa73825060ccc8d8c2..0000000000000000000000000000000000000000 --- a/tests/unittests/tests-libcose/Makefile +++ /dev/null @@ -1 +0,0 @@ -include $(RIOTBASE)/Makefile.base diff --git a/tests/unittests/tests-libcose/Makefile.include b/tests/unittests/tests-libcose/Makefile.include deleted file mode 100644 index 26de7cc1b8843bef39788e4e37c6cee2df8a552e..0000000000000000000000000000000000000000 --- a/tests/unittests/tests-libcose/Makefile.include +++ /dev/null @@ -1,7 +0,0 @@ -CFLAGS +=-DCOSE_SIGNATURES_MAX=2 - -USEPKG += libcose - -USEMODULE += random -USEMODULE += memarray -USEMODULE += libcose_crypt_hacl diff --git a/tests/unittests/tests-libcose/tests-libcose.h b/tests/unittests/tests-libcose/tests-libcose.h deleted file mode 100644 index 9051f34762086659cf38c739a97d63ac29269b52..0000000000000000000000000000000000000000 --- a/tests/unittests/tests-libcose/tests-libcose.h +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright (C) 2018 Freie Universität Berlin - * Copyright (C) 2018 Inria - * - * 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 libcose package - * - */ -#ifndef TESTS_LIBCOSE_H -#define TESTS_LIBCOSE_H - -#include "embUnit/embUnit.h" - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * @brief The entry point of this test suite. - */ -void tests_libcose(void); - -#ifdef __cplusplus -} -#endif - -#endif /* TESTS_LIBCOSE_H */ -/** @} */