diff --git a/tests/periph_flashpage_unittest/Makefile b/tests/periph_flashpage_unittest/Makefile new file mode 100644 index 0000000000..0e97686659 --- /dev/null +++ b/tests/periph_flashpage_unittest/Makefile @@ -0,0 +1,8 @@ +include ../Makefile.tests_common + +USEMODULE += embunit + +# avoid running Kconfig by default +SHOULD_RUN_KCONFIG ?= + +include $(RIOTBASE)/Makefile.include diff --git a/tests/periph_flashpage_unittest/app.config.test b/tests/periph_flashpage_unittest/app.config.test new file mode 100644 index 0000000000..98a2df0531 --- /dev/null +++ b/tests/periph_flashpage_unittest/app.config.test @@ -0,0 +1,3 @@ +# this file enables modules defined in Kconfig. Do not use this file for +# application configuration. This is only needed during migration. +CONFIG_MODULE_EMBUNIT=y diff --git a/tests/unittests/tests-flashpage/tests-flashpage.c b/tests/periph_flashpage_unittest/main.c similarity index 84% rename from tests/unittests/tests-flashpage/tests-flashpage.c rename to tests/periph_flashpage_unittest/main.c index 00ddd6c7cc..7db5448eee 100644 --- a/tests/unittests/tests-flashpage/tests-flashpage.c +++ b/tests/periph_flashpage_unittest/main.c @@ -7,17 +7,22 @@ */ /** + * @ingroup tests * @{ * * @file + * @brief Unittests for the ``flashpage`` periph driver + * + * @author Hauke Petersen + * */ #include #include #include "cpu.h" +#include "embUnit.h" #include "embUnit/embUnit.h" -#include "tests-flashpage.h" /* need to define these values before including the header */ #ifndef FLASHPAGE_SIZE @@ -32,6 +37,10 @@ #include "periph/flashpage.h" +#if (defined(BOARD_NATIVE) && !IS_USED(MODULE_PERIPH_FLASHPAGE)) +char _native_flash[FLASHPAGE_SIZE * FLASHPAGE_NUMOF]; +#endif + static void test_flashbase_addr(void) { void *addr; @@ -72,8 +81,11 @@ Test *tests_flashpage_tests(void) return (Test *)&flashbase_tests; } -void tests_flashpage(void) +int main(void) { + TESTS_START(); TESTS_RUN(tests_flashpage_tests()); + TESTS_END(); + return 0; } /** @} */ diff --git a/tests/periph_flashpage_unittest/tests/01-run.py b/tests/periph_flashpage_unittest/tests/01-run.py new file mode 100755 index 0000000000..4307d66a69 --- /dev/null +++ b/tests/periph_flashpage_unittest/tests/01-run.py @@ -0,0 +1,14 @@ +#!/usr/bin/env python3 + +# Copyright (C) 2021 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_check_unittests + + +if __name__ == "__main__": + sys.exit(run_check_unittests()) diff --git a/tests/unittests/tests-flashpage/Makefile b/tests/unittests/tests-flashpage/Makefile deleted file mode 100644 index 48422e909a..0000000000 --- a/tests/unittests/tests-flashpage/Makefile +++ /dev/null @@ -1 +0,0 @@ -include $(RIOTBASE)/Makefile.base diff --git a/tests/unittests/tests-flashpage/Makefile.include b/tests/unittests/tests-flashpage/Makefile.include deleted file mode 100644 index 95277f63b4..0000000000 --- a/tests/unittests/tests-flashpage/Makefile.include +++ /dev/null @@ -1 +0,0 @@ -FEATURES_REQUIRED += periph_flashpage diff --git a/tests/unittests/tests-flashpage/tests-flashpage.h b/tests/unittests/tests-flashpage/tests-flashpage.h deleted file mode 100644 index 94db92a901..0000000000 --- a/tests/unittests/tests-flashpage/tests-flashpage.h +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright (C) 2016 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. - */ - -/** - * @addtogroup unittests - * @{ - * - * @file - * @brief Unittests for the ``flashpage`` periph driver - * - * @author Hauke Petersen - */ -#ifndef TESTS_FLASHPAGE_H -#define TESTS_FLASHPAGE_H - -#include "embUnit.h" - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * @brief Entry point of this test suite - */ -void tests_flashpage(void); - -#ifdef __cplusplus -} -#endif - -#endif /* TESTS_FLASHPAGE_H */ -/** @} */