unit-test-app: freertos_compliance config added

Signed-off-by: Sachin Parekh <sachin.parekh@espressif.com>
This commit is contained in:
Sachin Parekh 2019-03-25 16:15:02 +05:30 committed by bot
parent 92f1d7ae39
commit ae1389afd9
6 changed files with 142 additions and 18 deletions

View file

@ -1491,6 +1491,12 @@ UT_006_03:
- UT_T1_GPIO - UT_T1_GPIO
UT_006_04: UT_006_04:
<<: *unit_test_template
tags:
- ESP32_IDF
- UT_T1_GPIO
UT_006_05:
<<: *unit_test_template <<: *unit_test_template
tags: tags:
- ESP32_IDF - ESP32_IDF
@ -1516,6 +1522,12 @@ UT_007_03:
- UT_T1_PCNT - UT_T1_PCNT
UT_007_04: UT_007_04:
<<: *unit_test_template
tags:
- ESP32_IDF
- UT_T1_PCNT
UT_007_05:
<<: *unit_test_template <<: *unit_test_template
tags: tags:
- ESP32_IDF - ESP32_IDF
@ -1541,6 +1553,12 @@ UT_008_03:
- UT_T1_LEDC - UT_T1_LEDC
UT_008_04: UT_008_04:
<<: *unit_test_template
tags:
- ESP32_IDF
- UT_T1_LEDC
UT_008_05:
<<: *unit_test_template <<: *unit_test_template
tags: tags:
- ESP32_IDF - ESP32_IDF
@ -1566,6 +1584,12 @@ UT_009_03:
- UT_T2_RS485 - UT_T2_RS485
UT_009_04: UT_009_04:
<<: *unit_test_template
tags:
- ESP32_IDF
- UT_T2_RS485
UT_009_05:
<<: *unit_test_template <<: *unit_test_template
tags: tags:
- ESP32_IDF - ESP32_IDF
@ -1591,6 +1615,12 @@ UT_010_03:
- UT_T1_RMT - UT_T1_RMT
UT_010_04: UT_010_04:
<<: *unit_test_template
tags:
- ESP32_IDF
- UT_T1_RMT
UT_010_05:
<<: *unit_test_template <<: *unit_test_template
tags: tags:
- ESP32_IDF - ESP32_IDF
@ -1669,6 +1699,12 @@ UT_013_03:
- Example_SPI_Multi_device - Example_SPI_Multi_device
UT_013_04: UT_013_04:
<<: *unit_test_template
tags:
- ESP32_IDF
- Example_SPI_Multi_device
UT_013_05:
<<: *unit_test_template <<: *unit_test_template
tags: tags:
- ESP32_IDF - ESP32_IDF
@ -1694,6 +1730,12 @@ UT_014_03:
- UT_T2_I2C - UT_T2_I2C
UT_014_04: UT_014_04:
<<: *unit_test_template
tags:
- ESP32_IDF
- UT_T2_I2C
UT_014_05:
<<: *unit_test_template <<: *unit_test_template
tags: tags:
- ESP32_IDF - ESP32_IDF
@ -1719,6 +1761,12 @@ UT_015_03:
- UT_T1_MCPWM - UT_T1_MCPWM
UT_015_04: UT_015_04:
<<: *unit_test_template
tags:
- ESP32_IDF
- UT_T1_MCPWM
UT_015_05:
<<: *unit_test_template <<: *unit_test_template
tags: tags:
- ESP32_IDF - ESP32_IDF
@ -1744,6 +1792,12 @@ UT_016_03:
- UT_T1_I2S - UT_T1_I2S
UT_016_04: UT_016_04:
<<: *unit_test_template
tags:
- ESP32_IDF
- UT_T1_I2S
UT_016_05:
<<: *unit_test_template <<: *unit_test_template
tags: tags:
- ESP32_IDF - ESP32_IDF
@ -1773,9 +1827,15 @@ UT_017_04:
tags: tags:
- ESP32_IDF - ESP32_IDF
- UT_T2_1 - UT_T2_1
- psram
UT_017_05: UT_017_05:
<<: *unit_test_template
tags:
- ESP32_IDF
- UT_T2_1
- psram
UT_017_06:
<<: *unit_test_template <<: *unit_test_template
tags: tags:
- ESP32_IDF - ESP32_IDF
@ -1788,6 +1848,42 @@ UT_601_01:
- ESP32_IDF - ESP32_IDF
- UT_T1_1 - UT_T1_1
UT_601_02:
<<: *unit_test_template
tags:
- ESP32_IDF
- UT_T1_1
UT_601_03:
<<: *unit_test_template
tags:
- ESP32_IDF
- UT_T1_1
UT_601_04:
<<: *unit_test_template
tags:
- ESP32_IDF
- UT_T1_1
UT_601_05:
<<: *unit_test_template
tags:
- ESP32_IDF
- UT_T1_1
UT_601_06:
<<: *unit_test_template
tags:
- ESP32_IDF
- UT_T1_1
UT_601_07:
<<: *unit_test_template
tags:
- ESP32_IDF
- UT_T1_1
IT_001_01: IT_001_01:
<<: *test_template <<: *test_template
tags: tags:

View file

