]> granicus.if.org Git - esp-idf/commitdiff
unit-test-app: freertos_compliance config added
authorSachin Parekh <sachin.parekh@espressif.com>
Mon, 25 Mar 2019 10:45:02 +0000 (16:15 +0530)
committerSachin Parekh <sachin.parekh@espressif.com>
Mon, 13 May 2019 11:09:19 +0000 (16:39 +0530)
Signed-off-by: Sachin Parekh <sachin.parekh@espressif.com>
.gitlab-ci.yml
components/driver/test/test_spi_master.c
components/freertos/Kconfig
components/freertos/include/freertos/portmacro.h
components/freertos/test/test_spinlocks.c
tools/unit-test-app/configs/freertos_compliance [new file with mode: 0644]

index b8b642114667f2f65ed5b8302e659f2822bdbc4b..48a9624ef39e8e0da51b54eecd02240a0cf2bbfc 100644 (file)
@@ -1668,6 +1668,12 @@ UT_006_03:
     - UT_T1_GPIO
 
 UT_006_04:
+  <<: *unit_test_template
+  tags:
+    - ESP32_IDF
+    - UT_T1_GPIO
+
+UT_006_05:
   <<: *unit_test_template
   tags:
     - ESP32_IDF
@@ -1693,6 +1699,12 @@ UT_007_03:
     - UT_T1_PCNT
 
 UT_007_04:
+  <<: *unit_test_template
+  tags:
+    - ESP32_IDF
+    - UT_T1_PCNT
+
+UT_007_05:
   <<: *unit_test_template
   tags:
     - ESP32_IDF
@@ -1718,6 +1730,12 @@ UT_008_03:
     - UT_T1_LEDC
 
 UT_008_04:
+  <<: *unit_test_template
+  tags:
+    - ESP32_IDF
+    - UT_T1_LEDC
+
+UT_008_05:
   <<: *unit_test_template
   tags:
     - ESP32_IDF
@@ -1743,6 +1761,12 @@ UT_009_03:
     - UT_T2_RS485
 
 UT_009_04:
+  <<: *unit_test_template
+  tags:
+    - ESP32_IDF
+    - UT_T2_RS485
+
+UT_009_05:
   <<: *unit_test_template
   tags:
     - ESP32_IDF
@@ -1768,6 +1792,12 @@ UT_010_03:
     - UT_T1_RMT
 
 UT_010_04:
+  <<: *unit_test_template
+  tags:
+    - ESP32_IDF
+    - UT_T1_RMT
+
+UT_010_05:
   <<: *unit_test_template
   tags:
     - ESP32_IDF
@@ -1846,6 +1876,12 @@ UT_013_03:
     - Example_SPI_Multi_device
 
 UT_013_04:
+  <<: *unit_test_template
+  tags:
+    - ESP32_IDF
+    - Example_SPI_Multi_device
+
+UT_013_05:
   <<: *unit_test_template
   tags:
     - ESP32_IDF
@@ -1871,6 +1907,12 @@ UT_014_03:
     - UT_T2_I2C
 
 UT_014_04:
+  <<: *unit_test_template
+  tags:
+    - ESP32_IDF
+    - UT_T2_I2C
+
+UT_014_05:
   <<: *unit_test_template
   tags:
     - ESP32_IDF
@@ -1896,6 +1938,12 @@ UT_015_03:
     - UT_T1_MCPWM
 
 UT_015_04:
+  <<: *unit_test_template
+  tags:
+    - ESP32_IDF
+    - UT_T1_MCPWM
+
+UT_015_05:
   <<: *unit_test_template
   tags:
     - ESP32_IDF
@@ -1921,6 +1969,12 @@ UT_016_03:
     - UT_T1_I2S
 
 UT_016_04:
+  <<: *unit_test_template
+  tags:
+    - ESP32_IDF
+    - UT_T1_I2S
+
+UT_016_05:
   <<: *unit_test_template
   tags:
     - ESP32_IDF
@@ -1950,9 +2004,15 @@ UT_017_04:
   tags:
     - ESP32_IDF
     - UT_T2_1
-    - psram
 
 UT_017_05:
+  <<: *unit_test_template
+  tags:
+    - ESP32_IDF
+    - UT_T2_1
+    - psram
+
+UT_017_06:
   <<: *unit_test_template
   tags:
     - ESP32_IDF
@@ -1977,6 +2037,42 @@ UT_601_01:
     - ESP32_IDF
     - 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:
   <<: *test_template
   tags:
