From 61fd08e5ef8c60c8f44af72fc5e88a656e842256 Mon Sep 17 00:00:00 2001 From: Chen Yudong Date: Tue, 25 May 2021 15:02:47 +0800 Subject: [PATCH] CI: fix connection failures in asio example tests --- examples/protocols/asio/chat_server/asio_chat_server_test.py | 1 + examples/protocols/asio/chat_server/main/chat_server.cpp | 2 ++ examples/protocols/asio/tcp_echo_server/asio_tcp_server_test.py | 1 + examples/protocols/asio/tcp_echo_server/main/echo_server.cpp | 2 ++ examples/protocols/asio/udp_echo_server/asio_udp_server_test.py | 1 + .../protocols/asio/udp_echo_server/main/udp_echo_server.cpp | 2 ++ 6 files changed, 9 insertions(+) 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 5e6f3e72e5..867bbd8ecc 100644 --- a/examples/protocols/asio/chat_server/asio_chat_server_test.py +++ b/examples/protocols/asio/chat_server/asio_chat_server_test.py @@ -26,6 +26,7 @@ def test_examples_protocol_asio_chat_server(env, extra_data): # 2. get the server IP address 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 + dut1.expect('ASIO engine is up and running', timeout=1) cli = socket.socket(socket.AF_INET, socket.SOCK_STREAM) cli.settimeout(30) cli.connect((data[0], 2222)) diff --git a/examples/protocols/asio/chat_server/main/chat_server.cpp b/examples/protocols/asio/chat_server/main/chat_server.cpp index 56a447e05f..b32e7ff617 100644 --- a/examples/protocols/asio/chat_server/main/chat_server.cpp +++ b/examples/protocols/asio/chat_server/main/chat_server.cpp @@ -226,5 +226,7 @@ extern "C" void app_main() servers.emplace_back(io_context, endpoint); } + std::cout << "ASIO engine is up and running" << std::endl; + io_context.run(); } 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 3c19228835..603d91032d 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 @@ -27,6 +27,7 @@ def test_examples_protocol_asio_tcp_server(env, extra_data): # 2. get the server IP address 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 + dut1.expect('ASIO engine is up and running', timeout=1) cli = socket.socket(socket.AF_INET, socket.SOCK_STREAM) cli.settimeout(30) cli.connect((data[0], 2222)) diff --git a/examples/protocols/asio/tcp_echo_server/main/echo_server.cpp b/examples/protocols/asio/tcp_echo_server/main/echo_server.cpp index 008ec6ed79..f2d797ad4a 100644 --- a/examples/protocols/asio/tcp_echo_server/main/echo_server.cpp +++ b/examples/protocols/asio/tcp_echo_server/main/echo_server.cpp @@ -103,5 +103,7 @@ extern "C" void app_main() server s(io_context, std::atoi(CONFIG_EXAMPLE_PORT)); + std::cout << "ASIO engine is up and running" << std::endl; + io_context.run(); } \ No newline at end of file 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 d06ef66c87..de91c11e3b 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 @@ -27,6 +27,7 @@ def test_examples_protocol_asio_udp_server(env, extra_data): # 2. get the server IP address 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 + dut1.expect('ASIO engine is up and running', timeout=1) cli = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) cli.settimeout(30) cli.connect((data[0], 2222)) diff --git a/examples/protocols/asio/udp_echo_server/main/udp_echo_server.cpp b/examples/protocols/asio/udp_echo_server/main/udp_echo_server.cpp index 06ac3fec92..7c460f57dc 100644 --- a/examples/protocols/asio/udp_echo_server/main/udp_echo_server.cpp +++ b/examples/protocols/asio/udp_echo_server/main/udp_echo_server.cpp @@ -85,5 +85,7 @@ extern "C" void app_main() server s(io_context, std::atoi(CONFIG_EXAMPLE_PORT)); + std::cout << "ASIO engine is up and running" << std::endl; + io_context.run(); }