Skip to content

Commit 65bf17e

Browse files
author
Teppo Järvelin
committed
Fix netsocket tests for IAR
Test case printed IP address. If ip address is null, IAR compiled binary fails. Added check for printing null. If IP address is null, then it prints string 'null'.
1 parent 6a17d74 commit 65bf17e

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

TESTS/netsocket/tcp/main.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ static void _ifup()
7272
NetworkInterface *net = NetworkInterface::get_default_instance();
7373
nsapi_error_t err = net->connect();
7474
TEST_ASSERT_EQUAL(NSAPI_ERROR_OK, err);
75-
printf("MBED: TCPClient IP address is '%s'\n", net->get_ip_address());
75+
printf("MBED: TCPClient IP address is '%s'\n", net->get_ip_address() ? net->get_ip_address() : "null");
7676
}
7777

7878
static void _ifdown()

TESTS/netsocket/tls/main.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ static void _ifup()
9494
NetworkInterface *net = NetworkInterface::get_default_instance();
9595
nsapi_error_t err = net->connect();
9696
TEST_ASSERT_EQUAL(NSAPI_ERROR_OK, err);
97-
printf("MBED: TLSClient IP address is '%s'\n", net->get_ip_address());
97+
printf("MBED: TLSClient IP address is '%s'\n", net->get_ip_address() ? net->get_ip_address() : "null");
9898
}
9999

100100
static void _ifdown()

TESTS/netsocket/udp/main.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ static void _ifup()
5959
NetworkInterface *net = NetworkInterface::get_default_instance();
6060
nsapi_error_t err = net->connect();
6161
TEST_ASSERT_EQUAL(NSAPI_ERROR_OK, err);
62-
printf("MBED: UDPClient IP address is '%s'\n", net->get_ip_address());
62+
printf("MBED: UDPClient IP address is '%s'\n", net->get_ip_address() ? net->get_ip_address() : "null");
6363
}
6464

6565
static void _ifdown()

0 commit comments

Comments
 (0)