mirror of
https://github.com/espressif/esp-idf.git
synced 2024-09-20 00:36:01 -04:00
test: move rs485 test to test_app
This commit is contained in:
parent
fb7d8f49be
commit
76ddc2b8a7
@ -346,6 +346,14 @@ component_ut_pytest_esp32_flash_multi:
|
|||||||
- build_pytest_components_esp32
|
- build_pytest_components_esp32
|
||||||
tags: [ esp32, flash_mutli ]
|
tags: [ esp32, flash_mutli ]
|
||||||
|
|
||||||
|
component_ut_pytest_esp32_rs485_multi:
|
||||||
|
extends:
|
||||||
|
- .pytest_components_dir_template
|
||||||
|
- .rules:test:component_ut-esp32
|
||||||
|
needs:
|
||||||
|
- build_pytest_components_esp32
|
||||||
|
tags: [ esp32, multi_dut_modbus_rs485 ]
|
||||||
|
|
||||||
component_ut_pytest_esp32s2_generic:
|
component_ut_pytest_esp32s2_generic:
|
||||||
extends:
|
extends:
|
||||||
- .pytest_components_dir_template
|
- .pytest_components_dir_template
|
||||||
@ -962,13 +970,6 @@ UT_006:
|
|||||||
- UT_T1_SPIMODE
|
- UT_T1_SPIMODE
|
||||||
- psram
|
- psram
|
||||||
|
|
||||||
UT_014:
|
|
||||||
extends: .unit_test_esp32_template
|
|
||||||
tags:
|
|
||||||
- ESP32_IDF
|
|
||||||
- UT_T2_RS485
|
|
||||||
- psram
|
|
||||||
|
|
||||||
UT_017:
|
UT_017:
|
||||||
extends: .unit_test_esp32_template
|
extends: .unit_test_esp32_template
|
||||||
tags:
|
tags:
|
||||||
|
@ -57,6 +57,12 @@ components/driver/test_apps/rmt:
|
|||||||
disable:
|
disable:
|
||||||
- if: SOC_RMT_SUPPORTED != 1
|
- if: SOC_RMT_SUPPORTED != 1
|
||||||
|
|
||||||
|
components/driver/test_apps/rs485:
|
||||||
|
disable_test:
|
||||||
|
- if: IDF_TARGET != "esp32"
|
||||||
|
temporary: true
|
||||||
|
reason: lack of runners
|
||||||
|
|
||||||
components/driver/test_apps/sdm:
|
components/driver/test_apps/sdm:
|
||||||
disable:
|
disable:
|
||||||
- if: SOC_SDM_SUPPORTED != 1
|
- if: SOC_SDM_SUPPORTED != 1
|
||||||
|
7
components/driver/test_apps/rs485/CMakeLists.txt
Normal file
7
components/driver/test_apps/rs485/CMakeLists.txt
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
# This is the project CMakeLists.txt file for the test subproject
|
||||||
|
cmake_minimum_required(VERSION 3.16)
|
||||||
|
|
||||||
|
set(EXTRA_COMPONENT_DIRS "$ENV{IDF_PATH}/tools/unit-test-app/components")
|
||||||
|
|
||||||
|
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
|
||||||
|
project(rs485_test)
|
2
components/driver/test_apps/rs485/README.md
Normal file
2
components/driver/test_apps/rs485/README.md
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
| Supported Targets | ESP32 | ESP32-C2 | ESP32-C3 | ESP32-C6 | ESP32-S2 | ESP32-S3 |
|
||||||
|
| ----------------- | ----- | -------- | -------- | -------- | -------- | -------- |
|
7
components/driver/test_apps/rs485/main/CMakeLists.txt
Normal file
7
components/driver/test_apps/rs485/main/CMakeLists.txt
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
# 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 "test_app_main.c" "test_rs485.c"
|
||||||
|
REQUIRES driver unity test_utils
|
||||||
|
WHOLE_ARCHIVE
|
||||||
|
)
|
49
components/driver/test_apps/rs485/main/test_app_main.c
Normal file
49
components/driver/test_apps/rs485/main/test_app_main.c
Normal file
@ -0,0 +1,49 @@
|
|||||||
|
/*
|
||||||
|
* SPDX-FileCopyrightText: 2022 Espressif Systems (Shanghai) CO LTD
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "unity.h"
|
||||||
|
#include "unity_test_utils.h"
|
||||||
|
#include "esp_heap_caps.h"
|
||||||
|
#include "freertos/FreeRTOS.h"
|
||||||
|
#include "freertos/task.h"
|
||||||
|
|
||||||
|
#define TEST_MEMORY_LEAK_THRESHOLD (200)
|
||||||
|
|
||||||
|
static size_t before_free_8bit;
|
||||||
|
static size_t before_free_32bit;
|
||||||
|
|
||||||
|
|
||||||
|
void setUp(void)
|
||||||
|
{
|
||||||
|
before_free_8bit = heap_caps_get_free_size(MALLOC_CAP_8BIT);
|
||||||
|
before_free_32bit = heap_caps_get_free_size(MALLOC_CAP_32BIT);
|
||||||
|
}
|
||||||
|
|
||||||
|
void tearDown(void)
|
||||||
|
{
|
||||||
|
size_t after_free_8bit = heap_caps_get_free_size(MALLOC_CAP_8BIT);
|
||||||
|
size_t after_free_32bit = heap_caps_get_free_size(MALLOC_CAP_32BIT);
|
||||||
|
printf("\n");
|
||||||
|
unity_utils_check_leak(before_free_8bit, after_free_8bit, "8BIT", TEST_MEMORY_LEAK_THRESHOLD);
|
||||||
|
unity_utils_check_leak(before_free_32bit, after_free_32bit, "32BIT", TEST_MEMORY_LEAK_THRESHOLD);
|
||||||
|
}
|
||||||
|
|
||||||
|
void app_main(void)
|
||||||
|
{
|
||||||
|
// _____ _ ____ ____ _ _ ___ ____
|
||||||
|
// |_ _|__ ___| |_ | _ \/ ___|| || | ( o ) ___|
|
||||||
|
// | |/ _ \/ __| __| | |_) \___ \| || |_ / _ \__ `.
|
||||||
|
// | | __/\__ \ |_ | _ < ___) |__ _| (_) |__) |
|
||||||
|
// |_|\___||___/\__| |_| \_\____/ |_| \___/____/
|
||||||
|
printf("\n");
|
||||||
|
printf(" _____ _ ____ ____ _ _ ___ ____\n");
|
||||||
|
printf(" |_ _|__ ___| |_ | _ \\/ ___|| || | ( o ) ___|\n");
|
||||||
|
printf(" | |/ _ \\/ __| __| | |_) \\___ \\| || |_ / _ \\__ `.\n");
|
||||||
|
printf(" | | __/\\__ \\ |_ | _ < ___) |__ _| (_) |__) |\n");
|
||||||
|
printf(" |_|\\___||___/\\__| |_| \\_\\____/ |_| \\___/____/\n");
|
||||||
|
|
||||||
|
unity_run_menu();
|
||||||
|
}
|
@ -32,9 +32,6 @@
|
|||||||
#define TEST_ALLOW_PROC_FAIL (10)
|
#define TEST_ALLOW_PROC_FAIL (10)
|
||||||
#define TEST_CHECK_PROC_FAIL(fails, threshold) TEST_ASSERT((fails * 100 / PACKETS_NUMBER) <= threshold)
|
#define TEST_CHECK_PROC_FAIL(fails, threshold) TEST_ASSERT((fails * 100 / PACKETS_NUMBER) <= threshold)
|
||||||
|
|
||||||
#if !TEMPORARY_DISABLED_FOR_TARGETS(ESP32S2, ESP32S3, ESP32C3, ESP32C2, ESP32H4)
|
|
||||||
//No runners
|
|
||||||
|
|
||||||
static const char *TAG = "rs485_test";
|
static const char *TAG = "rs485_test";
|
||||||
|
|
||||||
// The table for fast CRC16 calculation
|
// The table for fast CRC16 calculation
|
||||||
@ -291,6 +288,4 @@ static void rs485_master(void)
|
|||||||
* correctness of RS485 interface channel communication. It requires
|
* correctness of RS485 interface channel communication. It requires
|
||||||
* RS485 bus driver hardware to be connected to boards.
|
* RS485 bus driver hardware to be connected to boards.
|
||||||
*/
|
*/
|
||||||
TEST_CASE_MULTIPLE_DEVICES("RS485 half duplex uart multiple devices test.", "[driver_RS485][test_env=UT_T2_RS485]", rs485_master, rs485_slave);
|
TEST_CASE_MULTIPLE_DEVICES("RS485 half duplex uart multiple devices test.", "[RS485][test_env=UT_T2_RS485]", rs485_master, rs485_slave);
|
||||||
|
|
||||||
#endif //!TEMPORARY_DISABLED_FOR_TARGETS(..)
|
|
11
components/driver/test_apps/rs485/pytest_rs485.py
Normal file
11
components/driver/test_apps/rs485/pytest_rs485.py
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
# SPDX-FileCopyrightText: 2021-2022 Espressif Systems (Shanghai) CO LTD
|
||||||
|
# SPDX-License-Identifier: CC0-1.0
|
||||||
|
|
||||||
|
import pytest
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.esp32
|
||||||
|
@pytest.mark.multi_dut_modbus_rs485
|
||||||
|
@pytest.mark.parametrize('count, config', [(2, 'release',)], indirect=True)
|
||||||
|
def test_rs485_multi_dev(case_tester) -> None: # type: ignore
|
||||||
|
case_tester.run_all_multi_dev_cases(reset=True)
|
5
components/driver/test_apps/rs485/sdkconfig.ci.release
Normal file
5
components/driver/test_apps/rs485/sdkconfig.ci.release
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
CONFIG_PM_ENABLE=y
|
||||||
|
CONFIG_FREERTOS_USE_TICKLESS_IDLE=y
|
||||||
|
CONFIG_COMPILER_OPTIMIZATION_SIZE=y
|
||||||
|
CONFIG_BOOTLOADER_COMPILER_OPTIMIZATION_SIZE=y
|
||||||
|
CONFIG_COMPILER_OPTIMIZATION_ASSERTIONS_SILENT=y
|
2
components/driver/test_apps/rs485/sdkconfig.defaults
Normal file
2
components/driver/test_apps/rs485/sdkconfig.defaults
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
CONFIG_FREERTOS_HZ=1000
|
||||||
|
CONFIG_ESP_TASK_WDT=n
|
@ -67,6 +67,7 @@ markers =
|
|||||||
MSPI_F4R4: runner with Quad Flash and Quad PSRAM
|
MSPI_F4R4: runner with Quad Flash and Quad PSRAM
|
||||||
test_jtag_arm: runner where the chip is accessible through JTAG as well
|
test_jtag_arm: runner where the chip is accessible through JTAG as well
|
||||||
adc: ADC related tests should run on adc runners
|
adc: ADC related tests should run on adc runners
|
||||||
|
multi_dut_modbus_rs485: a pair of runners connectd by RS485 bus
|
||||||
|
|
||||||
# multi-dut markers
|
# multi-dut markers
|
||||||
ieee802154: ieee802154 related tests should run on ieee802154 runners.
|
ieee802154: ieee802154 related tests should run on ieee802154 runners.
|
||||||
|
Loading…
Reference in New Issue
Block a user