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.
pull/14767/head
Sebastian Stockhammer 2021-06-14 10:46:14 +02:00
parent 39644781a2
commit 3bee4917bb
2 changed files with 15 additions and 15 deletions

View File

@ -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;

View File

@ -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 <events/mbed_events.h>
#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;