mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04: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:
parent
62cc864cbe
commit
76ed28172c
@ -24,4 +24,13 @@ menu "IDF unit test"
|
||||
int "Critical leak for UT which use LWIP component"
|
||||
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
|
||||
|
@ -41,14 +41,20 @@ extern "C" {
|
||||
#define PERFORMANCE_CON(a, b) _PERFORMANCE_CON(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 { \
|
||||
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)
|
||||
|
||||
#define TEST_PERFORMANCE_GREATER_THAN(name, value_fmt, value) do { \
|
||||
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)
|
||||
|
||||
/* Macros to be used when performance is calculated using the cache compensated timer
|
||||
|
Loading…
x
Reference in New Issue
Block a user