diff options
author | sapier <Sapier at GMX dot net> | 2014-06-20 22:35:50 +0200 |
---|---|---|
committer | sapier <Sapier at GMX dot net> | 2014-06-20 22:35:50 +0200 |
commit | 2b9beead3816709aca55ce17e647f47fd6c0314c (patch) | |
tree | 2af1bc5a1276c38f26fc0b1b9241635cba889f85 /src | |
parent | c86b78c9b725873451102ba78ef0820ce2056487 (diff) | |
download | minetest-2b9beead3816709aca55ce17e647f47fd6c0314c.tar.gz minetest-2b9beead3816709aca55ce17e647f47fd6c0314c.tar.bz2 minetest-2b9beead3816709aca55ce17e647f47fd6c0314c.zip |
Don't handle lack of IPv6 as fatal in unit tests
Diffstat (limited to 'src')
-rw-r--r-- | src/test.cpp | 33 |
1 files changed, 20 insertions, 13 deletions
diff --git a/src/test.cpp b/src/test.cpp index dd2691947..8a080454b 100644 --- a/src/test.cpp +++ b/src/test.cpp @@ -1517,22 +1517,29 @@ struct TestSocket: public TestBase const char sendbuffer[] = "hello world!"; IPv6AddressBytes bytes; bytes.bytes[15] = 1; - socket6.Send(Address(&bytes, port), sendbuffer, sizeof(sendbuffer)); + + try { + socket6.Send(Address(&bytes, port), sendbuffer, sizeof(sendbuffer)); - sleep_ms(50); + sleep_ms(50); - char rcvbuffer[256]; - memset(rcvbuffer, 0, sizeof(rcvbuffer)); - Address sender; - for(;;) - { - int bytes_read = socket6.Receive(sender, rcvbuffer, sizeof(rcvbuffer)); - if(bytes_read < 0) - break; + char rcvbuffer[256]; + memset(rcvbuffer, 0, sizeof(rcvbuffer)); + Address sender; + for(;;) + { + 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 - 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); + catch (SendFailedException e) { + errorstream << "IPv6 support enabled but not available!" << std::endl; + } + } // IPv4 socket test |