gpio: combine sdm, glitch filter, fast gpio tests into one app

This commit is contained in:
morris
2022-12-21 21:31:03 +08:00
parent ca1b182b25
commit d5b4108085
17 changed files with 80 additions and 83 deletions

View File

@@ -76,10 +76,6 @@ components/driver/test_apps/sdio:
temporary: true temporary: true
reason: Not supported. reason: Not supported.
components/driver/test_apps/sdm:
disable:
- if: SOC_SDM_SUPPORTED != 1
components/driver/test_apps/temperature_sensor: components/driver/test_apps/temperature_sensor:
disable: disable:
- if: SOC_TEMP_SENSOR_SUPPORTED != 1 - if: SOC_TEMP_SENSOR_SUPPORTED != 1

View File

@@ -1,14 +1,6 @@
set(srcs "test_app_main.c" set(srcs "test_app_main.c"
"test_gpio.c") "test_gpio.c")
if(CONFIG_SOC_GPIO_SUPPORT_PIN_GLITCH_FILTER OR (CONFIG_SOC_GPIO_FLEX_GLITCH_FILTER_NUM GREATER 0))
list(APPEND srcs "test_gpio_filter.c")
endif()
if(CONFIG_SOC_DEDICATED_GPIO_SUPPORTED)
list(APPEND srcs "test_dedicated_gpio.c")
endif()
if(CONFIG_SOC_SDM_SUPPORTED) if(CONFIG_SOC_SDM_SUPPORTED)
list(APPEND srcs "test_sigma_delta_legacy.c") list(APPEND srcs "test_sigma_delta_legacy.c")
endif() endif()

View File

@@ -17,28 +17,6 @@ def test_gpio(dut: IdfDut) -> None:
dut.run_all_single_board_cases(group='gpio') 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.esp32
@pytest.mark.esp32c3 @pytest.mark.esp32c3
@pytest.mark.esp32c6 @pytest.mark.esp32c6
@@ -46,7 +24,7 @@ def test_dedic_gpio(dut: IdfDut) -> None:
@pytest.mark.esp32s3 @pytest.mark.esp32s3
@pytest.mark.generic @pytest.mark.generic
@pytest.mark.parametrize('config', CONFIGS, indirect=True) @pytest.mark.parametrize('config', CONFIGS, indirect=True)
def test_sigma_delta(dut: IdfDut) -> None: def test_legacy_sigma_delta(dut: IdfDut) -> None:
dut.run_all_single_board_cases(group='sigma_delta') dut.run_all_single_board_cases(group='sigma_delta')

View File

