mirror of
https://github.com/espressif/esp-idf.git
synced 2024-09-19 14:26:01 -04:00
Merge branch 'fix/twai_add_std_runner' into 'master'
fix(twai): Add std runner using USB-CAN adapter See merge request espressif/esp-idf!27095
This commit is contained in:
commit
32e2101c0d
@ -926,6 +926,60 @@ pytest_components_esp32_psramv0:
|
||||
artifacts: false
|
||||
tags: [ esp32, psramv0 ]
|
||||
|
||||
pytest_components_esp32_twai_std:
|
||||
extends:
|
||||
- .pytest_components_dir_template
|
||||
- .rules:test:component_ut-esp32
|
||||
needs:
|
||||
- job: build_pytest_components_esp32
|
||||
artifacts: false
|
||||
tags: [ esp32, twai_std ]
|
||||
|
||||
pytest_components_esp32s2_twai_std:
|
||||
extends:
|
||||
- .pytest_components_dir_template
|
||||
- .rules:test:component_ut-esp32s2
|
||||
needs:
|
||||
- job: build_pytest_components_esp32s2
|
||||
artifacts: false
|
||||
tags: [ esp32s2, twai_std ]
|
||||
|
||||
pytest_components_esp32s3_twai_std:
|
||||
extends:
|
||||
- .pytest_components_dir_template
|
||||
- .rules:test:component_ut-esp32s3
|
||||
needs:
|
||||
- job: build_pytest_components_esp32s3
|
||||
artifacts: false
|
||||
tags: [ esp32s3, twai_std ]
|
||||
|
||||
pytest_components_esp32c3_twai_std:
|
||||
extends:
|
||||
- .pytest_components_dir_template
|
||||
- .rules:test:component_ut-esp32c3
|
||||
needs:
|
||||
- job: build_pytest_components_esp32c3
|
||||
artifacts: false
|
||||
tags: [ esp32c3, twai_std ]
|
||||
|
||||
pytest_components_esp32c6_twai_std:
|
||||
extends:
|
||||
- .pytest_components_dir_template
|
||||
- .rules:test:component_ut-esp32c6
|
||||
needs:
|
||||
- job: build_pytest_components_esp32c6
|
||||
artifacts: false
|
||||
tags: [ esp32c6, twai_std ]
|
||||
|
||||
pytest_components_esp32h2_twai_std:
|
||||
extends:
|
||||
- .pytest_components_dir_template
|
||||
- .rules:test:component_ut-esp32h2
|
||||
needs:
|
||||
- job: build_pytest_components_esp32h2
|
||||
artifacts: false
|
||||
tags: [ esp32h2, twai_std ]
|
||||
|
||||
pytest_components_esp32s2_generic:
|
||||
extends:
|
||||
- .pytest_components_dir_template
|
||||
|
@ -93,6 +93,10 @@ components/driver/test_apps/twai:
|
||||
- if: IDF_TARGET == "esp32p4"
|
||||
temporary: true
|
||||
reason: test not pass, should be re-enable # TODO: IDF-8966
|
||||
depends_filepatterns:
|
||||
- components/driver/twai/**/*
|
||||
depends_components:
|
||||
- esp_driver_gpio
|
||||
|
||||
components/driver/test_apps/usb_serial_jtag:
|
||||
disable:
|
||||
|
@ -27,7 +27,7 @@ TEST_CASE("twai_listen_only", "[twai]")
|
||||
{
|
||||
twai_timing_config_t t_config = TWAI_TIMING_CONFIG_250KBITS();
|
||||
twai_filter_config_t f_config = TWAI_FILTER_CONFIG_ACCEPT_ALL();
|
||||
twai_general_config_t g_config = TWAI_GENERAL_CONFIG_DEFAULT(0, 2, TWAI_MODE_LISTEN_ONLY);
|
||||
twai_general_config_t g_config = TWAI_GENERAL_CONFIG_DEFAULT(4, 5, TWAI_MODE_LISTEN_ONLY);
|
||||
#if CONFIG_TWAI_ISR_IN_IRAM
|
||||
g_config.intr_flags |= ESP_INTR_FLAG_IRAM;
|
||||
#endif
|
||||
@ -60,8 +60,10 @@ TEST_CASE("twai_remote_request", "[twai]")
|
||||
twai_handle_t bus_handle;
|
||||
twai_timing_config_t t_config = TWAI_TIMING_CONFIG_250KBITS();
|
||||
twai_filter_config_t f_config = TWAI_FILTER_CONFIG_ACCEPT_ALL();
|
||||
twai_general_config_t g_config = TWAI_GENERAL_CONFIG_DEFAULT(0, 2, TWAI_MODE_NORMAL);
|
||||
g_config.controller_id = 2;
|
||||
twai_general_config_t g_config = TWAI_GENERAL_CONFIG_DEFAULT(4, 5, TWAI_MODE_NORMAL);
|
||||
#if CONFIG_IDF_TARGET_ESP32C6
|
||||
g_config.controller_id = 1;
|
||||
#endif
|
||||
TEST_ESP_OK(twai_driver_install_v2(&g_config, &t_config, &f_config, &bus_handle));
|
||||
TEST_ESP_OK(twai_start_v2(bus_handle));
|
||||
|
||||
|
@ -2,6 +2,7 @@
|
||||
# SPDX-License-Identifier: CC0-1.0
|
||||
|
||||
import logging
|
||||
import subprocess
|
||||
from time import sleep
|
||||
|
||||
import pytest
|
||||
@ -29,10 +30,14 @@ def test_twai_self(dut: Dut) -> None:
|
||||
|
||||
@pytest.fixture(name='socket_can', scope='module')
|
||||
def fixture_create_socket_can() -> Bus:
|
||||
# See README.md for instructions on how to set up the socket CAN with the bitrate
|
||||
# Set up the socket CAN with the bitrate
|
||||
start_command = 'sudo ip link set can0 up type can bitrate 250000 restart-ms 100'
|
||||
stop_command = 'sudo ip link set can0 down'
|
||||
subprocess.run(start_command, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True)
|
||||
bus = Bus(interface='socketcan', channel='can0', bitrate=250000)
|
||||
yield bus
|
||||
yield bus # test invoked here
|
||||
bus.shutdown()
|
||||
subprocess.run(stop_command, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True)
|
||||
|
||||
|
||||
@pytest.mark.esp32
|
||||
@ -41,7 +46,7 @@ def fixture_create_socket_can() -> Bus:
|
||||
@pytest.mark.esp32h2
|
||||
@pytest.mark.esp32s2
|
||||
@pytest.mark.esp32s3
|
||||
@pytest.mark.skip(reason='Runner not set up yet')
|
||||
@pytest.mark.twai_std
|
||||
@pytest.mark.parametrize(
|
||||
'config',
|
||||
[
|
||||
@ -50,6 +55,7 @@ def fixture_create_socket_can() -> Bus:
|
||||
indirect=True,
|
||||
)
|
||||
def test_twai_listen_only(dut: Dut, socket_can: Bus) -> None:
|
||||
dut.serial.hard_reset()
|
||||
dut.expect_exact('Press ENTER to see the list of tests')
|
||||
|
||||
# TEST_CASE("twai_listen_only", "[twai]")
|
||||
@ -73,7 +79,7 @@ def test_twai_listen_only(dut: Dut, socket_can: Bus) -> None:
|
||||
@pytest.mark.esp32h2
|
||||
@pytest.mark.esp32s2
|
||||
@pytest.mark.esp32s3
|
||||
@pytest.mark.skip(reason='Runner not set up yet')
|
||||
@pytest.mark.twai_std
|
||||
@pytest.mark.parametrize(
|
||||
'config',
|
||||
[
|
||||
@ -82,6 +88,7 @@ def test_twai_listen_only(dut: Dut, socket_can: Bus) -> None:
|
||||
indirect=True,
|
||||
)
|
||||
def test_twai_remote_request(dut: Dut, socket_can: Bus) -> None:
|
||||
dut.serial.hard_reset()
|
||||
dut.expect_exact('Press ENTER to see the list of tests')
|
||||
|
||||
# TEST_CASE("twai_remote_request", "[twai]")
|
||||
|
@ -108,7 +108,8 @@ ENV_MARKERS = {
|
||||
'twai_network': 'multiple runners form a TWAI network.',
|
||||
'sdio_master_slave': 'Test sdio multi board, esp32+esp32',
|
||||
'sdio_multidev_32_c6': 'Test sdio multi board, esp32+esp32c6',
|
||||
'usj_device': 'Test usb_serial_jtag and usb_serial_jtag is used as serial only (not console)'
|
||||
'usj_device': 'Test usb_serial_jtag and usb_serial_jtag is used as serial only (not console)',
|
||||
'twai_std': 'twai runner with all twai supported targets connect to usb-can adapter'
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user