]> 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)
committerbot <bot@espressif.com>
Tue, 25 Jun 2019 04:33:32 +0000 (04:33 +0000)
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 191745b780d078ae1282bd3060c295f97205f027..d0a50037cf6739e6d622d2e499545f398c6ae744 100644 (file)
@@ -1491,6 +1491,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
@@ -1516,6 +1522,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
@@ -1541,6 +1553,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
@@ -1566,6 +1584,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
@@ -1591,6 +1615,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
@@ -1669,6 +1699,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
@@ -1694,6 +1730,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
@@ -1719,6 +1761,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
@@ -1744,6 +1792,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
@@ -1773,9 +1827,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
@@ -1788,6 +1848,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 6c54f5b01223298bb2e8db6ea26a25469cd00a46..d2542c0624e724c83244f0ba76141e70b67017cf 100644 (file)
@@ -909,6 +909,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 4072b65b43baa61001351b7bf07aa17b9c5daf61..7fd94d5a0b9765cfb847dced88038294d8b4e540 100644 (file)
@@ -213,14 +213,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__)
@@ -247,14 +258,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 7703b11753645764b30dc1657bfb46856481f47c..59be39eddefc64222e7bfce8a201ada012389a2d 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