Kaynağa Gözat

Merge branch 'refactor/gpio_unit_case_ci_script' into 'master'

gpio: Improve unit test test-apps CI process

Closes IDF-5914

See merge request espressif/esp-idf!21595
Song Ruo Jing 3 yıl önce
ebeveyn
işleme
e68c9a6733

+ 0 - 3
components/driver/.build-test-rules.yml

@@ -51,9 +51,6 @@ components/driver/test_apps/legacy_mcpwm_driver:
 components/driver/test_apps/legacy_pcnt_driver:
   disable:
     - if: SOC_PCNT_SUPPORTED != 1
-    - if: IDF_TARGET == "esp32c6"
-      temporary: true
-      reason: test depends on ledc to be supported on esp32c6
 
 components/driver/test_apps/legacy_rmt_driver:
   disable:

+ 3 - 3
components/driver/test_apps/gpio/main/test_gpio.c

@@ -677,7 +677,7 @@ static void prompt_to_continue(const char *str)
 
 // This case needs the resistance to pull up the voltage or pull down the voltage
 // Ignored in CI because the voltage needs to be tested with multimeter
-TEST_CASE_CI_IGNORE("GPIO_verify_only_the_gpio_with_input_ability_can_be_set_pull/down", "[gpio]")
+TEST_CASE("GPIO_verify_only_the_gpio_with_input_ability_can_be_set_pull/down", "[gpio][ignore]")
 {
     gpio_config_t output_io = test_init_io(TEST_GPIO_EXT_OUT_IO);
     gpio_config_t input_io = test_init_io(TEST_GPIO_EXT_IN_IO);
@@ -768,7 +768,7 @@ static void drive_capability_set_get(gpio_num_t num, gpio_drive_cap_t capability
  *
  * all of these cases should be ignored that it will not run in CI
  */
-TEST_CASE_CI_IGNORE("GPIO_drive_capability_test", "[gpio]")
+TEST_CASE("GPIO_drive_capability_test", "[gpio][ignore]")
 {
     printf("weak capability test! please view the current change!\n");
     drive_capability_set_get(TEST_GPIO_EXT_OUT_IO, GPIO_DRIVE_CAP_0);
@@ -846,7 +846,7 @@ TEST_CASE("GPIO_USB_DP_pin_pullup_disable_test", "[gpio]")
 
 #if !TEMPORARY_DISABLED_FOR_TARGETS(ESP32C6) // TODO: IDF-5348 Remove when light sleep is supported on ESP32C6
 // Ignored in CI because it needs manually connect TEST_GPIO_INPUT_LEVEL_LOW_PIN to 3.3v to wake up from light sleep
-TEST_CASE_CI_IGNORE("GPIO_light_sleep_wake_up_test", "[gpio]")
+TEST_CASE("GPIO_light_sleep_wake_up_test", "[gpio][ignore]")
 {
     gpio_config_t io_config = test_init_io(TEST_GPIO_INPUT_LEVEL_LOW_PIN);
     io_config.mode = GPIO_MODE_INPUT;

+ 3 - 4
components/driver/test_apps/gpio/main/test_sigma_delta_legacy.c

@@ -28,7 +28,7 @@ TEST_CASE("SigmaDelta_config_test", "[sigma_delta]")
 
 // connect GPIO4 with LED positive pin, and the GND pin connect LED negative pin
 // logic analyzer help also to see the wave form(more standard and accurate)
-TEST_CASE("SigmaDelta_pin_duty_prescale_set", "[sigma_delta][ignore]")
+TEST_CASE("SigmaDelta_pin_duty_prescale_set", "[sigma_delta]")
 {
     sigmadelta_config_t sigmadelta_cfg = {
         .channel = 0,
@@ -40,7 +40,7 @@ TEST_CASE("SigmaDelta_pin_duty_prescale_set", "[sigma_delta][ignore]")
 
     int8_t duty = 0;
     int inc = 1;
-    for (int i = 0; i < 1000; i++) {
+    for (int i = 0; i < 100; i++) {
         sigmadelta_set_duty(sigmadelta_cfg.channel, duty);
         vTaskDelay(10 / portTICK_PERIOD_MS);
 
@@ -51,7 +51,7 @@ TEST_CASE("SigmaDelta_pin_duty_prescale_set", "[sigma_delta][ignore]")
     }
 
     TEST_ESP_OK(sigmadelta_set_prescale(0, 200));
-    for (int i = 0; i < 1000; i++) {
+    for (int i = 0; i < 100; i++) {
         sigmadelta_set_duty(sigmadelta_cfg.channel, duty);
         vTaskDelay(10 / portTICK_PERIOD_MS);
 
@@ -62,5 +62,4 @@ TEST_CASE("SigmaDelta_pin_duty_prescale_set", "[sigma_delta][ignore]")
     }
 
     TEST_ESP_OK(sigmadelta_set_pin(sigmadelta_cfg.channel, 5));
-    vTaskDelay(3000 / portTICK_PERIOD_MS);
 }

+ 51 - 10
components/driver/test_apps/gpio/pytest_gpio.py

@@ -2,17 +2,58 @@
 # SPDX-License-Identifier: CC0-1.0
 
 import pytest
+from pytest_embedded_idf import IdfDut
+
+CONFIGS = [
+    'iram_safe',
+    'release',
+]
 
 
 @pytest.mark.supported_targets
 @pytest.mark.generic
-@pytest.mark.parametrize(
-    'config',
-    [
-        'iram_safe',
-        'release',
-    ],
-    indirect=True,
-)
-def test_gpio(case_tester) -> None:  # type: ignore
-    case_tester.run_all_cases(timeout=300)
+@pytest.mark.parametrize('config', CONFIGS, indirect=True)
+def test_gpio(dut: IdfDut) -> None:
+    dut.run_all_single_board_cases(group='gpio')
+
+
+@pytest.mark.esp32c2
+@pytest.mark.esp32c3
+@pytest.mark.esp32c6
+@pytest.mark.esp32s2
+@pytest.mark.esp32s3
+@pytest.mark.generic
+@pytest.mark.parametrize('config', CONFIGS, indirect=True)
+def test_gpio_filter(dut: IdfDut) -> None:
+    dut.run_all_single_board_cases(group='gpio_filter')
+
+
+@pytest.mark.esp32c2
+@pytest.mark.esp32c3
+@pytest.mark.esp32c6
+@pytest.mark.esp32s2
+@pytest.mark.esp32s3
+@pytest.mark.generic
+@pytest.mark.parametrize('config', CONFIGS, indirect=True)
+def test_dedic_gpio(dut: IdfDut) -> None:
+    dut.run_all_single_board_cases(group='dedic_gpio')
+
+
+@pytest.mark.esp32
+@pytest.mark.esp32c3
+@pytest.mark.esp32c6
+@pytest.mark.esp32s2
+@pytest.mark.esp32s3
+@pytest.mark.generic
+@pytest.mark.parametrize('config', CONFIGS, indirect=True)
+def test_sigma_delta(dut: IdfDut) -> None:
+    dut.run_all_single_board_cases(group='sigma_delta')
+
+
+@pytest.mark.esp32
+@pytest.mark.esp32s2
+@pytest.mark.esp32s3
+@pytest.mark.generic
+@pytest.mark.parametrize('config', CONFIGS, indirect=True)
+def test_rtc_io(dut: IdfDut) -> None:
+    dut.run_all_single_board_cases(group='rtcio')

+ 2 - 2
components/driver/test_apps/legacy_pcnt_driver/README.md

@@ -1,2 +1,2 @@
-| Supported Targets | ESP32 | ESP32-S2 | ESP32-S3 |
-| ----------------- | ----- | -------- | -------- |
+| Supported Targets | ESP32 | ESP32-C6 | ESP32-S2 | ESP32-S3 |
+| ----------------- | ----- | -------- | -------- | -------- |

+ 1 - 0
components/driver/test_apps/legacy_pcnt_driver/pytest_legacy_pcnt.py

@@ -8,6 +8,7 @@ from pytest_embedded import Dut
 @pytest.mark.esp32
 @pytest.mark.esp32s2
 @pytest.mark.esp32s3
+@pytest.mark.esp32c6
 @pytest.mark.generic
 @pytest.mark.parametrize(
     'config',

+ 0 - 11
components/unity/include/unity_test_runner.h

@@ -149,17 +149,6 @@ void unity_testcase_register(test_desc_t* desc);
     }
 
 
-/*
-  Test case macro to be ignored in CI.
-  Tests will still be built (to check for compile error) but not linked if CONFIG_IDF_CI_BUILD.
- */
-#ifdef CONFIG_IDF_CI_BUILD
-#define TEST_CASE_CI_IGNORE(name_, desc_) \
-    __attribute__((unused)) static void UNITY_TEST_UID(test_func_) (void)
-#else
-#define TEST_CASE_CI_IGNORE(name_, desc_) TEST_CASE(name_, desc_)
-#endif
-
 /**
  * Note: initialization of test_desc_t fields above has to be done exactly
  * in the same order as the fields are declared in the structure.

+ 0 - 1
docs/docs_not_updated/esp32c6.txt

@@ -99,7 +99,6 @@ api-reference/peripherals/usb_device
 api-reference/peripherals/dac
 api-reference/peripherals/touch_element
 api-reference/peripherals/secure_element
-api-reference/peripherals/ledc
 api-reference/peripherals/sdio_slave
 api-reference/peripherals/clk_tree
 api-reference/peripherals/touch_pad