From 3f3cc83c7a0c4f1d648166eb040d54e358fc132c Mon Sep 17 00:00:00 2001 From: Teufelchen1 Date: Thu, 4 Apr 2024 16:41:23 +0200 Subject: [PATCH] unittests: Move at test to driver tests --- .../at_unit/Makefile} | 5 +++ .../tests-at => drivers/at_unit}/tests-at.c | 20 ++++++++--- tests/unittests/tests-at/Makefile | 1 - tests/unittests/tests-at/tests-at.h | 36 ------------------- 4 files changed, 20 insertions(+), 42 deletions(-) rename tests/{unittests/tests-at/Makefile.include => drivers/at_unit/Makefile} (79%) rename tests/{unittests/tests-at => drivers/at_unit}/tests-at.c (98%) delete mode 100644 tests/unittests/tests-at/Makefile delete mode 100644 tests/unittests/tests-at/tests-at.h diff --git a/tests/unittests/tests-at/Makefile.include b/tests/drivers/at_unit/Makefile similarity index 79% rename from tests/unittests/tests-at/Makefile.include rename to tests/drivers/at_unit/Makefile index e80eb834ae17..7f8e3d0a3433 100644 --- a/tests/unittests/tests-at/Makefile.include +++ b/tests/drivers/at_unit/Makefile @@ -1,3 +1,5 @@ +include ../Makefile.drivers_common + HANDLE_URC ?= 1 ECHO_ON ?= 1 SEND_EOL ?= "\\xd" @@ -16,4 +18,7 @@ CFLAGS += -DAT_RECV_EOL_1="\"$(RECV_EOL_1)\"" CFLAGS += -DAT_RECV_EOL_2="\"$(RECV_EOL_2)\"" CFLAGS += -DCONFIG_AT_SEND_EOL="\"$(SEND_EOL)\"" +USEMODULE += embunit USEMODULE += at + +include $(RIOTBASE)/Makefile.include diff --git a/tests/unittests/tests-at/tests-at.c b/tests/drivers/at_unit/tests-at.c similarity index 98% rename from tests/unittests/tests-at/tests-at.c rename to tests/drivers/at_unit/tests-at.c index 390f1344204e..0e59638d5de8 100644 --- a/tests/unittests/tests-at/tests-at.c +++ b/tests/drivers/at_unit/tests-at.c @@ -11,8 +11,6 @@ #include "at.h" #include "isrpipe/read_timeout.h" -#include "tests-at.h" - #define UNIT_TEST_LONG_URC "+UNITTEST_LONG_URC_VEEERY_LONG" #define UNIT_TEST_SHORT_URC "+U" #define LONG_COMMAND "AT+COMMAND_AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"\ @@ -59,7 +57,7 @@ static void set_up(void) .rp_buf_size = sizeof(rp_buf), .rx_buf = buf, .rx_buf_size = sizeof(buf), - .uart = UART_DEV(0), + .uart = UART_DEV(1), }; int res = at_dev_init(&at_dev, &at_init_params); /* check the UART initialization return value and respond as needed */ @@ -670,7 +668,7 @@ void test_process_urc(void) } #endif /* MODULE_AT_URC */ -void tests_at(void) +static Test *tests_at(void) { EMB_UNIT_TESTFIXTURES(fixtures) { new_TestFixture(test_readline_or_echo), @@ -688,5 +686,17 @@ void tests_at(void) EMB_UNIT_TESTCALLER(at_tests, set_up, tear_down, fixtures); - TESTS_RUN((Test *)&at_tests); + return (Test *)&at_tests; +} + +int main(void) +{ + + puts("AT unit-like test\n"); + + TESTS_START(); + TESTS_RUN(tests_at()); + TESTS_END(); + + return 0; } diff --git a/tests/unittests/tests-at/Makefile b/tests/unittests/tests-at/Makefile deleted file mode 100644 index 48422e909a47..000000000000 --- a/tests/unittests/tests-at/Makefile +++ /dev/null @@ -1 +0,0 @@ -include $(RIOTBASE)/Makefile.base diff --git a/tests/unittests/tests-at/tests-at.h b/tests/unittests/tests-at/tests-at.h deleted file mode 100644 index 62c0c17b347a..000000000000 --- a/tests/unittests/tests-at/tests-at.h +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright (C) 2024 ML!PA GmbH - * - * 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 at module - * - * @author Mihai Renea - */ -#ifndef TESTS_AT_H -#define TESTS_AT_H -#include "embUnit/embUnit.h" - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * @brief Tests entry point. - */ -void tests_at(void); - -#ifdef __cplusplus -} -#endif - -#endif /* TESTS_AT_H */ -/** @} */