From 8d90156c07ae343c821a39eabadbe859e36be2ad Mon Sep 17 00:00:00 2001 From: David Cermak Date: Fri, 8 Nov 2019 14:56:25 +0100 Subject: [PATCH] asio: fix asio test code to start the test after ip address received from common example code Previously set to wait until IP address got from tcpip_adapter, but since common example connect code blocks until both IP4 and IPv6 address received it could happen that test code might have started connection to the ASIO counter-part while ESP32 still waiting for IPv6 address --- examples/protocols/asio/chat_client/asio_chat_client_test.py | 2 +- examples/protocols/asio/chat_server/asio_chat_server_test.py | 2 +- examples/protocols/asio/tcp_echo_server/asio_tcp_server_test.py | 2 +- examples/protocols/asio/udp_echo_server/asio_udp_server_test.py | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/examples/protocols/asio/chat_client/asio_chat_client_test.py b/examples/protocols/asio/chat_client/asio_chat_client_test.py index 3b141c7d17..7a507c4b7b 100644 --- a/examples/protocols/asio/chat_client/asio_chat_client_test.py +++ b/examples/protocols/asio/chat_client/asio_chat_client_test.py @@ -81,7 +81,7 @@ def test_examples_protocol_asio_chat_client(env, extra_data): thread1.start() # 2. start the dut test and wait till client gets IP address dut1.start_app() - dut1.expect(re.compile(r" sta ip: ([^,]+),"), timeout=30) + dut1.expect(re.compile(r" IPv4 address: ([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+)"), timeout=30) # 3. send host's IP to the client i.e. the `dut1` dut1.write(host_ip) # 4. client `dut1` should receive a message diff --git a/examples/protocols/asio/chat_server/asio_chat_server_test.py b/examples/protocols/asio/chat_server/asio_chat_server_test.py index ea4702c4e8..cc273b447f 100644 --- a/examples/protocols/asio/chat_server/asio_chat_server_test.py +++ b/examples/protocols/asio/chat_server/asio_chat_server_test.py @@ -36,7 +36,7 @@ def test_examples_protocol_asio_chat_server(env, extra_data): # 1. start test dut1.start_app() # 2. get the server IP address - data = dut1.expect(re.compile(r" sta ip: ([^,]+),"), timeout=30) + data = dut1.expect(re.compile(r" IPv4 address: ([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+)"), timeout=30) # 3. create tcp client and connect to server cli = socket.socket(socket.AF_INET, socket.SOCK_STREAM) cli.settimeout(30) diff --git a/examples/protocols/asio/tcp_echo_server/asio_tcp_server_test.py b/examples/protocols/asio/tcp_echo_server/asio_tcp_server_test.py index 2cdfd45aee..440841cfc4 100644 --- a/examples/protocols/asio/tcp_echo_server/asio_tcp_server_test.py +++ b/examples/protocols/asio/tcp_echo_server/asio_tcp_server_test.py @@ -38,7 +38,7 @@ def test_examples_protocol_asio_tcp_server(env, extra_data): # 1. start test dut1.start_app() # 2. get the server IP address - data = dut1.expect(re.compile(r" sta ip: ([^,]+),"), timeout=30) + data = dut1.expect(re.compile(r" IPv4 address: ([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+)"), timeout=30) # 3. create tcp client and connect to server cli = socket.socket(socket.AF_INET, socket.SOCK_STREAM) cli.settimeout(30) diff --git a/examples/protocols/asio/udp_echo_server/asio_udp_server_test.py b/examples/protocols/asio/udp_echo_server/asio_udp_server_test.py index dc2cc78a80..feaf98f633 100644 --- a/examples/protocols/asio/udp_echo_server/asio_udp_server_test.py +++ b/examples/protocols/asio/udp_echo_server/asio_udp_server_test.py @@ -38,7 +38,7 @@ def test_examples_protocol_asio_udp_server(env, extra_data): # 1. start test dut1.start_app() # 2. get the server IP address - data = dut1.expect(re.compile(r" sta ip: ([^,]+),"), timeout=30) + data = dut1.expect(re.compile(r" IPv4 address: ([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+)"), timeout=30) # 3. create tcp client and connect to server cli = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) cli.settimeout(30)