mirror of
https://github.com/espressif/esp-idf.git
synced 2025-08-02 20:24:32 +02:00
unity: Add option to ignore performance test failures
Set by default on FPGA, where performance may be significantly different to a real chip.
This commit is contained in:
@@ -24,4 +24,13 @@ menu "IDF unit test"
|
|||||||
int "Critical leak for UT which use LWIP component"
|
int "Critical leak for UT which use LWIP component"
|
||||||
default 4095
|
default 4095
|
||||||
|
|
||||||
|
config UNITY_IGNORE_PERFORMANCE_TESTS
|
||||||
|
bool "Ignore performance test results"
|
||||||
|
default y if IDF_ENV_FPGA
|
||||||
|
default n
|
||||||
|
help
|
||||||
|
If set, performance tests that use TEST_PERFORMANCE_LESS_THAN and
|
||||||
|
TEST_PERFORMANCE_GREATER_THAN macros will log the performance value
|
||||||
|
but not fail the test if the threshold is not met.
|
||||||
|
|
||||||
endmenu
|
endmenu
|
||||||
|
@@ -41,14 +41,20 @@ extern "C" {
|
|||||||
#define PERFORMANCE_CON(a, b) _PERFORMANCE_CON(a, b)
|
#define PERFORMANCE_CON(a, b) _PERFORMANCE_CON(a, b)
|
||||||
#define _PERFORMANCE_CON(a, b) a##b
|
#define _PERFORMANCE_CON(a, b) a##b
|
||||||
|
|
||||||
|
#if !CONFIG_UNITY_IGNORE_PERFORMANCE_TESTS
|
||||||
|
#define _TEST_PERFORMANCE_ASSERT TEST_ASSERT
|
||||||
|
#else
|
||||||
|
#define _TEST_PERFORMANCE_ASSERT(ARG) printf("Ignoring performance test [%s]\n", PERFORMANCE_STR(ARG))
|
||||||
|
#endif
|
||||||
|
|
||||||
#define TEST_PERFORMANCE_LESS_THAN(name, value_fmt, value) do { \
|
#define TEST_PERFORMANCE_LESS_THAN(name, value_fmt, value) do { \
|
||||||
printf("[Performance][" PERFORMANCE_STR(name) "]: "value_fmt"\n", value); \
|
printf("[Performance][" PERFORMANCE_STR(name) "]: "value_fmt"\n", value); \
|
||||||
TEST_ASSERT(value < PERFORMANCE_CON(IDF_PERFORMANCE_MAX_, name)); \
|
_TEST_PERFORMANCE_ASSERT(value < PERFORMANCE_CON(IDF_PERFORMANCE_MAX_, name)); \
|
||||||
} while(0)
|
} while(0)
|
||||||
|
|
||||||
#define TEST_PERFORMANCE_GREATER_THAN(name, value_fmt, value) do { \
|
#define TEST_PERFORMANCE_GREATER_THAN(name, value_fmt, value) do { \
|
||||||
printf("[Performance][" PERFORMANCE_STR(name) "]: "value_fmt"\n", value); \
|
printf("[Performance][" PERFORMANCE_STR(name) "]: "value_fmt"\n", value); \
|
||||||
TEST_ASSERT(value > PERFORMANCE_CON(IDF_PERFORMANCE_MIN_, name)); \
|
_TEST_PERFORMANCE_ASSERT(value > PERFORMANCE_CON(IDF_PERFORMANCE_MIN_, name)); \
|
||||||
} while(0)
|
} while(0)
|
||||||
|
|
||||||
/* Macros to be used when performance is calculated using the cache compensated timer
|
/* Macros to be used when performance is calculated using the cache compensated timer
|
||||||
|
Reference in New Issue
Block a user