unit_test: Refactor all performance tests that rely on cache compensated timer

There is no ccomp timer on C3, which means our performance tests will start
failing again due to variance caused by cache misses.

This MR adds TEST_PERFORMANCE_CCOMP_ macro that will only fail
performance test if CCOMP timer is supported on the target
This commit is contained in:
Marius Vikhammer
2020-12-04 11:35:21 +08:00
committed by Angus Gratton
parent 7ed95d13b1
commit 0a95151a75
13 changed files with 42 additions and 22 deletions

View File

@@ -21,6 +21,7 @@
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
#include "unity.h"
#include "soc/soc_caps.h"
/* include performance pass standards header file */
#include "idf_performance.h"
#include "idf_performance_target.h"
@@ -50,6 +51,21 @@ extern "C" {
TEST_ASSERT(value > PERFORMANCE_CON(IDF_PERFORMANCE_MIN_, name)); \
} while(0)
/* Macros to be used when performance is calculated using the cache compensated timer
will not assert if ccomp not supported */
#if SOC_CCOMP_TIMER_SUPPORTED
#define TEST_PERFORMANCE_CCOMP_GREATER_THAN(name, value_fmt, value) \
TEST_PERFORMANCE_GREATER_THAN(name, value_fmt, value)
#define TEST_PERFORMANCE_CCOMP_LESS_THAN(name, value_fmt, value) \
TEST_PERFORMANCE_LESS_THAN(name, value_fmt, value)
#else
#define TEST_PERFORMANCE_CCOMP_GREATER_THAN(name, value_fmt, value) \
printf("[Performance][" PERFORMANCE_STR(name) "]: "value_fmt"\n", value);
#define TEST_PERFORMANCE_CCOMP_LESS_THAN(name, value_fmt, value) \
printf("[Performance][" PERFORMANCE_STR(name) "]: "value_fmt"\n", value);
#endif //SOC_CCOMP_TIMER_SUPPORTED
/* @brief macro to print IDF performance
* @param mode : performance item name. a string pointer.
* @param value_fmt: print format and unit of the value, for example: "%02fms", "%dKB"