@@ -2,13 +2,13 @@
cmake_minimum_required(VERSION 3.16) cmake_minimum_required(VERSION 3.16)
include($ENV{IDF_PATH}/tools/cmake/project.cmake) include($ENV{IDF_PATH}/tools/cmake/project.cmake)
project(sdm_test) project(gpio_extension_test)
if(CONFIG_COMPILER_DUMP_RTL_FILES) if(CONFIG_COMPILER_DUMP_RTL_FILES)
add_custom_target(check_test_app_sections ALL add_custom_target(check_test_app_sections ALL
COMMAND ${PYTHON} $ENV{IDF_PATH}/tools/ci/check_callgraph.py COMMAND ${PYTHON} $ENV{IDF_PATH}/tools/ci/check_callgraph.py
--rtl-dir ${CMAKE_BINARY_DIR}/esp-idf/driver/ --rtl-dir ${CMAKE_BINARY_DIR}/esp-idf/driver/
--elf-file ${CMAKE_BINARY_DIR}/sdm_test.elf --elf-file ${CMAKE_BINARY_DIR}/gpio_extension_test.elf
find-refs find-refs
--from-sections=.iram0.text --from-sections=.iram0.text
--to-sections=.flash.text,.flash.rodata --to-sections=.flash.text,.flash.rodata

View File

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

View File

@@ -0,0 +1,18 @@
set(srcs "test_app_main.c")
if(CONFIG_SOC_DEDICATED_GPIO_SUPPORTED)
list(APPEND srcs "test_dedicated_gpio.c")
endif()
if(CONFIG_SOC_GPIO_SUPPORT_PIN_GLITCH_FILTER OR (CONFIG_SOC_GPIO_FLEX_GLITCH_FILTER_NUM GREATER 0))
list(APPEND srcs "test_gpio_filter.c")
endif()
if(CONFIG_SOC_SDM_SUPPORTED)
list(APPEND srcs "test_sdm.c")
endif()
# In order for the cases defined by `TEST_CASE` to be linked into the final elf,
# the component can be registered as WHOLE_ARCHIVE
idf_component_register(SRCS ${srcs}
WHOLE_ARCHIVE)

View File

@@ -8,8 +8,8 @@
#include "unity_test_runner.h" #include "unity_test_runner.h"
#include "esp_heap_caps.h" #include "esp_heap_caps.h"
// Some resources are lazy allocated in pulse_cnt driver, the threshold is left for that case // Some resources are lazy allocated in the driver, the threshold is left for that case
#define TEST_MEMORY_LEAK_THRESHOLD (-200) #define TEST_MEMORY_LEAK_THRESHOLD (-300)
static size_t before_free_8bit; static size_t before_free_8bit;
static size_t before_free_32bit; static size_t before_free_32bit;
@@ -38,14 +38,14 @@ void tearDown(void)
void app_main(void) void app_main(void)
{ {
// ____ ____ ___ ___ _____ _ _____ _ // ____ ____ ___ ___ _____ _ _____ _
// / ___| _ \_ _/ _ \ / ___|| _ \| \/ | // / ___| _ \_ _/ _ \ | ____|_ _| |_ |_ _|__ ___| |_
// | | _| |_) | | | | | \___ \| | | | |\/| | // | | _| |_) | | | | | | _| \ \/ / __| | |/ _ \/ __| __|
// | |_| | __/| | |_| | ___) | |_| | | | | // | |_| | __/| | |_| | | |___ > <| |_ | | __/\__ \ |_
// \____|_| |___\___/ |____/|____/|_| |_| // \____|_| |___\___/ |_____/_/\_\\__| |_|\___||___/\__|
printf(" ____ ____ ___ ___ _____ _ _____ _\r\n"); printf(" ____ ____ ___ ___ _____ _ _____ _\r\n");
printf(" / ___| _ \\_ _/ _ \\ / ___|| _ \\| \\/ |\r\n"); printf(" / ___| _ \\_ _/ _ \\ | ____|_ _| |_ |_ _|__ ___| |_\r\n");
printf("| | _| |_) | | | | | \\___ \\| | | | |\\/| |\r\n"); printf("| | _| |_) | | | | | | _| \\ \\/ / __| | |/ _ \\/ __| __|\r\n");
printf("| |_| | __/| | |_| | ___) | |_| | | | |\r\n"); printf("| |_| | __/| | |_| | | |___ > <| |_ | | __/\\__ \\ |_\r\n");
printf(" \\____|_| |___\\___/ |____/|____/|_| |_|\r\n"); printf(" \\____|_| |___\\___/ |_____/_/\\_\\\\__| |_|\\___||___/\\__|\r\n");
unity_run_menu(); unity_run_menu();
} }

View File

@@ -0,0 +1,43 @@
# SPDX-FileCopyrightText: 2022 Espressif Systems (Shanghai) CO LTD
# SPDX-License-Identifier: CC0-1.0
import pytest
from pytest_embedded_idf import IdfDut
CONFIGS = [
'iram_safe',
'release',
]
@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_sdm(dut: IdfDut) -> None:
dut.run_all_single_board_cases(group='sdm')
@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')

View File

@@ -5,3 +5,5 @@ CONFIG_COMPILER_OPTIMIZATION_NONE=y
CONFIG_FREERTOS_PLACE_FUNCTIONS_INTO_FLASH=y CONFIG_FREERTOS_PLACE_FUNCTIONS_INTO_FLASH=y
# silent the error check, as the error string are stored in rodata, causing RTL check failure # silent the error check, as the error string are stored in rodata, causing RTL check failure
CONFIG_COMPILER_OPTIMIZATION_CHECKS_SILENT=y CONFIG_COMPILER_OPTIMIZATION_CHECKS_SILENT=y
# GPIO test uses IPC call, the default stack size of IPC task can satisfy the -O0 optimization
CONFIG_ESP_IPC_TASK_STACK_SIZE=2048

View File

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

View File

@@ -1,7 +0,0 @@
set(srcs "test_app_main.c"
"test_sdm.c")
# In order for the cases defined by `TEST_CASE` to be linked into the final elf,
# the component can be registered as WHOLE_ARCHIVE
idf_component_register(SRCS ${srcs}
WHOLE_ARCHIVE)

View File

@@ -1,25 +0,0 @@
# SPDX-FileCopyrightText: 2022 Espressif Systems (Shanghai) CO LTD
# SPDX-License-Identifier: CC0-1.0
import pytest
from pytest_embedded import Dut
@pytest.mark.esp32
@pytest.mark.esp32s2
@pytest.mark.esp32s3
@pytest.mark.esp32c3
@pytest.mark.esp32c6
@pytest.mark.generic
@pytest.mark.parametrize(
'config',
[
'iram_safe',
'release',
],
indirect=True,
)
def test_sdm(dut: Dut) -> None:
dut.expect_exact('Press ENTER to see the list of tests')
dut.write('*')
dut.expect_unity_test_output()