Skip to content

Commit cc89c20

Browse files
authored
Merge pull request #9175 from michalpasztamobica/greentea_ignore_unsupported
Greentea tests ignore bind returning UNSUPPORTED
2 parents 51b8d6e + a2110d5 commit cc89c20

16 files changed

+100
-16
lines changed

TESTS/netsocket/tcp/tcpsocket_bind_address.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,12 @@ void TCPSOCKET_BIND_ADDRESS()
3939
}
4040
TEST_ASSERT_EQUAL(NSAPI_ERROR_OK, sock->open(get_interface()));
4141
SocketAddress sockAddr = SocketAddress(get_interface()->get_ip_address(), 80);
42-
TEST_ASSERT_EQUAL(NSAPI_ERROR_OK, sock->bind(sockAddr));
42+
nsapi_error_t bind_result = sock->bind(sockAddr);
43+
if (bind_result == NSAPI_ERROR_UNSUPPORTED) {
44+
TEST_IGNORE_MESSAGE("bind() not supported");
45+
} else {
46+
TEST_ASSERT_EQUAL(NSAPI_ERROR_OK, bind_result);
47+
}
4348

4449
delete sock;
4550

TESTS/netsocket/tcp/tcpsocket_bind_address_invalid.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,12 @@ void TCPSOCKET_BIND_ADDRESS_INVALID()
3838
TEST_FAIL();
3939
}
4040
TEST_ASSERT_EQUAL(NSAPI_ERROR_OK, sock->open(get_interface()));
41-
TEST_ASSERT_EQUAL(NSAPI_ERROR_PARAMETER, sock->bind("190.2.3.4", 1024));
41+
nsapi_error_t bind_result = sock->bind("190.2.3.4", 1024);
42+
if (bind_result == NSAPI_ERROR_UNSUPPORTED) {
43+
TEST_IGNORE_MESSAGE("bind() not supported");
44+
} else {
45+
TEST_ASSERT_EQUAL(NSAPI_ERROR_PARAMETER, bind_result);
46+
}
4247

4348
delete sock;
4449

TESTS/netsocket/tcp/tcpsocket_bind_address_null.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,12 @@ void TCPSOCKET_BIND_ADDRESS_NULL()
3838
TEST_FAIL();
3939
}
4040
TEST_ASSERT_EQUAL(NSAPI_ERROR_OK, sock->open(get_interface()));
41-
TEST_ASSERT_EQUAL(NSAPI_ERROR_OK, sock->bind(NULL, 1024));
41+
nsapi_error_t bind_result = sock->bind(NULL, 1024);
42+
if (bind_result == NSAPI_ERROR_UNSUPPORTED) {
43+
TEST_IGNORE_MESSAGE("bind() not supported");
44+
} else {
45+
TEST_ASSERT_EQUAL(NSAPI_ERROR_OK, bind_result);
46+
}
4247

4348
delete sock;
4449

TESTS/netsocket/tcp/tcpsocket_bind_address_port.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,12 @@ void TCPSOCKET_BIND_ADDRESS_PORT()
3838
TEST_FAIL();
3939
}
4040
TEST_ASSERT_EQUAL(NSAPI_ERROR_OK, sock->open(get_interface()));
41-
TEST_ASSERT_EQUAL(NSAPI_ERROR_OK, sock->bind(get_interface()->get_ip_address(), 80));
41+
nsapi_error_t bind_result = sock->bind(get_interface()->get_ip_address(), 80);
42+
if (bind_result == NSAPI_ERROR_UNSUPPORTED) {
43+
TEST_IGNORE_MESSAGE("bind() not supported");
44+
} else {
45+
TEST_ASSERT_EQUAL(NSAPI_ERROR_OK, bind_result);
46+
}
4247

4348
delete sock;
4449

TESTS/netsocket/tcp/tcpsocket_bind_port.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,12 @@ void TCPSOCKET_BIND_PORT()
3838
TEST_FAIL();
3939
}
4040
TEST_ASSERT_EQUAL(NSAPI_ERROR_OK, sock->open(get_interface()));
41-
TEST_ASSERT_EQUAL(NSAPI_ERROR_OK, sock->bind(1024));
41+
nsapi_error_t bind_result = sock->bind(1024);
42+
if (bind_result == NSAPI_ERROR_UNSUPPORTED) {
43+
TEST_IGNORE_MESSAGE("bind() not supported");
44+
} else {
45+
TEST_ASSERT_EQUAL(NSAPI_ERROR_OK, bind_result);
46+
}
4247

4348
delete sock;
4449

