Merge branch 'feature/ut_perf_tests_disable_on_fpga' into 'master'

ut: Disable all performance test comparisons when running on FPGA

See merge request espressif/esp-idf!11415
pull/7261/head
Ivan Grokhotkov 2021-02-05 09:56:20 +08:00
commit ffa8c22c39
2 zmienionych plików z 17 dodań i 2 usunięć

Wyświetl plik

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

Wyświetl plik

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