Skip to content

Commit c1c1492

Browse files
authored
Merge pull request #2744 from jeromecoutant/PR_STM32_IPV4
FEATURE_IPV4/TESTS: result status could be wrong
2 parents cc69ded + 257c367 commit c1c1492

File tree

2 files changed

+11
-7
lines changed
  • features/net/FEATURE_IPV4/TESTS/mbedmicro-net

2 files changed

+11
-7
lines changed

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

Lines changed: 8 additions & 6 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,18 @@ int main() {
6667
TEST_ASSERT_TRUE(found_200_ok);
6768
TEST_ASSERT_TRUE(found_hello);
6869

69-
if (!found_200_ok) result = false;
70-
if (!found_hello) result = false;
70+
if (found_200_ok && found_hello) result = true;
7171

7272
printf("HTTP: Received %d chars from server\r\n", ret);
7373
printf("HTTP: Received 200 OK status ... %s\r\n", found_200_ok ? "[OK]" : "[FAIL]");
7474
printf("HTTP: Received '%s' status ... %s\r\n", HTTP_HELLO_STR, found_hello ? "[OK]" : "[FAIL]");
75-
printf("HTTP: Received massage:\r\n\r\n");
75+
printf("HTTP: Received message:\r\n");
7676
printf("%s", buffer);
77+
sock.close();
78+
} else {
79+
printf("HTTP: ERROR\r\n");
7780
}
7881

79-
sock.close();
8082
eth.disconnect();
8183
GREENTEA_TESTSUITE_RESULT(result);
8284
}

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)