index 5b69689107fd6cfd896b30670fa72ee35b81b947..ef34f978f8511cdb0d63548a7e71910ef0f1e387 100644 (file)
@@ -992,6 +992,9 @@ static IRAM_ATTR void spi_transmit_polling_measure(spi_device_handle_t spi, spi_
 
 TEST_CASE("spi_speed","[spi]")
 {
+#ifdef CONFIG_FREERTOS_CHECK_PORT_CRITICAL_COMPLIANCE
+    return;
+#endif
     uint32_t t_flight;
     //to get rid of the influence of randomly interrupts, we measured the performance by median value
     uint32_t t_flight_sorted[TEST_TIMES];
index 7eeec02b93a4d70a4fd8b0350d8b798b14992190..777ca7b604296be0fc8d17941b67ab2654b3494d 100644 (file)
@@ -430,7 +430,8 @@ menu "FreeRTOS"
         bool "Tests compliance with Vanilla FreeRTOS port*_CRITICAL calls"
         default n
         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
 
 endmenu
index 88da1c0c0e3e747673698683e65f9baffcbf1468..183d38a4dc0c744359bbf8ebc152db73c34f9970 100644 (file)
@@ -220,14 +220,25 @@ void vTaskExitCritical( portMUX_TYPE *mux, const char *function, int line );
 #ifdef CONFIG_FREERTOS_CHECK_PORT_CRITICAL_COMPLIANCE
 /* 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
- **/
-#define portENTER_CRITICAL(mux)        do {                                             \
-                                       configASSERT(!xPortInIsrContext());              \
-                                       vTaskEnterCritical(mux, __FUNCTION__, __LINE__); \
+ */
+#define portENTER_CRITICAL(mux)        do {                                                                                             \
+                                            if(!xPortInIsrContext()) {                                                                  \
+                                                vTaskEnterCritical(mux, __FUNCTION__, __LINE__);                                        \
+                                            } else {                                                                                    \
+                                                ets_printf("%s:%d (%s)- port*_CRITICAL called from ISR context!\n", __FILE__, __LINE__, \
+                                                           __FUNCTION__);                                                               \
+                                                abort();                                                                                \
+                                            }                                                                                           \
                                        } while(0)
-#define portEXIT_CRITICAL(mux)         do {                                             \
-                                       configASSERT(!xPortInIsrContext());              \
-                                       vTaskExitCritical(mux, __FUNCTION__, __LINE__);  \
+
+#define portEXIT_CRITICAL(mux)        do {                                                                                              \
+                                            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)
 #else
 #define portENTER_CRITICAL(mux)        vTaskEnterCritical(mux, __FUNCTION__, __LINE__)
@@ -254,14 +265,25 @@ void vPortCPUReleaseMutex(portMUX_TYPE *mux);
 #ifdef CONFIG_FREERTOS_CHECK_PORT_CRITICAL_COMPLIANCE
 /* 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
- **/
-#define portENTER_CRITICAL(mux)        do {                                            \
-                                       configASSERT(!xPortInIsrContext());             \
-                                       vTaskEnterCritical(mux);                        \
+ */
+#define portENTER_CRITICAL(mux)        do {                                                                                             \
+                                            if(!xPortInIsrContext()) {                                                                  \
+                                                vTaskEnterCritical(mux);                                                                \
+                                            } else {                                                                                    \
+                                                ets_printf("%s:%d (%s)- port*_CRITICAL called from ISR context!\n", __FILE__, __LINE__, \
+                                                           __FUNCTION__);                                                               \
+                                                abort();                                                                                \
+                                            }                                                                                           \
                                        } while(0)
-#define portEXIT_CRITICAL(mux)         do {                                            \
-                                       configASSERT(!xPortInIsrContext());             \
-                                       vTaskExitCritical(mux);                         \
+
+#define portEXIT_CRITICAL(mux)        do {                                                                                              \
+                                            if(!xPortInIsrContext()) {                                                                  \
+                                                vTaskExitCritical(mux);                                                                 \
+                                            } else {                                                                                    \
+                                                ets_printf("%s:%d (%s)- port*_CRITICAL called from ISR context!\n", __FILE__, __LINE__, \
+                                                           __FUNCTION__);                                                               \
+                                                abort();                                                                                \
+                                            }                                                                                           \
                                        } while(0)
 #else
 #define portENTER_CRITICAL(mux)        vTaskEnterCritical(mux)
index f64ca26047996906dcfa8e234ebc3009664c972d..c6fb6bcf08e0a57bb1efd2761f56a09191ab0f2f 100644 (file)
@@ -40,8 +40,8 @@ TEST_CASE("portMUX spinlocks (no contention)", "[freertos]")
     BENCHMARK_START();
 
     for (int i = 0; i < REPEAT_OPS; i++) {
-        portENTER_CRITICAL(&mux);
-        portEXIT_CRITICAL(&mux);
+        portENTER_CRITICAL_ISR(&mux);
+        portEXIT_CRITICAL_ISR(&mux);
     }
     BENCHMARK_END("no contention lock");
 
diff --git a/tools/unit-test-app/configs/freertos_compliance b/tools/unit-test-app/configs/freertos_compliance
new file mode 100644 (file)
index 0000000..2d7a620
--- /dev/null
@@ -0,0 +1,2 @@
+TEST_COMPONENTS=driver esp32 spi_flash
+CONFIG_FREERTOS_CHECK_PORT_CRITICAL_COMPLIANCE=y