TESTS/netsocket/tcp/tcpsocket_bind_port_fail.cpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,14 @@ void TCPSOCKET_BIND_PORT_FAIL()
3838
TEST_FAIL();
3939
}
4040
TEST_ASSERT_EQUAL(NSAPI_ERROR_OK, sock->open(get_interface()));
41-
TEST_ASSERT_EQUAL(NSAPI_ERROR_OK, sock->bind(1024));
41+
nsapi_error_t bind_result = sock->bind(1024);
42+
if (bind_result == NSAPI_ERROR_UNSUPPORTED) {
43+
TEST_IGNORE_MESSAGE("bind() not supported");
44+
delete sock;
45+
return;
46+
} else {
47+
TEST_ASSERT_EQUAL(NSAPI_ERROR_OK, bind_result);
48+
}
4249

4350
TCPSocket *sock2 = new TCPSocket;
4451
if (!sock2) {

TESTS/netsocket/tcp/tcpsocket_bind_unopened.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,12 @@ void TCPSOCKET_BIND_UNOPENED()
3737
if (!sock) {
3838
TEST_FAIL();
3939
}
40-
TEST_ASSERT_EQUAL(NSAPI_ERROR_NO_SOCKET, sock->bind(1024));
40+
nsapi_error_t bind_result = sock->bind(1024);
41+
if (bind_result == NSAPI_ERROR_UNSUPPORTED) {
42+
TEST_IGNORE_MESSAGE("bind() not supported");
43+
} else {
44+
TEST_ASSERT_EQUAL(NSAPI_ERROR_NO_SOCKET, bind_result);
45+
}
4146

4247
delete sock;
4348

TESTS/netsocket/tcp/tcpsocket_bind_wrong_type.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,12 @@ void TCPSOCKET_BIND_WRONG_TYPE()
4040
TEST_ASSERT_EQUAL(NSAPI_ERROR_OK, sock->open(get_interface()));
4141
char addr_bytes[16] = {0xfe, 0x80, 0xff, 0x1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
4242
SocketAddress sockAddr = SocketAddress(addr_bytes, NSAPI_IPv4, 80);
43-
TEST_ASSERT_EQUAL(NSAPI_ERROR_PARAMETER, sock->bind(sockAddr));
43+
nsapi_error_t bind_result = sock->bind(sockAddr);
44+
if (bind_result == NSAPI_ERROR_UNSUPPORTED) {
45+
TEST_IGNORE_MESSAGE("bind() not supported");
46+
} else {
47+
TEST_ASSERT_EQUAL(NSAPI_ERROR_PARAMETER, bind_result);
48+
}
4449

4550
delete sock;
4651

TESTS/netsocket/udp/udpsocket_bind_address.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,12 @@ void UDPSOCKET_BIND_ADDRESS()
3939
}
4040
TEST_ASSERT_EQUAL(NSAPI_ERROR_OK, sock->open(get_interface()));
4141
SocketAddress sockAddr = SocketAddress(get_interface()->get_ip_address(), 80);
42-
TEST_ASSERT_EQUAL(NSAPI_ERROR_OK, sock->bind(sockAddr));
42+
nsapi_error_t bind_result = sock->bind(sockAddr);
43+
if (bind_result == NSAPI_ERROR_UNSUPPORTED) {
44+
TEST_IGNORE_MESSAGE("bind() not supported");
45+
} else {
46+
TEST_ASSERT_EQUAL(NSAPI_ERROR_OK, bind_result);
47+
}
4348

4449
delete sock;
4550

TESTS/netsocket/udp/udpsocket_bind_address_invalid.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,12 @@ void UDPSOCKET_BIND_ADDRESS_INVALID()
3838
TEST_FAIL();
3939
}
4040
TEST_ASSERT_EQUAL(NSAPI_ERROR_OK, sock->open(get_interface()));
41-
TEST_ASSERT_EQUAL(NSAPI_ERROR_PARAMETER, sock->bind("190.2.3.4", 1024));
41+
nsapi_error_t bind_result = sock->bind("190.2.3.4", 1024);
42+
if (bind_result == NSAPI_ERROR_UNSUPPORTED) {
43+
TEST_IGNORE_MESSAGE("bind() not supported");
44+
} else {
45+
TEST_ASSERT_EQUAL(NSAPI_ERROR_PARAMETER, bind_result);
46+
}
4247

4348
delete sock;
4449

TESTS/netsocket/udp/udpsocket_bind_address_null.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,12 @@ void UDPSOCKET_BIND_ADDRESS_NULL()
3838
TEST_FAIL();
3939
}
4040
TEST_ASSERT_EQUAL(NSAPI_ERROR_OK, sock->open(get_interface()));
41-
TEST_ASSERT_EQUAL(NSAPI_ERROR_OK, sock->bind(NULL, 1024));
41+
nsapi_error_t bind_result = sock->bind(NULL, 1024);
42+
if (bind_result == NSAPI_ERROR_UNSUPPORTED) {
43+
TEST_IGNORE_MESSAGE("bind() not supported");
44+
} else {
45+
TEST_ASSERT_EQUAL(NSAPI_ERROR_OK, bind_result);
46+
}
4247

