From b331cd4ccf05b0516f280f43d17ec211599c7516 Mon Sep 17 00:00:00 2001 From: aleks Date: Thu, 27 Feb 2025 11:28:19 +0100 Subject: [PATCH] cpp test explicitly check the controller stop method --- .../cpp/modbus_serial_cpp_test/main/serial_test.cpp | 3 +++ .../pytest_cpp_mb_serial_master_slave.py | 10 ++++++---- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/test_apps/cpp/modbus_serial_cpp_test/main/serial_test.cpp b/test_apps/cpp/modbus_serial_cpp_test/main/serial_test.cpp index bc162ba..4623a8c 100644 --- a/test_apps/cpp/modbus_serial_cpp_test/main/serial_test.cpp +++ b/test_apps/cpp/modbus_serial_cpp_test/main/serial_test.cpp @@ -116,10 +116,13 @@ extern "C" void app_main(void) // Initialization of device peripheral and objects ESP_LOGI(TAG, "Setup master cpp...."); 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_LOGI(TAG, "Master test passed successfully."); ESP_LOGI(TAG, "Setup slave cpp...."); 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_LOGI(TAG, "Slave test passed successfully."); } diff --git a/test_apps/cpp/modbus_serial_cpp_test/pytest_cpp_mb_serial_master_slave.py b/test_apps/cpp/modbus_serial_cpp_test/pytest_cpp_mb_serial_master_slave.py index eb13ca8..38cdbaa 100644 --- a/test_apps/cpp/modbus_serial_cpp_test/pytest_cpp_mb_serial_master_slave.py +++ b/test_apps/cpp/modbus_serial_cpp_test/pytest_cpp_mb_serial_master_slave.py @@ -3,13 +3,15 @@ import pytest from pytest_embedded import Dut +MB_APP_WAIT_TOUT_SEC = 10 + @pytest.mark.esp32 @pytest.mark.generic def test_cpp_mb_serial_master_slave(dut: Dut) -> None: dut.expect('Setup master cpp....') - dut.expect('Modbus master stack initialized...', timeout=5) - dut.expect('Master test passed successfully.', timeout=5) + dut.expect('Modbus master stack initialized...', timeout=MB_APP_WAIT_TOUT_SEC) + dut.expect('Master test passed successfully.', timeout=MB_APP_WAIT_TOUT_SEC) dut.expect('Setup slave cpp....') - dut.expect('Modbus slave stack initialized...', timeout=5) - dut.expect('Slave test passed successfully.', timeout=5) + dut.expect('Modbus slave stack initialized...', timeout=MB_APP_WAIT_TOUT_SEC) + dut.expect('Slave test passed successfully.', timeout=MB_APP_WAIT_TOUT_SEC) dut.expect('Returned from app_main()')