From 9575f03b8d48cfe529575559cbf7753c9e403cd3 Mon Sep 17 00:00:00 2001 From: Chen Yudong Date: Sun, 3 Jul 2022 19:44:00 +0800 Subject: [PATCH] CI: fix ip address checker and trace log --- .../esp_local_ctrl/pytest_esp_local_ctrl.py | 2 +- .../https_request/pytest_https_request.py | 18 ++--- .../mqtt/ssl/mqtt_ssl_example_test.py | 2 +- .../mqtt/tcp/mqtt_tcp_example_test.py | 6 +- .../protocols/mqtt/ws/mqtt_ws_example_test.py | 2 +- .../mqtt/wss/mqtt_wss_example_test.py | 2 +- .../advanced_https_ota/pytest_advanced_ota.py | 75 +++++++++---------- .../native_ota_example/pytest_native_ota.py | 30 ++++---- .../pytest_pre_encrypted_ota.py | 6 +- .../simple_ota_example/pytest_simple_ota.py | 38 +++++----- 10 files changed, 90 insertions(+), 91 deletions(-) diff --git a/examples/protocols/esp_local_ctrl/pytest_esp_local_ctrl.py b/examples/protocols/esp_local_ctrl/pytest_esp_local_ctrl.py index 33d050a536..b32a80326e 100644 --- a/examples/protocols/esp_local_ctrl/pytest_esp_local_ctrl.py +++ b/examples/protocols/esp_local_ctrl/pytest_esp_local_ctrl.py @@ -45,7 +45,7 @@ def test_examples_esp_local_ctrl(dut: Dut) -> None: rel_project_path = os.path.join('examples', 'protocols', 'esp_local_ctrl') idf_path = get_sdk_path() - dut_ip = dut.expect(r'esp_netif_handlers: sta ip: (\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})')[1].decode() + dut_ip = dut.expect(r'IPv4 address: (\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})')[1].decode() dut.expect('esp_https_server: Starting server') dut.expect('esp_https_server: Server listening on port 443') dut.expect('control: esp_local_ctrl service started with name : my_esp_ctrl_device') diff --git a/examples/protocols/https_request/pytest_https_request.py b/examples/protocols/https_request/pytest_https_request.py index 6f3bc42b17..635506365d 100644 --- a/examples/protocols/https_request/pytest_https_request.py +++ b/examples/protocols/https_request/pytest_https_request.py @@ -98,10 +98,10 @@ def test_examples_protocol_https_request_cli_session_tickets(dut: Dut) -> None: dut.expect('Loaded app from partition at offset', timeout=30) try: - ip_address = dut.expect(r' (sta|eth) ip: (\d+\.\d+\.\d+\.\d+)', timeout=60)[2].decode() - print('Connected to AP with IP: {}'.format(ip_address)) + ip_address = dut.expect(r'IPv4 address: (\d+\.\d+\.\d+\.\d+)', timeout=60)[2].decode() + print('Connected to AP/Ethernet with IP: {}'.format(ip_address)) except pexpect.exceptions.TIMEOUT: - raise ValueError('ENV_TEST_FAILURE: Cannot connect to AP') + raise ValueError('ENV_TEST_FAILURE: Cannot connect to AP/Ethernet') dut.expect('Start https_request example', timeout=30) @@ -150,10 +150,10 @@ def test_examples_protocol_https_request_dynamic_buffers(dut: Dut) -> None: dut.expect('Loaded app from partition at offset', timeout=30) try: - ip_address = dut.expect(r' (sta|eth) ip: (\d+\.\d+\.\d+\.\d+)', timeout=60)[2].decode() - print('Connected to AP with IP: {}'.format(ip_address)) + ip_address = dut.expect(r'IPv4 address: (\d+\.\d+\.\d+\.\d+)', timeout=60)[1].decode() + print('Connected to AP/Ethernet with IP: {}'.format(ip_address)) except pexpect.exceptions.TIMEOUT: - raise ValueError('ENV_TEST_FAILURE: Cannot connect to AP') + raise ValueError('ENV_TEST_FAILURE: Cannot connect to AP/Ethernet') # only check if one connection is established logging.info("Testing for \"https_request using crt bundle\" with mbedtls dynamic resource enabled") @@ -188,10 +188,10 @@ def test_examples_protocol_https_request(dut: Dut) -> None: dut.expect('Loaded app from partition at offset', timeout=30) try: - ip_address = dut.expect(r' (sta|eth) ip: (\d+\.\d+\.\d+\.\d+)', timeout=60)[2].decode() - print('Connected to AP with IP: {}'.format(ip_address)) + ip_address = dut.expect(r'IPv4 address: (\d+\.\d+\.\d+\.\d+)', timeout=60)[1].decode() + print('Connected to AP/Ethernet with IP: {}'.format(ip_address)) except pexpect.exceptions.TIMEOUT: - raise ValueError('ENV_TEST_FAILURE: Cannot connect to AP') + raise ValueError('ENV_TEST_FAILURE: Cannot connect to AP/Ethernet') # Check for connection using crt bundle logging.info("Testing for \"https_request using crt bundle\"") diff --git a/examples/protocols/mqtt/ssl/mqtt_ssl_example_test.py b/examples/protocols/mqtt/ssl/mqtt_ssl_example_test.py index 79705413d6..dc879d184a 100644 --- a/examples/protocols/mqtt/ssl/mqtt_ssl_example_test.py +++ b/examples/protocols/mqtt/ssl/mqtt_ssl_example_test.py @@ -110,7 +110,7 @@ def test_examples_protocol_mqtt_ssl(env, extra_data): raise ValueError('ENV_TEST_FAILURE: Test script cannot connect to broker: {}'.format(broker_url)) dut1.start_app() try: - ip_address = dut1.expect(re.compile(r' eth ip: ([^,]+),'), timeout=30) + ip_address = dut1.expect(re.compile(r'IPv4 address: ([^,]+),'), timeout=30) print('Connected to AP with IP: {}'.format(ip_address)) except DUT.ExpectTimeout: print('ENV_TEST_FAILURE: Cannot connect to AP') diff --git a/examples/protocols/mqtt/tcp/mqtt_tcp_example_test.py b/examples/protocols/mqtt/tcp/mqtt_tcp_example_test.py index acf78ed442..35a719a566 100644 --- a/examples/protocols/mqtt/tcp/mqtt_tcp_example_test.py +++ b/examples/protocols/mqtt/tcp/mqtt_tcp_example_test.py @@ -76,10 +76,10 @@ def test_examples_protocol_mqtt_qos1(env, extra_data): dut1.start_app() # waiting for getting the IP address try: - ip_address = dut1.expect(re.compile(r' (sta|eth) ip: ([^,]+),'), timeout=30) - print('Connected to AP with IP: {}'.format(ip_address)) + ip_address = dut1.expect(re.compile(r'IPv4 address: ([^,]+),'), timeout=30) + print('Connected to AP/Ethernet with IP: {}'.format(ip_address)) except DUT.ExpectTimeout: - raise ValueError('ENV_TEST_FAILURE: Cannot connect to AP') + raise ValueError('ENV_TEST_FAILURE: Cannot connect to AP/Ethernet') print('writing to device: {}'.format('mqtt://' + host_ip + '\n')) dut1.write('mqtt://' + host_ip + '\n') diff --git a/examples/protocols/mqtt/ws/mqtt_ws_example_test.py b/examples/protocols/mqtt/ws/mqtt_ws_example_test.py index 60da603585..b4fc2fa38d 100644 --- a/examples/protocols/mqtt/ws/mqtt_ws_example_test.py +++ b/examples/protocols/mqtt/ws/mqtt_ws_example_test.py @@ -83,7 +83,7 @@ def test_examples_protocol_mqtt_ws(env, extra_data): raise ValueError('ENV_TEST_FAILURE: Test script cannot connect to broker: {}'.format(broker_url)) dut1.start_app() try: - ip_address = dut1.expect(re.compile(r' eth ip: ([^,]+),'), timeout=30) + ip_address = dut1.expect(re.compile(r'IPv4 address: ([^,]+),'), timeout=30) print('Connected to AP with IP: {}'.format(ip_address)) except DUT.ExpectTimeout: print('ENV_TEST_FAILURE: Cannot connect to AP') diff --git a/examples/protocols/mqtt/wss/mqtt_wss_example_test.py b/examples/protocols/mqtt/wss/mqtt_wss_example_test.py index a7825e82b8..b00a154741 100644 --- a/examples/protocols/mqtt/wss/mqtt_wss_example_test.py +++ b/examples/protocols/mqtt/wss/mqtt_wss_example_test.py @@ -87,7 +87,7 @@ def test_examples_protocol_mqtt_wss(env, extra_data): raise ValueError('ENV_TEST_FAILURE: Test script cannot connect to broker: {}'.format(broker_url)) dut1.start_app() try: - ip_address = dut1.expect(re.compile(r' eth ip: ([^,]+),'), timeout=30) + ip_address = dut1.expect(re.compile(r'IPv4 address: ([^,]+),'), timeout=30) print('Connected to AP with IP: {}'.format(ip_address)) except DUT.ExpectTimeout: print('ENV_TEST_FAILURE: Cannot connect to AP') diff --git a/examples/system/ota/advanced_https_ota/pytest_advanced_ota.py b/examples/system/ota/advanced_https_ota/pytest_advanced_ota.py index 8fdd2c8d00..52d019229c 100644 --- a/examples/system/ota/advanced_https_ota/pytest_advanced_ota.py +++ b/examples/system/ota/advanced_https_ota/pytest_advanced_ota.py @@ -125,13 +125,13 @@ def test_examples_protocol_advanced_https_ota_example(dut: Dut) -> None: thread1.daemon = True thread1.start() for i in range(iterations): - dut.expect('Loaded app from partition at offset', timeout=60) + dut.expect('Loaded app from partition at offset', timeout=30) try: - ip_address = dut.expect(r' (sta|eth) ip: ([^,]+),', timeout=30) - print('Connected to AP with IP: {}'.format(ip_address)) + ip_address = dut.expect(r'IPv4 address: ([^,]+),', timeout=30) + print('Connected to AP/Ethernet with IP: {}'.format(ip_address)) except pexpect.exceptions.TIMEOUT: thread1.terminate() - raise ValueError('ENV_TEST_FAILURE: Cannot connect to AP') + raise ValueError('ENV_TEST_FAILURE: Cannot connect to AP/Ethernet') dut.expect('Starting Advanced OTA example', timeout=30) print('writing to device: {}'.format('https://' + host_ip + ':' + str(server_port) + '/' + bin_name)) @@ -177,11 +177,11 @@ def test_examples_protocol_advanced_https_ota_example_truncated_bin(dut: Dut) -> thread1.start() dut.expect('Loaded app from partition at offset', timeout=30) try: - ip_address = dut.expect(r' (sta|eth) ip: ([^,]+),', timeout=30) - print('Connected to AP with IP: {}'.format(ip_address)) + ip_address = dut.expect(r'IPv4 address: ([^,]+),', timeout=30) + print('Connected to AP/Ethernet with IP: {}'.format(ip_address)) except pexpect.exceptions.TIMEOUT: thread1.terminate() - raise ValueError('ENV_TEST_FAILURE: Cannot connect to AP') + raise ValueError('ENV_TEST_FAILURE: Cannot connect to AP/Ethernet') dut.expect('Starting Advanced OTA example', timeout=30) print('writing to device: {}'.format('https://' + host_ip + ':' + str(server_port) + '/' + truncated_bin_name)) @@ -232,11 +232,11 @@ def test_examples_protocol_advanced_https_ota_example_truncated_header(dut: Dut) thread1.start() dut.expect('Loaded app from partition at offset', timeout=30) try: - ip_address = dut.expect(r' (sta|eth) ip: ([^,]+),', timeout=30) - print('Connected to AP with IP: {}'.format(ip_address)) + ip_address = dut.expect(r'IPv4 address: ([^,]+),', timeout=30) + print('Connected to AP/Ethernet with IP: {}'.format(ip_address)) except pexpect.exceptions.TIMEOUT: thread1.terminate() - raise ValueError('ENV_TEST_FAILURE: Cannot connect to AP') + raise ValueError('ENV_TEST_FAILURE: Cannot connect to AP/Ethernet') dut.expect('Starting Advanced OTA example', timeout=30) print('writing to device: {}'.format('https://' + host_ip + ':' + str(server_port) + '/' + truncated_bin_name)) @@ -287,11 +287,11 @@ def test_examples_protocol_advanced_https_ota_example_random(dut: Dut) -> None: thread1.start() dut.expect('Loaded app from partition at offset', timeout=30) try: - ip_address = dut.expect(r' (sta|eth) ip: ([^,]+),', timeout=30) - print('Connected to AP with IP: {}'.format(ip_address)) + ip_address = dut.expect(r'IPv4 address: ([^,]+),', timeout=30) + print('Connected to AP/Ethernet with IP: {}'.format(ip_address)) except pexpect.exceptions.TIMEOUT: thread1.terminate() - raise ValueError('ENV_TEST_FAILURE: Cannot connect to AP') + raise ValueError('ENV_TEST_FAILURE: Cannot connect to AP/Ethernet') dut.expect('Starting Advanced OTA example', timeout=30) print('writing to device: {}'.format('https://' + host_ip + ':' + str(server_port) + '/' + random_bin_name)) @@ -344,11 +344,11 @@ def test_examples_protocol_advanced_https_ota_example_invalid_chip_id(dut: Dut) thread1.start() dut.expect('Loaded app from partition at offset', timeout=30) try: - ip_address = dut.expect(r' (sta|eth) ip: ([^,]+),', timeout=30) - print('Connected to AP with IP: {}'.format(ip_address)) + ip_address = dut.expect(r'IPv4 address: ([^,]+),', timeout=30) + print('Connected to AP/Ethernet with IP: {}'.format(ip_address)) except pexpect.exceptions.TIMEOUT: thread1.terminate() - raise ValueError('ENV_TEST_FAILURE: Cannot connect to AP') + raise ValueError('ENV_TEST_FAILURE: Cannot connect to AP/Ethernet') dut.expect('Starting Advanced OTA example', timeout=30) print('writing to device: {}'.format('https://' + host_ip + ':' + str(server_port) + '/' + random_bin_name)) @@ -384,10 +384,10 @@ def test_examples_protocol_advanced_https_ota_example_chunked(dut: Dut) -> None: try: dut.expect('Loaded app from partition at offset', timeout=30) try: - ip_address = dut.expect(r' (sta|eth) ip: ([^,]+),', timeout=30) - print('Connected to AP with IP: {}'.format(ip_address)) + ip_address = dut.expect(r'IPv4 address: ([^,]+),', timeout=30) + print('Connected to AP/Ethernet with IP: {}'.format(ip_address)) except pexpect.exceptions.TIMEOUT: - raise ValueError('ENV_TEST_FAILURE: Cannot connect to AP') + raise ValueError('ENV_TEST_FAILURE: Cannot connect to AP/Ethernet') dut.expect('Starting Advanced OTA example', timeout=30) @@ -434,13 +434,13 @@ def test_examples_protocol_advanced_https_ota_example_redirect_url(dut: Dut) -> thread3.start() dut.expect('Loaded app from partition at offset', timeout=30) try: - ip_address = dut.expect(r' (sta|eth) ip: ([^,]+),', timeout=30) - print('Connected to AP with IP: {}'.format(ip_address)) + ip_address = dut.expect(r'IPv4 address: ([^,]+),', timeout=30) + print('Connected to AP/Ethernet with IP: {}'.format(ip_address)) except pexpect.exceptions.TIMEOUT: thread1.terminate() thread2.terminate() thread3.terminate() - raise ValueError('ENV_TEST_FAILURE: Cannot connect to AP') + raise ValueError('ENV_TEST_FAILURE: Cannot connect to AP/Ethernet') dut.expect('Starting Advanced OTA example', timeout=30) print('writing to device: {}'.format('https://' + host_ip + ':' + str(redirection_server_port) + '/' + bin_name)) @@ -496,11 +496,11 @@ def test_examples_protocol_advanced_https_ota_example_anti_rollback(dut: Dut) -> # Positive Case dut.expect('Loaded app from partition at offset', timeout=30) try: - ip_address = dut.expect(r' (sta|eth) ip: ([^,]+),', timeout=30) - print('Connected to AP with IP: {}'.format(ip_address)) + ip_address = dut.expect(r'IPv4 address: ([^,]+),', timeout=30) + print('Connected to AP/Ethernet with IP: {}'.format(ip_address)) except pexpect.exceptions.TIMEOUT: thread1.terminate() - raise ValueError('ENV_TEST_FAILURE: Cannot connect to AP') + raise ValueError('ENV_TEST_FAILURE: Cannot connect to AP/Ethernet') dut.expect('Starting Advanced OTA example', timeout=30) # Use originally generated image with secure_version=1 @@ -554,10 +554,10 @@ def test_examples_protocol_advanced_https_ota_example_partial_request(dut: Dut) thread1.start() dut.expect('Loaded app from partition at offset', timeout=30) try: - ip_address = dut.expect(r' (sta|eth) ip: ([^,]+),', timeout=30) - print('Connected to AP with IP: {}'.format(ip_address)) + ip_address = dut.expect(r'IPv4 address: ([^,]+),', timeout=30) + print('Connected to AP/Ethernet with IP: {}'.format(ip_address)) except pexpect.exceptions.TIMEOUT: - print('ENV_TEST_FAILURE: Cannot connect to AP') + print('ENV_TEST_FAILURE: Cannot connect to AP/Ethernet') thread1.terminate() raise dut.expect('Starting Advanced OTA example', timeout=30) @@ -599,11 +599,10 @@ def test_examples_protocol_advanced_https_ota_example_nimble_gatts(dut: Dut) -> thread1.start() dut.expect('Loaded app from partition at offset', timeout=30) try: - ip_address = dut.expect(r' sta ip: ([^,]+),', timeout=30) - print('Connected to AP with IP: {}'.format(ip_address)) + ip_address = dut.expect(r'IPv4 address: ([^,]+),', timeout=30) + print('Connected to AP/Ethernet with IP: {}'.format(ip_address)) except pexpect.exceptions.TIMEOUT: - thread1.terminate() - raise ValueError('ENV_TEST_FAILURE: Cannot connect to AP') + raise ValueError('ENV_TEST_FAILURE: Cannot connect to AP/Ethernet') dut.expect('Starting Advanced OTA example', timeout=30) print('writing to device: {}'.format('https://' + host_ip + ':' + str(server_port) + '/' + bin_name)) @@ -643,11 +642,11 @@ def test_examples_protocol_advanced_https_ota_example_bluedroid_gatts(dut: Dut) thread1.start() dut.expect('Loaded app from partition at offset', timeout=30) try: - ip_address = dut.expect(r' sta ip: ([^,]+),', timeout=30) - print('Connected to AP with IP: {}'.format(ip_address)) + ip_address = dut.expect(r'IPv4 address: ([^,]+),', timeout=30) + print('Connected to AP/Ethernet with IP: {}'.format(ip_address)) except pexpect.exceptions.TIMEOUT: thread1.terminate() - raise ValueError('ENV_TEST_FAILURE: Cannot connect to AP') + raise ValueError('ENV_TEST_FAILURE: Cannot connect to AP/Ethernet') dut.expect('Starting Advanced OTA example', timeout=30) print('writing to device: {}'.format('https://' + host_ip + ':' + str(server_port) + '/' + bin_name)) @@ -695,10 +694,10 @@ def test_examples_protocol_advanced_https_ota_example_openssl_aligned_bin(dut: D try: dut.expect('Loaded app from partition at offset', timeout=30) try: - ip_address = dut.expect(r' (sta|eth) ip: ([^,]+),', timeout=30) - print('Connected to AP with IP: {}'.format(ip_address)) + ip_address = dut.expect(r'IPv4 address: ([^,]+),', timeout=30) + print('Connected to AP/Ethernet with IP: {}'.format(ip_address)) except pexpect.exceptions.TIMEOUT: - raise ValueError('ENV_TEST_FAILURE: Cannot connect to AP') + raise ValueError('ENV_TEST_FAILURE: Cannot connect to AP/Ethernet') dut.expect('Starting Advanced OTA example', timeout=30) diff --git a/examples/system/ota/native_ota_example/pytest_native_ota.py b/examples/system/ota/native_ota_example/pytest_native_ota.py index baee45799a..4f5f113a92 100644 --- a/examples/system/ota/native_ota_example/pytest_native_ota.py +++ b/examples/system/ota/native_ota_example/pytest_native_ota.py @@ -154,11 +154,11 @@ def test_examples_protocol_native_ota_example(dut: Dut) -> None: for i in range(iterations): dut.expect('Loaded app from partition at offset', timeout=60) try: - ip_address = dut.expect(r' (sta|eth) ip: ([^,]+),', timeout=30) - print('Connected to AP with IP: {}'.format(ip_address)) + ip_address = dut.expect(r'IPv4 address: ([^,]+),', timeout=30) + print('Connected to AP/Ethernet with IP: {}'.format(ip_address)) except pexpect.exceptions.TIMEOUT: thread1.terminate() - raise ValueError('ENV_TEST_FAILURE: Cannot connect to AP') + raise ValueError('ENV_TEST_FAILURE: Cannot connect to AP/Ethernet') dut.expect('Starting OTA example', timeout=30) print('writing to device: {}'.format('https://' + host_ip + ':' + str(server_port) + '/' + bin_name)) @@ -203,11 +203,11 @@ def test_examples_protocol_native_ota_example_truncated_bin(dut: Dut) -> None: thread1.start() dut.expect('Loaded app from partition at offset', timeout=30) try: - ip_address = dut.expect(r' (sta|eth) ip: ([^,]+),', timeout=30) - print('Connected to AP with IP: {}'.format(ip_address)) + ip_address = dut.expect(r'IPv4 address: ([^,]+),', timeout=30) + print('Connected to AP/Ethernet with IP: {}'.format(ip_address)) except pexpect.exceptions.TIMEOUT: thread1.terminate() - raise ValueError('ENV_TEST_FAILURE: Cannot connect to AP') + raise ValueError('ENV_TEST_FAILURE: Cannot connect to AP/Ethernet') dut.expect('Starting OTA example', timeout=30) print('writing to device: {}'.format('https://' + host_ip + ':' + str(server_port) + '/' + truncated_bin_name)) @@ -253,11 +253,11 @@ def test_examples_protocol_native_ota_example_truncated_header(dut: Dut) -> None thread1.start() dut.expect('Loaded app from partition at offset', timeout=30) try: - ip_address = dut.expect(r' (sta|eth) ip: ([^,]+),', timeout=30) - print('Connected to AP with IP: {}'.format(ip_address)) + ip_address = dut.expect(r'IPv4 address: ([^,]+),', timeout=30) + print('Connected to AP/Ethernet with IP: {}'.format(ip_address)) except pexpect.exceptions.TIMEOUT: thread1.terminate() - raise ValueError('ENV_TEST_FAILURE: Cannot connect to AP') + raise ValueError('ENV_TEST_FAILURE: Cannot connect to AP/Ethernet') dut.expect('Starting OTA example', timeout=30) print('writing to device: {}'.format('https://' + host_ip + ':' + str(server_port) + '/' + truncated_bin_name)) @@ -302,11 +302,11 @@ def test_examples_protocol_native_ota_example_random(dut: Dut) -> None: thread1.start() dut.expect('Loaded app from partition at offset', timeout=30) try: - ip_address = dut.expect(r' (sta|eth) ip: ([^,]+),', timeout=30) - print('Connected to AP with IP: {}'.format(ip_address)) + ip_address = dut.expect(r'IPv4 address: ([^,]+),', timeout=30) + print('Connected to AP/Ethernet with IP: {}'.format(ip_address)) except pexpect.exceptions.TIMEOUT: thread1.terminate() - raise ValueError('ENV_TEST_FAILURE: Cannot connect to AP') + raise ValueError('ENV_TEST_FAILURE: Cannot connect to AP/Ethernet') dut.expect('Starting OTA example', timeout=30) print('writing to device: {}'.format('https://' + host_ip + ':' + str(server_port) + '/' + random_bin_name)) @@ -336,10 +336,10 @@ def test_examples_protocol_native_ota_example_chunked(dut: Dut) -> None: try: dut.expect('Loaded app from partition at offset', timeout=30) try: - ip_address = dut.expect(r' (sta|eth) ip: ([^,]+),', timeout=30) - print('Connected to AP with IP: {}'.format(ip_address)) + ip_address = dut.expect(r'IPv4 address: ([^,]+),', timeout=30) + print('Connected to AP/Ethernet with IP: {}'.format(ip_address)) except pexpect.exceptions.TIMEOUT: - raise ValueError('ENV_TEST_FAILURE: Cannot connect to AP') + raise ValueError('ENV_TEST_FAILURE: Cannot connect to AP/Ethernet') dut.expect('Starting OTA example', timeout=30) print('writing to device: {}'.format('https://' + host_ip + ':8070/' + bin_name)) diff --git a/examples/system/ota/pre_encrypted_ota/pytest_pre_encrypted_ota.py b/examples/system/ota/pre_encrypted_ota/pytest_pre_encrypted_ota.py index dd63bfda1d..86ef19f21e 100644 --- a/examples/system/ota/pre_encrypted_ota/pytest_pre_encrypted_ota.py +++ b/examples/system/ota/pre_encrypted_ota/pytest_pre_encrypted_ota.py @@ -76,11 +76,11 @@ def test_examples_protocol_pre_encrypted_ota_example(dut: Dut) -> None: dut.expect('Loaded app from partition at offset', timeout=30) try: - ip_address = dut.expect(r' (sta|eth) ip: ([^,]+),', timeout=30) - print('Connected to AP with IP: {}'.format(ip_address)) + ip_address = dut.expect(r'IPv4 address: ([^,]+),', timeout=30) + print('Connected to AP/Ethernet with IP: {}'.format(ip_address)) except pexpect.exceptions.TIMEOUT: thread1.terminate() - raise ValueError('ENV_TEST_FAILURE: Cannot connect to AP') + raise ValueError('ENV_TEST_FAILURE: Cannot connect to AP/Ethernet') dut.expect('Starting Pre Encrypted OTA example', timeout=30) print('writing to device: {}'.format('https://' + host_ip + ':' + str(server_port) + '/' + enc_bin_name)) diff --git a/examples/system/ota/simple_ota_example/pytest_simple_ota.py b/examples/system/ota/simple_ota_example/pytest_simple_ota.py index b8c04f1415..68a52749e3 100644 --- a/examples/system/ota/simple_ota_example/pytest_simple_ota.py +++ b/examples/system/ota/simple_ota_example/pytest_simple_ota.py @@ -138,11 +138,11 @@ def test_examples_protocol_simple_ota_example(dut: Dut) -> None: check_sha256(sha256_bootloader, str(dut.expect(r'SHA-256 for bootloader:\s+([a-f0-9]){64}')[0])) check_sha256(sha256_app, str(dut.expect(r'SHA-256 for current firmware:\s+([a-f0-9]){64}')[0])) try: - ip_address = dut.expect(r' sta ip: ([^,]+),', timeout=30) - print('Connected to AP with IP: {}'.format(ip_address)) + ip_address = dut.expect(r'IPv4 address: ([^,]+),', timeout=30) + print('Connected to AP/Ethernet with IP: {}'.format(ip_address)) except pexpect.exceptions.TIMEOUT: thread1.terminate() - raise ValueError('ENV_TEST_FAILURE: Cannot connect to AP') + raise ValueError('ENV_TEST_FAILURE: Cannot connect to AP/Ethernet') dut.expect('Starting OTA example', timeout=30) print('writing to device: {}'.format('https://' + host_ip + ':8000/simple_ota.bin')) @@ -172,13 +172,13 @@ def test_examples_protocol_simple_ota_example_ethernet_with_spiram_config(dut: D thread1 = multiprocessing.Process(target=start_https_server, args=(dut.app.binary_path, host_ip, 8000)) thread1.daemon = True thread1.start() - dut.expect('Loaded app from partition at offset 0x10000', timeout=30) + dut.expect('Loaded app from partition at offset 0x10000', timeout=30)) try: - ip_address = dut.expect(r' eth ip: ([^,]+),', timeout=30) - print('Connected to AP with IP: {}'.format(ip_address)) + ip_address = dut.expect(r'IPv4 address: ([^,]+),', timeout=30) + print('Connected to AP/Ethernet with IP: {}'.format(ip_address)) except pexpect.exceptions.TIMEOUT: thread1.terminate() - raise ValueError('ENV_TEST_FAILURE: Cannot connect to AP') + raise ValueError('ENV_TEST_FAILURE: Cannot connect to AP/Ethernet') dut.expect('Starting OTA example', timeout=30) print('writing to device: {}'.format('https://' + host_ip + ':8000/simple_ota.bin')) @@ -215,11 +215,11 @@ def test_examples_protocol_simple_ota_example_with_flash_encryption(dut: Dut) -> dut.expect('Loaded app from partition at offset 0x20000', timeout=30) dut.expect('Flash encryption mode is DEVELOPMENT', timeout=10) try: - ip_address = dut.expect(r' eth ip: ([^,]+),', timeout=30) - print('Connected to AP with IP: {}'.format(ip_address)) + ip_address = dut.expect(r'IPv4 address: ([^,]+),', timeout=30) + print('Connected to AP/Ethernet with IP: {}'.format(ip_address)) except pexpect.exceptions.TIMEOUT: thread1.terminate() - raise ValueError('ENV_TEST_FAILURE: Cannot connect to AP') + raise ValueError('ENV_TEST_FAILURE: Cannot connect to AP/Ethernet') dut.expect('Starting OTA example', timeout=30) print('writing to device: {}'.format('https://' + host_ip + ':8000/simple_ota.bin')) @@ -255,11 +255,11 @@ def test_examples_protocol_simple_ota_example_with_flash_encryption_wifi(dut: Du dut.expect('Loaded app from partition at offset 0x20000', timeout=30) dut.expect('Flash encryption mode is DEVELOPMENT', timeout=10) try: - ip_address = dut.expect(r' sta ip: ([^,]+),', timeout=30) - print('Connected to AP with IP: {}'.format(ip_address)) + ip_address = dut.expect(r'IPv4 address: ([^,]+),', timeout=30) + print('Connected to AP/Ethernet with IP: {}'.format(ip_address)) except pexpect.exceptions.TIMEOUT: thread1.terminate() - raise ValueError('ENV_TEST_FAILURE: Cannot connect to AP') + raise ValueError('ENV_TEST_FAILURE: Cannot connect to AP/Ethernet') dut.expect('Starting OTA example', timeout=30) print('writing to device: {}'.format('https://' + host_ip + ':8000/simple_ota.bin')) @@ -295,11 +295,11 @@ def test_examples_protocol_simple_ota_example_with_verify_app_signature_on_updat check_sha256(sha256_bootloader, str(dut.expect(r'SHA-256 for bootloader:\s+([a-f0-9]){64}')[0])) check_sha256(sha256_app, str(dut.expect(r'SHA-256 for current firmware:\s+([a-f0-9]){64}')[0])) try: - ip_address = dut.expect(r' eth ip: ([^,]+),', timeout=30) - print('Connected to AP with IP: {}'.format(ip_address)) + ip_address = dut.expect(r'IPv4 address: ([^,]+),', timeout=30) + print('Connected to AP/Ethernet with IP: {}'.format(ip_address)) except pexpect.exceptions.TIMEOUT: thread1.terminate() - raise ValueError('ENV_TEST_FAILURE: Cannot connect to AP') + raise ValueError('ENV_TEST_FAILURE: Cannot connect to AP/Ethernet') dut.expect('Starting OTA example', timeout=30) print('writing to device: {}'.format('https://' + host_ip + ':8000/simple_ota.bin')) @@ -338,11 +338,11 @@ def test_examples_protocol_simple_ota_example_with_verify_app_signature_on_updat check_sha256(sha256_bootloader, str(dut.expect(r'SHA-256 for bootloader:\s+([a-f0-9]){64}')[0])) check_sha256(sha256_app, str(dut.expect(r'SHA-256 for current firmware:\s+([a-f0-9]){64}')[0])) try: - ip_address = dut.expect(r' eth ip: ([^,]+),', timeout=30) - print('Connected to AP with IP: {}'.format(ip_address)) + ip_address = dut.expect(r'IPv4 address: ([^,]+),', timeout=30) + print('Connected to AP/Ethernet with IP: {}'.format(ip_address)) except pexpect.exceptions.TIMEOUT: thread1.terminate() - raise ValueError('ENV_TEST_FAILURE: Cannot connect to AP') + raise ValueError('ENV_TEST_FAILURE: Cannot connect to AP/Ethernet') dut.expect('Starting OTA example', timeout=30) print('writing to device: {}'.format('https://' + host_ip + ':8000/simple_ota.bin'))