Don't handle lack of IPv6 as fatal in unit tests

This commit is contained in:
sapier 2014-06-20 22:35:50 +02:00
parent c86b78c9b7
commit 2b9beead38

@ -1517,22 +1517,29 @@ struct TestSocket: public TestBase
const char sendbuffer[] = "hello world!"; const char sendbuffer[] = "hello world!";
IPv6AddressBytes bytes; IPv6AddressBytes bytes;
bytes.bytes[15] = 1; bytes.bytes[15] = 1;
socket6.Send(Address(&bytes, port), sendbuffer, sizeof(sendbuffer));
sleep_ms(50); try {
socket6.Send(Address(&bytes, port), sendbuffer, sizeof(sendbuffer));
char rcvbuffer[256]; sleep_ms(50);
memset(rcvbuffer, 0, sizeof(rcvbuffer));
Address sender; char rcvbuffer[256];
for(;;) memset(rcvbuffer, 0, sizeof(rcvbuffer));
{ Address sender;
int bytes_read = socket6.Receive(sender, rcvbuffer, sizeof(rcvbuffer)); for(;;)
if(bytes_read < 0) {
break; int bytes_read = socket6.Receive(sender, rcvbuffer, sizeof(rcvbuffer));
if(bytes_read < 0)
break;
}
//FIXME: This fails on some systems
UASSERT(strncmp(sendbuffer, rcvbuffer, sizeof(sendbuffer))==0);
UASSERT(memcmp(sender.getAddress6().sin6_addr.s6_addr, Address(&bytes, 0).getAddress6().sin6_addr.s6_addr, 16) == 0);
} }
//FIXME: This fails on some systems catch (SendFailedException e) {
UASSERT(strncmp(sendbuffer, rcvbuffer, sizeof(sendbuffer))==0); errorstream << "IPv6 support enabled but not available!" << std::endl;
UASSERT(memcmp(sender.getAddress6().sin6_addr.s6_addr, Address(&bytes, 0).getAddress6().sin6_addr.s6_addr, 16) == 0); }
} }
// IPv4 socket test // IPv4 socket test