mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
ut: add DISABLED_FOR_TARGETS macros to control ut building
This commit is contained in:
parent
826b9f6380
commit
bc0eac579c
@ -174,14 +174,38 @@ void unity_run_all_tests(void);
|
||||
|
||||
void unity_run_menu(void);
|
||||
|
||||
#include "sdkconfig.h"
|
||||
#if CONFIG_IDF_TARGET_ESP32
|
||||
#define TEST_CASE_ESP32(...) TEST_CASE(__VA_ARGS__)
|
||||
#define TEST_CASE_MULTIPLE_STAGES_ESP32(...) TEST_CASE_MULTIPLE_STAGES(__VA_ARGS__)
|
||||
#define TEST_CASE_MULTIPLE_DEVICES_ESP32(...) TEST_CASE_MULTIPLE_DEVICES(__VA_ARGS__)
|
||||
#else
|
||||
#define TEST_CASE_ESP32(...) __attribute__((unused)) static void UNITY_TEST_UID(test_func_) (void)
|
||||
#define TEST_CASE_MULTIPLE_STAGES_ESP32(_, __, ...) __attribute__((unused)) static test_func UNITY_TEST_UID(test_functions)[] = {__VA_ARGS__};
|
||||
#define TEST_CASE_MULTIPLE_DEVICES_ESP32(_, __, ...) __attribute__((unused)) static test_func UNITY_TEST_UID(test_functions)[] = {__VA_ARGS__};
|
||||
#include "sdkconfig.h" //to get IDF_TARGET_xxx
|
||||
|
||||
#endif
|
||||
#define CONFIG_IDF_TARGET_NA 0
|
||||
|
||||
/*
|
||||
* This macro is to disable those tests and their callees that cannot be built or run temporarily
|
||||
* (needs update or runners).
|
||||
*
|
||||
* Usage:
|
||||
* ```
|
||||
* #if !TEMPORARY_DISABLED_FOR_TARGETS(ESP32S2BETA, ESP32S2)
|
||||
* TEST_CASE("only for esp32", "")
|
||||
* {
|
||||
* }
|
||||
* #endif
|
||||
* ```
|
||||
*/
|
||||
#define TEMPORARY_DISABLED_FOR_TARGETS(...) (_UNITY_DFT_10(__VA_ARGS__, NA, NA, NA, NA, NA, NA, NA, NA, NA))
|
||||
|
||||
/*
|
||||
* This macro is to disable those tests and their callees that is totally impossible to run on the
|
||||
* specific targets. Usage same as TEMPORARY_DISABLED_FOR_TARGETS.
|
||||
*/
|
||||
#define DISABLED_FOR_TARGETS(...) TEMPORARY_DISABLED_FOR_TARGETS(__VA_ARGS__)
|
||||
|
||||
#define _UNITY_DFT_10(TARGET, ...) (CONFIG_IDF_TARGET_##TARGET || _UNITY_DFT_9(__VA_ARGS__))
|
||||
#define _UNITY_DFT_9(TARGET, ...) (CONFIG_IDF_TARGET_##TARGET || _UNITY_DFT_8(__VA_ARGS__))
|
||||
#define _UNITY_DFT_8(TARGET, ...) (CONFIG_IDF_TARGET_##TARGET || _UNITY_DFT_7(__VA_ARGS__))
|
||||
#define _UNITY_DFT_7(TARGET, ...) (CONFIG_IDF_TARGET_##TARGET || _UNITY_DFT_6(__VA_ARGS__))
|
||||
#define _UNITY_DFT_6(TARGET, ...) (CONFIG_IDF_TARGET_##TARGET || _UNITY_DFT_5(__VA_ARGS__))
|
||||
#define _UNITY_DFT_5(TARGET, ...) (CONFIG_IDF_TARGET_##TARGET || _UNITY_DFT_4(__VA_ARGS__))
|
||||
#define _UNITY_DFT_4(TARGET, ...) (CONFIG_IDF_TARGET_##TARGET || _UNITY_DFT_3(__VA_ARGS__))
|
||||
#define _UNITY_DFT_3(TARGET, ...) (CONFIG_IDF_TARGET_##TARGET || _UNITY_DFT_2(__VA_ARGS__))
|
||||
#define _UNITY_DFT_2(TARGET, ...) (CONFIG_IDF_TARGET_##TARGET || _UNITY_DFT_1(__VA_ARGS__))
|
||||
#define _UNITY_DFT_1(TARGET, ...) (CONFIG_IDF_TARGET_##TARGET)
|
||||
|
Loading…
x
Reference in New Issue
Block a user