fix(driver_twai): test script update

This commit is contained in:
wanckl
2026-03-18 15:46:44 +08:00
parent 9bcddb55c6
commit d757aa02f4
3 changed files with 5 additions and 13 deletions
@@ -4,5 +4,5 @@
# Enable Socket CAN Device with bitrate 250Kbps
```bash
sudo ip link set can0 up type can bitrate 250000 restart-ms 100
sudo ip link set can0 up type can bitrate 250000
```
@@ -54,7 +54,7 @@ def esp_reset_and_wait_ready(dut: Dut) -> None:
@pytest.fixture(name='socket_can')
def fixture_create_socket_can() -> Bus:
# Set up the socket CAN with the bitrate
start_command = 'sudo -n ip link set can0 up type can bitrate 250000 restart-ms 100'
start_command = 'sudo -n ip link set can0 up type can bitrate 250000'
stop_command = 'sudo -n ip link set can0 down'
status_command = 'sudo -n ip -details link show can0'
@@ -47,16 +47,10 @@ def esp_enter_flash_mode(dut: Dut) -> None:
ser.setDTR(False) # Back RTS/DTR to 1/1 to avoid affect to esptool
def esp_reset_and_wait_ready(dut: Dut) -> None:
dut.serial.hard_reset()
time.sleep(0.5)
dut.expect_exact('Press ENTER to see the list of tests')
@pytest.fixture(name='socket_can')
def fixture_create_socket_can() -> Bus:
# Set up the socket CAN with the bitrate
start_command = 'sudo -n ip link set can0 up type can bitrate 250000 restart-ms 100'
start_command = 'sudo -n ip link set can0 up type can bitrate 250000'
stop_command = 'sudo -n ip link set can0 down'
status_command = 'sudo -n ip -details link show can0'
@@ -88,8 +82,7 @@ def fixture_create_socket_can() -> Bus:
@pytest.mark.parametrize('config', ['release'], indirect=True)
@idf_parametrize('target', soc_filtered_targets('SOC_TWAI_SUPPORTED == 1'), indirect=['target'])
def test_driver_twai_listen_only(dut: Dut, socket_can: Bus) -> None:
esp_reset_and_wait_ready(dut)
dut.expect_exact('Press ENTER to see the list of tests')
dut.write('"twai_listen_only"')
# wait the DUT to finish initialize
@@ -110,8 +103,7 @@ def test_driver_twai_listen_only(dut: Dut, socket_can: Bus) -> None:
@pytest.mark.parametrize('config', ['release'], indirect=True)
@idf_parametrize('target', soc_filtered_targets('SOC_TWAI_SUPPORTED == 1'), indirect=['target'])
def test_driver_twai_remote_request(dut: Dut, socket_can: Bus) -> None:
esp_reset_and_wait_ready(dut)
dut.expect_exact('Press ENTER to see the list of tests')
dut.write('"twai_remote_request"')
print('Waiting remote frame ...')