From 3bee4917bb3fee6902740016fcad79d6b04a41a3 Mon Sep 17 00:00:00 2001 From: Sebastian Stockhammer Date: Mon, 14 Jun 2021 10:46:14 +0200 Subject: [PATCH] Early test skip Adding mbed-os subdirectories that are not required for a specific project to .mbedignore is a good way to reduce compilation time. Sometimes it happens that tests depend on ignored files, which causes the test-build to fail even though the corresponding feature/component is not configured. The reason is that the conditional that skips the test is placed after the includes. --- .../tests/TESTS/lorawan/loraradio/main.cpp | 22 +++++++++---------- .../nfc/tests/TESTS/nfc/eeprom/main.cpp | 8 +++---- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/connectivity/lorawan/tests/TESTS/lorawan/loraradio/main.cpp b/connectivity/lorawan/tests/TESTS/lorawan/loraradio/main.cpp index 54b3b73bd75..f1bdd7c0ddb 100644 --- a/connectivity/lorawan/tests/TESTS/lorawan/loraradio/main.cpp +++ b/connectivity/lorawan/tests/TESTS/lorawan/loraradio/main.cpp @@ -15,17 +15,6 @@ * limitations under the License. */ -#include "utest.h" -#include "unity.h" -#include "greentea-client/test_env.h" - -#include "Semaphore.h" - -#include "mbed_trace.h" -#define TRACE_GROUP "RTST" - -#include "LoRaRadio.h" - #if COMPONENT_SX1272 #include "SX1272_LoRaRadio.h" #elif COMPONENT_SX1276 @@ -38,6 +27,17 @@ #error [NOT_SUPPORTED] Lora radio is not configured #endif +#include "utest.h" +#include "unity.h" +#include "greentea-client/test_env.h" + +#include "Semaphore.h" + +#include "mbed_trace.h" +#define TRACE_GROUP "RTST" + +#include "LoRaRadio.h" + using namespace utest::v1; using namespace mbed; diff --git a/connectivity/nfc/tests/TESTS/nfc/eeprom/main.cpp b/connectivity/nfc/tests/TESTS/nfc/eeprom/main.cpp index c8d40a012d5..a084bd7e29c 100644 --- a/connectivity/nfc/tests/TESTS/nfc/eeprom/main.cpp +++ b/connectivity/nfc/tests/TESTS/nfc/eeprom/main.cpp @@ -15,6 +15,10 @@ * limitations under the License. */ +#if !MBED_CONF_NFCEEPROM +#error [NOT_SUPPORTED] NFC EEPROM not supported for this target +#else + #include "mbed.h" #include "greentea-client/test_env.h" #include "unity.h" @@ -23,10 +27,6 @@ #include #include "NFCEEPROMDriver.h" -#if !MBED_CONF_NFCEEPROM -#error [NOT_SUPPORTED] NFC EEPROM not supported for this target -#else - using namespace utest::v1; using namespace mbed::nfc;