4348
delete sock;
4449

TESTS/netsocket/udp/udpsocket_bind_address_port.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,12 @@ void UDPSOCKET_BIND_ADDRESS_PORT()
3838
TEST_FAIL();
3939
}
4040
TEST_ASSERT_EQUAL(NSAPI_ERROR_OK, sock->open(get_interface()));
41-
TEST_ASSERT_EQUAL(NSAPI_ERROR_OK, sock->bind(get_interface()->get_ip_address(), 80));
41+
nsapi_error_t bind_result = sock->bind(get_interface()->get_ip_address(), 80);
42+
if (bind_result == NSAPI_ERROR_UNSUPPORTED) {
43+
TEST_IGNORE_MESSAGE("bind() not supported");
44+
} else {
45+
TEST_ASSERT_EQUAL(NSAPI_ERROR_OK, bind_result);
46+
}
4247

4348
delete sock;
4449

TESTS/netsocket/udp/udpsocket_bind_port.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,12 @@ void UDPSOCKET_BIND_PORT()
3838
TEST_FAIL();
3939
}
4040
TEST_ASSERT_EQUAL(NSAPI_ERROR_OK, sock->open(get_interface()));
41-
TEST_ASSERT_EQUAL(NSAPI_ERROR_OK, sock->bind(1024));
41+
nsapi_error_t bind_result = sock->bind(1024);
42+
if (bind_result == NSAPI_ERROR_UNSUPPORTED) {
43+
TEST_IGNORE_MESSAGE("bind() not supported");
44+
} else {
45+
TEST_ASSERT_EQUAL(NSAPI_ERROR_OK, bind_result);
46+
}
4247

4348
delete sock;
4449

TESTS/netsocket/udp/udpsocket_bind_port_fail.cpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,14 @@ void UDPSOCKET_BIND_PORT_FAIL()
3838
TEST_FAIL();
3939
}
4040
TEST_ASSERT_EQUAL(NSAPI_ERROR_OK, sock->open(get_interface()));
41-
TEST_ASSERT_EQUAL(NSAPI_ERROR_OK, sock->bind(1024));
41+
nsapi_error_t bind_result = sock->bind(1024);
42+
if (bind_result == NSAPI_ERROR_UNSUPPORTED) {
43+
TEST_IGNORE_MESSAGE("bind() not supported");
44+
delete sock;
45+
return;
46+
} else {
47+
TEST_ASSERT_EQUAL(NSAPI_ERROR_OK, bind_result);
48+
}
4249

4350
UDPSocket *sock2 = new UDPSocket;
4451
if (!sock2) {

TESTS/netsocket/udp/udpsocket_bind_unopened.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,12 @@ void UDPSOCKET_BIND_UNOPENED()
3737
if (!sock) {
3838
TEST_FAIL();
3939
}
40-
TEST_ASSERT_EQUAL(NSAPI_ERROR_NO_SOCKET, sock->bind(1024));
40+
nsapi_error_t bind_result = sock->bind(1024);
41+
if (bind_result == NSAPI_ERROR_UNSUPPORTED) {
42+
TEST_IGNORE_MESSAGE("bind() not supported");
43+
} else {
44+
TEST_ASSERT_EQUAL(NSAPI_ERROR_NO_SOCKET, bind_result);
45+
}
4146

4247
delete sock;
4348

TESTS/netsocket/udp/udpsocket_bind_wrong_type.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,12 @@ void UDPSOCKET_BIND_WRONG_TYPE()
4040
TEST_ASSERT_EQUAL(NSAPI_ERROR_OK, sock->open(get_interface()));
4141
char addr_bytes[16] = {0xfe, 0x80, 0xff, 0x1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
4242
SocketAddress sockAddr = SocketAddress(addr_bytes, NSAPI_IPv4, 80);
43-
TEST_ASSERT_EQUAL(NSAPI_ERROR_PARAMETER, sock->bind(sockAddr));
43+
nsapi_error_t bind_result = sock->bind(sockAddr);
44+
if (bind_result == NSAPI_ERROR_UNSUPPORTED) {
45+
TEST_IGNORE_MESSAGE("bind() not supported");
46+
} else {
47+
TEST_ASSERT_EQUAL(NSAPI_ERROR_PARAMETER, bind_result);
48+
}
4449

4550
delete sock;
4651

0 commit comments

Comments
 (0)