From df7a27e36da14c478df79ee8584520a0bbe9e7f6 Mon Sep 17 00:00:00 2001 From: Cao Sen Miao Date: Tue, 16 May 2023 16:42:28 +0800 Subject: [PATCH] CI: Move all UT in driver to test_app --- .gitlab/ci/target-test.yml | 13 -- components/driver/i2c/i2c.c | 2 + components/driver/test/CMakeLists.txt | 6 - .../test/include/test/test_adc_dac_dma.h | 57 --------- .../test/include/test/test_common_adc.h | 26 ---- .../driver/test_apps/i2c/CMakeLists.txt | 22 ++++ components/driver/test_apps/i2c/README.md | 2 + .../driver/test_apps/i2c/main/CMakeLists.txt | 6 + .../driver/test_apps/i2c/main/test_app_main.c | 42 ++++++ .../{test => test_apps/i2c/main}/test_i2c.c | 121 ++++++------------ components/driver/test_apps/i2c/pytest_i2c.py | 39 ++++++ .../test_apps/i2c/sdkconfig.ci.defaults | 2 + .../test_apps/i2c/sdkconfig.ci.iram_safe | 5 + .../driver/test_apps/i2c/sdkconfig.ci.release | 6 +- .../driver/test_apps/i2c/sdkconfig.defaults | 2 + components/hal/esp32/include/hal/i2c_ll.h | 5 + components/hal/esp32c2/include/hal/i2c_ll.h | 4 + components/hal/esp32c3/include/hal/i2c_ll.h | 4 + components/hal/esp32c6/include/hal/i2c_ll.h | 6 +- components/hal/esp32h2/include/hal/i2c_ll.h | 4 + components/hal/esp32s2/include/hal/i2c_ll.h | 4 + components/hal/esp32s3/include/hal/i2c_ll.h | 4 + tools/unit-test-app/configs/default | 4 - tools/unit-test-app/configs/default_32_2 | 2 +- tools/unit-test-app/configs/default_3_c3 | 2 +- tools/unit-test-app/configs/default_c2 | 2 +- tools/unit-test-app/configs/default_c3 | 3 - tools/unit-test-app/configs/default_c6 | 2 +- tools/unit-test-app/configs/default_h2 | 2 +- tools/unit-test-app/configs/default_s2_1 | 3 - tools/unit-test-app/configs/default_s2_2 | 2 +- tools/unit-test-app/configs/default_s3 | 2 +- .../unit-test-app/configs/freertos_compliance | 2 +- .../configs/freertos_compliance_c2 | 2 +- .../configs/freertos_compliance_c3 | 2 +- .../configs/freertos_compliance_c6 | 2 +- .../configs/freertos_compliance_h2 | 2 +- .../configs/freertos_compliance_s2 | 2 +- tools/unit-test-app/configs/freertos_flash | 2 +- tools/unit-test-app/configs/psram_3 | 2 +- tools/unit-test-app/configs/psram_all_ext_1 | 8 -- tools/unit-test-app/configs/psram_all_ext_2 | 2 +- tools/unit-test-app/configs/release_c2 | 2 +- tools/unit-test-app/configs/release_c3_2 | 2 +- tools/unit-test-app/configs/release_c6 | 2 +- tools/unit-test-app/configs/release_h2 | 2 +- tools/unit-test-app/configs/release_s2 | 2 +- tools/unit-test-app/configs/release_s3 | 2 +- tools/unit-test-app/configs/single_core | 2 +- tools/unit-test-app/configs/single_core_s2 | 2 +- .../unit-test-app/disabled_configs/psram_2_s2 | 2 +- 51 files changed, 219 insertions(+), 231 deletions(-) delete mode 100644 components/driver/test/CMakeLists.txt delete mode 100644 components/driver/test/include/test/test_adc_dac_dma.h delete mode 100644 components/driver/test/include/test/test_common_adc.h create mode 100644 components/driver/test_apps/i2c/CMakeLists.txt create mode 100644 components/driver/test_apps/i2c/README.md create mode 100644 components/driver/test_apps/i2c/main/CMakeLists.txt create mode 100644 components/driver/test_apps/i2c/main/test_app_main.c rename components/driver/{test => test_apps/i2c/main}/test_i2c.c (86%) create mode 100644 components/driver/test_apps/i2c/pytest_i2c.py create mode 100644 components/driver/test_apps/i2c/sdkconfig.ci.defaults create mode 100644 components/driver/test_apps/i2c/sdkconfig.ci.iram_safe rename tools/unit-test-app/configs/release_c3 => components/driver/test_apps/i2c/sdkconfig.ci.release (70%) create mode 100644 components/driver/test_apps/i2c/sdkconfig.defaults delete mode 100644 tools/unit-test-app/configs/default delete mode 100644 tools/unit-test-app/configs/default_c3 delete mode 100644 tools/unit-test-app/configs/default_s2_1 delete mode 100644 tools/unit-test-app/configs/psram_all_ext_1 diff --git a/.gitlab/ci/target-test.yml b/.gitlab/ci/target-test.yml index 43d92bab0c..4e5ccfaed1 100644 --- a/.gitlab/ci/target-test.yml +++ b/.gitlab/ci/target-test.yml @@ -1229,13 +1229,6 @@ UT_006: - ESP32_IDF - EMMC -UT_022: - extends: .unit_test_esp32_template - tags: - - ESP32_IDF - - UT_T2_I2C - - psram - UT_028: extends: .unit_test_esp32_template tags: @@ -1308,12 +1301,6 @@ UT_C3_FLASH: - ESP32C3_IDF - UT_T1_ESP_FLASH -UT_C3_I2C: - extends: .unit_test_esp32c3_template - tags: - - ESP32C3_IDF - - UT_T2_I2C - UT_C3_SDSPI: extends: - .unit_test_esp32c3_template diff --git a/components/driver/i2c/i2c.c b/components/driver/i2c/i2c.c index 127a67f124..27ed666d18 100644 --- a/components/driver/i2c/i2c.c +++ b/components/driver/i2c/i2c.c @@ -27,6 +27,7 @@ #include "esp_rom_sys.h" #include #include "soc/clk_tree_defs.h" + #if SOC_I2C_SUPPORT_APB || SOC_I2C_SUPPORT_XTAL #include "esp_private/esp_clk.h" #endif @@ -1343,6 +1344,7 @@ esp_err_t i2c_master_read(i2c_cmd_handle_t cmd_handle, uint8_t *data, size_t dat return ret; } +__attribute__((always_inline)) static inline bool i2c_cmd_is_single_byte(const i2c_cmd_t *cmd) { return cmd->total_bytes == 1; } diff --git a/components/driver/test/CMakeLists.txt b/components/driver/test/CMakeLists.txt deleted file mode 100644 index 2f45c2e841..0000000000 --- a/components/driver/test/CMakeLists.txt +++ /dev/null @@ -1,6 +0,0 @@ -idf_component_register( - SRC_DIRS . - PRIV_INCLUDE_DIRS include - PRIV_REQUIRES test_utils driver nvs_flash esp_timer esp_event test_driver_utils esp_serial_slave_link -) -target_compile_options(${COMPONENT_LIB} PRIVATE "-Wno-format") diff --git a/components/driver/test/include/test/test_adc_dac_dma.h b/components/driver/test/include/test/test_adc_dac_dma.h deleted file mode 100644 index 778b6779ec..0000000000 --- a/components/driver/test/include/test/test_adc_dac_dma.h +++ /dev/null @@ -1,57 +0,0 @@ -/* - * SPDX-FileCopyrightText: 2015-2021 Espressif Systems (Shanghai) CO LTD - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#pragma once - -/* Common header for ESP32-S2 ADC/DAC tests */ - -/** - * SPI DMA type. - */ -typedef enum { - DMA_ONLY_ADC_INLINK = BIT(1), /*!