forked from espressif/esp-modbus
cpp test explicitly check the controller stop method
This commit is contained in:
@@ -116,10 +116,13 @@ extern "C" void app_main(void)
|
|||||||
// Initialization of device peripheral and objects
|
// Initialization of device peripheral and objects
|
||||||
ESP_LOGI(TAG, "Setup master cpp....");
|
ESP_LOGI(TAG, "Setup master cpp....");
|
||||||
ESP_ERROR_CHECK(master_serial_init(&pmaster_handle));
|
ESP_ERROR_CHECK(master_serial_init(&pmaster_handle));
|
||||||
|
ESP_ERROR_CHECK(mbc_master_stop(pmaster_handle));
|
||||||
ESP_ERROR_CHECK(mbc_master_delete(pmaster_handle));
|
ESP_ERROR_CHECK(mbc_master_delete(pmaster_handle));
|
||||||
ESP_LOGI(TAG, "Master test passed successfully.");
|
ESP_LOGI(TAG, "Master test passed successfully.");
|
||||||
ESP_LOGI(TAG, "Setup slave cpp....");
|
ESP_LOGI(TAG, "Setup slave cpp....");
|
||||||
ESP_ERROR_CHECK(slave_serial_init(&pslave_handle));
|
ESP_ERROR_CHECK(slave_serial_init(&pslave_handle));
|
||||||
|
// explicitly check stop method before delete
|
||||||
|
ESP_ERROR_CHECK(mbc_slave_stop(pslave_handle));
|
||||||
ESP_ERROR_CHECK(mbc_slave_delete(pslave_handle));
|
ESP_ERROR_CHECK(mbc_slave_delete(pslave_handle));
|
||||||
ESP_LOGI(TAG, "Slave test passed successfully.");
|
ESP_LOGI(TAG, "Slave test passed successfully.");
|
||||||
}
|
}
|
||||||
|
@@ -3,13 +3,15 @@
|
|||||||
import pytest
|
import pytest
|
||||||
from pytest_embedded import Dut
|
from pytest_embedded import Dut
|
||||||
|
|
||||||
|
MB_APP_WAIT_TOUT_SEC = 10
|
||||||
|
|
||||||
@pytest.mark.esp32
|
@pytest.mark.esp32
|
||||||
@pytest.mark.generic
|
@pytest.mark.generic
|
||||||
def test_cpp_mb_serial_master_slave(dut: Dut) -> None:
|
def test_cpp_mb_serial_master_slave(dut: Dut) -> None:
|
||||||
dut.expect('Setup master cpp....')
|
dut.expect('Setup master cpp....')
|
||||||
dut.expect('Modbus master stack initialized...', timeout=5)
|
dut.expect('Modbus master stack initialized...', timeout=MB_APP_WAIT_TOUT_SEC)
|
||||||
dut.expect('Master test passed successfully.', timeout=5)
|
dut.expect('Master test passed successfully.', timeout=MB_APP_WAIT_TOUT_SEC)
|
||||||
dut.expect('Setup slave cpp....')
|
dut.expect('Setup slave cpp....')
|
||||||
dut.expect('Modbus slave stack initialized...', timeout=5)
|
dut.expect('Modbus slave stack initialized...', timeout=MB_APP_WAIT_TOUT_SEC)
|
||||||
dut.expect('Slave test passed successfully.', timeout=5)
|
dut.expect('Slave test passed successfully.', timeout=MB_APP_WAIT_TOUT_SEC)
|
||||||
dut.expect('Returned from app_main()')
|
dut.expect('Returned from app_main()')
|
||||||
|
Reference in New Issue
Block a user