@ -909,6 +909,9 @@ static IRAM_ATTR void spi_transmit_polling_measure(spi_device_handle_t spi, spi_
TEST_CASE("spi_speed","[spi]") TEST_CASE("spi_speed","[spi]")
{ {
#ifdef CONFIG_FREERTOS_CHECK_PORT_CRITICAL_COMPLIANCE
return;
#endif
uint32_t t_flight; uint32_t t_flight;
//to get rid of the influence of randomly interrupts, we measured the performance by median value //to get rid of the influence of randomly interrupts, we measured the performance by median value
uint32_t t_flight_sorted[TEST_TIMES]; uint32_t t_flight_sorted[TEST_TIMES];

View file

@ -430,7 +430,8 @@ menu "FreeRTOS"
bool "Tests compliance with Vanilla FreeRTOS port*_CRITICAL calls" bool "Tests compliance with Vanilla FreeRTOS port*_CRITICAL calls"
default n default n
help help
If enabled, context of port*_CRITICAL calls (ISR or Non-ISR) would be checked to be in compliance with Vanilla FreeRTOS. If enabled, context of port*_CRITICAL calls (ISR or Non-ISR)
would be checked to be in compliance with Vanilla FreeRTOS.
e.g Calling port*_CRITICAL from ISR context would cause assert failure e.g Calling port*_CRITICAL from ISR context would cause assert failure
endmenu endmenu

View file

@ -213,14 +213,25 @@ void vTaskExitCritical( portMUX_TYPE *mux, const char *function, int line );
#ifdef CONFIG_FREERTOS_CHECK_PORT_CRITICAL_COMPLIANCE #ifdef CONFIG_FREERTOS_CHECK_PORT_CRITICAL_COMPLIANCE
/* Calling port*_CRITICAL from ISR context would cause an assert failure. /* Calling port*_CRITICAL from ISR context would cause an assert failure.
* If the parent function is called from both ISR and Non-ISR context then call port*_CRITICAL_SAFE * If the parent function is called from both ISR and Non-ISR context then call port*_CRITICAL_SAFE
**/ */
#define portENTER_CRITICAL(mux) do { \ #define portENTER_CRITICAL(mux) do { \
configASSERT(!xPortInIsrContext()); \ if(!xPortInIsrContext()) { \
vTaskEnterCritical(mux, __FUNCTION__, __LINE__); \ vTaskEnterCritical(mux, __FUNCTION__, __LINE__); \
} else { \
ets_printf("%s:%d (%s)- port*_CRITICAL called from ISR context!\n", __FILE__, __LINE__, \
__FUNCTION__); \
abort(); \
} \
} while(0) } while(0)
#define portEXIT_CRITICAL(mux) do { \
configASSERT(!xPortInIsrContext()); \ #define portEXIT_CRITICAL(mux) do { \
vTaskExitCritical(mux, __FUNCTION__, __LINE__); \ if(!xPortInIsrContext()) { \
vTaskExitCritical(mux, __FUNCTION__, __LINE__); \
} else { \
ets_printf("%s:%d (%s)- port*_CRITICAL called from ISR context!\n", __FILE__, __LINE__, \
__FUNCTION__); \
abort(); \
} \
} while(0) } while(0)
#else #else
#define portENTER_CRITICAL(mux) vTaskEnterCritical(mux, __FUNCTION__, __LINE__) #define portENTER_CRITICAL(mux) vTaskEnterCritical(mux, __FUNCTION__, __LINE__)
@ -247,14 +258,25 @@ void vPortCPUReleaseMutex(portMUX_TYPE *mux);
#ifdef CONFIG_FREERTOS_CHECK_PORT_CRITICAL_COMPLIANCE #ifdef CONFIG_FREERTOS_CHECK_PORT_CRITICAL_COMPLIANCE
/* Calling port*_CRITICAL from ISR context would cause an assert failure. /* Calling port*_CRITICAL from ISR context would cause an assert failure.
* If the parent function is called from both ISR and Non-ISR context then call port*_CRITICAL_SAFE * If the parent function is called from both ISR and Non-ISR context then call port*_CRITICAL_SAFE
**/ */
#define portENTER_CRITICAL(mux) do { \ #define portENTER_CRITICAL(mux) do { \
configASSERT(!xPortInIsrContext()); \ if(!xPortInIsrContext()) { \
vTaskEnterCritical(mux); \ vTaskEnterCritical(mux); \
} else { \
ets_printf("%s:%d (%s)- port*_CRITICAL called from ISR context!\n", __FILE__, __LINE__, \
__FUNCTION__); \
abort(); \
} \
} while(0) } while(0)
#define portEXIT_CRITICAL(mux) do { \
configASSERT(!xPortInIsrContext()); \ #define portEXIT_CRITICAL(mux) do { \
vTaskExitCritical(mux); \ if(!xPortInIsrContext()) { \
vTaskExitCritical(mux); \
} else { \
ets_printf("%s:%d (%s)- port*_CRITICAL called from ISR context!\n", __FILE__, __LINE__, \
__FUNCTION__); \
abort(); \
} \
} while(0) } while(0)
#else #else
#define portENTER_CRITICAL(mux) vTaskEnterCritical(mux) #define portENTER_CRITICAL(mux) vTaskEnterCritical(mux)

View file

@ -40,8 +40,8 @@ TEST_CASE("portMUX spinlocks (no contention)", "[freertos]")
BENCHMARK_START(); BENCHMARK_START();
for (int i = 0; i < REPEAT_OPS; i++) { for (int i = 0; i < REPEAT_OPS; i++) {
portENTER_CRITICAL(&mux); portENTER_CRITICAL_ISR(&mux);
portEXIT_CRITICAL(&mux); portEXIT_CRITICAL_ISR(&mux);
} }
BENCHMARK_END("no contention lock"); BENCHMARK_END("no contention lock");

View file

@ -0,0 +1,2 @@
TEST_COMPONENTS=driver esp32 spi_flash
CONFIG_FREERTOS_CHECK_PORT_CRITICAL_COMPLIANCE=y