diff --git a/tools/unit-test-app/components/test_utils/Kconfig b/tools/unit-test-app/components/test_utils/Kconfig index 0508f2a89f..eb5770cea7 100644 --- a/tools/unit-test-app/components/test_utils/Kconfig +++ b/tools/unit-test-app/components/test_utils/Kconfig @@ -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 diff --git a/tools/unit-test-app/components/test_utils/include/test_utils.h b/tools/unit-test-app/components/test_utils/include/test_utils.h index 77281ac794..a1b61d3914 100644 --- a/tools/unit-test-app/components/test_utils/include/test_utils.h +++ b/tools/unit-test-app/components/test_utils/include/test_utils.h @@ -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