Skip to content

Commit 11d0f51

Browse files
committed
FEATURE_IPV4/TESTS: result status could be wrong
result status should be set to false by default before starting test execution.
1 parent ff89555 commit 11d0f51

File tree

2 files changed

+12
-5
lines changed
  • features/net/FEATURE_IPV4/TESTS/mbedmicro-net

2 files changed

+12
-5
lines changed

features/net/FEATURE_IPV4/TESTS/mbedmicro-net/tcp_client_hello_world/main.cpp

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,15 +35,16 @@ bool find_substring(const char *first, const char *last, const char *s_first, co
3535
int main() {
3636
GREENTEA_SETUP(20, "default_auto");
3737

38-
bool result = true;
38+
bool result = false;
3939
EthernetInterface eth;
4040
//eth.init(); //Use DHCP
4141
eth.connect();
4242
printf("TCP client IP Address is %s\r\n", eth.get_ip_address());
4343

4444
TCPSocket sock(&eth);
45+
printf("HTTP: Connection to %s:%d\r\n", HTTP_SERVER_NAME, HTTP_SERVER_PORT);
4546
if (sock.connect(HTTP_SERVER_NAME, HTTP_SERVER_PORT) == 0) {
46-
printf("HTTP: Connected to %s:%d\r\n", HTTP_SERVER_NAME, HTTP_SERVER_PORT);
47+
printf("HTTP: OK\r\n");
4748

4849
// We are constructing GET command like this:
4950
// GET http://developer.mbed.org/media/uploads/mbed_official/hello.txt HTTP/1.0\n\n
@@ -66,17 +67,21 @@ int main() {
6667
TEST_ASSERT_TRUE(found_200_ok);
6768
TEST_ASSERT_TRUE(found_hello);
6869

70+
result = true;
6971
if (!found_200_ok) result = false;
7072
if (!found_hello) result = false;
7173

7274
printf("HTTP: Received %d chars from server\r\n", ret);
7375
printf("HTTP: Received 200 OK status ... %s\r\n", found_200_ok ? "[OK]" : "[FAIL]");
7476
printf("HTTP: Received '%s' status ... %s\r\n", HTTP_HELLO_STR, found_hello ? "[OK]" : "[FAIL]");
75-
printf("HTTP: Received massage:\r\n\r\n");
77+
printf("HTTP: Received message:\r\n");
7678
printf("%s", buffer);
79+
sock.close();
80+
}
81+
else {
82+
printf("HTTP: ERROR\r\n");
7783
}
7884

79-
sock.close();
8085
eth.disconnect();
8186
GREENTEA_TESTSUITE_RESULT(result);
8287
}

features/net/FEATURE_IPV4/TESTS/mbedmicro-net/udp_echo_client/main.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ int main() {
3333

3434
greentea_send_kv("target_ip", eth.get_ip_address());
3535

36-
bool result = true;
36+
bool result = false;
3737

3838
char recv_key[] = "host_port";
3939
char ipbuf[60] = {0};
@@ -66,6 +66,8 @@ int main() {
6666
result = false;
6767
break;
6868
}
69+
70+
result = true;
6971
}
7072

7173
sock.close();

0 commit comments

Comments
 (0)