Skip to content

Commit 48f38a4

Browse files
authored
Merge pull request #11654 from tymoteuszblochmobica/mesh
Adjustment of netsocket tests to the lossy mesh network limitation.
2 parents 6064983 + 983c958 commit 48f38a4

File tree

4 files changed

+44
-4
lines changed

4 files changed

+44
-4
lines changed

TESTS/netsocket/dns/main.cpp

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
#include "nsapi_dns.h"
3333
#include "events/EventQueue.h"
3434
#include "dns_tests.h"
35+
#include "ip6string.h"
3536

3637
using namespace utest::v1;
3738

@@ -165,7 +166,16 @@ static void net_bringup()
165166
net = NetworkInterface::get_default_instance();
166167
nsapi_error_t err = net->connect();
167168
TEST_ASSERT_EQUAL(NSAPI_ERROR_OK, err);
168-
tr_info("MBED: IP address is '%s'", net->get_ip_address() ? net->get_ip_address() : "null");
169+
const char *address = net->get_ip_address();
170+
171+
#define MESH 3
172+
#if MBED_CONF_TARGET_NETWORK_DEFAULT_INTERFACE_TYPE == MESH
173+
printf("Waiting for GLOBAL_UP\n");
174+
while (net->get_connection_status() != NSAPI_STATUS_GLOBAL_UP) {
175+
ThisThread::sleep_for(500);
176+
}
177+
#endif
178+
printf("MBED: IP address is '%s'\n", address ? address : "null");
169179
}
170180

171181
static void net_bringdown()

TESTS/netsocket/tcp/main.cpp

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
#include "utest.h"
3232
#include "utest/utest_stack_trace.h"
3333
#include "tcp_tests.h"
34+
#include "ip6string.h"
3435

3536
#ifndef ECHO_SERVER_ADDR
3637
#error [NOT_SUPPORTED] Requires parameters for echo server
@@ -76,7 +77,16 @@ static void _ifup()
7677
NetworkInterface *net = NetworkInterface::get_default_instance();
7778
nsapi_error_t err = net->connect();
7879
TEST_ASSERT_EQUAL(NSAPI_ERROR_OK, err);
79-
tr_info("MBED: TCPClient IP address is '%s'", net->get_ip_address() ? net->get_ip_address() : "null");
80+
const char *address = net->get_ip_address();
81+
82+
#define MESH 3
83+
#if MBED_CONF_TARGET_NETWORK_DEFAULT_INTERFACE_TYPE == MESH
84+
printf("Waiting for GLOBAL_UP\n");
85+
while (net->get_connection_status() != NSAPI_STATUS_GLOBAL_UP) {
86+
ThisThread::sleep_for(500);
87+
}
88+
#endif
89+
printf("MBED: TCPClient IP address is '%s'\n", address ? address : "null");
8090
}
8191

8292
static void _ifdown()

TESTS/netsocket/tls/main.cpp

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
#include "tls_tests.h"
3333
#include "cert.h"
3434
#include "CellularDevice.h"
35+
#include "ip6string.h"
3536

3637
#ifndef ECHO_SERVER_ADDR
3738
#error [NOT_SUPPORTED] Requires parameters for echo server
@@ -70,7 +71,16 @@ static void _ifup()
7071
NetworkInterface *net = NetworkInterface::get_default_instance();
7172
nsapi_error_t err = net->connect();
7273
TEST_ASSERT_EQUAL(NSAPI_ERROR_OK, err);
73-
tr_info("MBED: TLSClient IP address is '%s'\n", net->get_ip_address() ? net->get_ip_address() : "null");
74+
const char *address = net->get_ip_address();
75+
76+
#define MESH 3
77+
#if MBED_CONF_TARGET_NETWORK_DEFAULT_INTERFACE_TYPE == MESH
78+
printf("Waiting for GLOBAL_UP\n");
79+
while (net->get_connection_status() != NSAPI_STATUS_GLOBAL_UP) {
80+
ThisThread::sleep_for(500);
81+
}
82+
#endif
83+
printf("MBED: TLSClient address is '%s'\n", address ? address : "null");
7484
}
7585

7686
static void _ifdown()

TESTS/netsocket/udp/main.cpp

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
#include "utest.h"
3232
#include "utest/utest_stack_trace.h"
3333
#include "udp_tests.h"
34+
#include "ip6string.h"
3435

3536
#ifndef ECHO_SERVER_ADDR
3637
#error [NOT_SUPPORTED] Requires parameters for echo server
@@ -63,7 +64,16 @@ static void _ifup()
6364
NetworkInterface *net = NetworkInterface::get_default_instance();
6465
nsapi_error_t err = net->connect();
6566
TEST_ASSERT_EQUAL(NSAPI_ERROR_OK, err);
66-
tr_info("MBED: UDPClient IP address is '%s'", net->get_ip_address() ? net->get_ip_address() : "null");
67+
const char *address = net->get_ip_address();
68+
69+
#define MESH 3
70+
#if MBED_CONF_TARGET_NETWORK_DEFAULT_INTERFACE_TYPE == MESH
71+
printf("Waiting for GLOBAL_UP\n");
72+
while (net->get_connection_status() != NSAPI_STATUS_GLOBAL_UP) {
73+
ThisThread::sleep_for(500);
74+
}
75+
#endif
76+
printf("MBED: UDPClient IP address is '%s'\n", address ? address : "null");
6777
}
6878

6979
static void _ifdown()

0 commit comments

Comments
 (0)