From 9703c1a32f8a0bc6f6b9ff04fb1f37b29b04b69f 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 4f28116aaf..f396f26d5c 100644 --- a/examples/protocols/asio/chat_server/asio_chat_server_test.py +++ b/examples/protocols/asio/chat_server/asio_chat_server_test.py @@ -38,6 +38,7 @@ def test_examples_protocol_asio_chat_server(env, extra_data): # 2. get the server IP address data = dut1.expect(re.compile(r" sta ip: ([^,]+),"), 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],80)) diff --git a/examples/protocols/asio/chat_server/main/chat_server.cpp b/examples/protocols/asio/chat_server/main/chat_server.cpp index 05740f4798..77d76160c9 100644 --- a/examples/protocols/asio/chat_server/main/chat_server.cpp +++ b/examples/protocols/asio/chat_server/main/chat_server.cpp @@ -208,6 +208,8 @@ int asio_main() servers.emplace_back(io_context, endpoint); } + std::cout << "ASIO engine is up and running" << std::endl; + io_context.run(); return 0; 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 c29b8ce7b8..2f13e1a481 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 @@ -40,6 +40,7 @@ def test_examples_protocol_asio_tcp_server(env, extra_data): # 2. get the server IP address data = dut1.expect(re.compile(r" sta ip: ([^,]+),"), 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],80)) 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 22f171f530..cdfafdb91e 100644 --- a/examples/protocols/asio/tcp_echo_server/main/echo_server.cpp +++ b/examples/protocols/asio/tcp_echo_server/main/echo_server.cpp @@ -86,6 +86,8 @@ void asio_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 d3a01563c1..5249016b15 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 @@ -40,6 +40,7 @@ def test_examples_protocol_asio_udp_server(env, extra_data): # 2. get the server IP address data = dut1.expect(re.compile(r" sta ip: ([^,]+),"), 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], 80)) 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 5b6607d736..c0204e2178 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 @@ -65,5 +65,7 @@ void asio_main() server s(io_context, std::atoi(CONFIG_EXAMPLE_PORT)); + std::cout << "ASIO engine is up and running" << std::endl; + io_context.run(); }