Re: [1/4] ws2_32/tests: Resend: IPv6 tests for WSAAddressToStringA
On Mo, 2009-04-27 at 20:48 +1000, Jeff Latimer wrote:
- ok( len == sizeof( expect4 ), "Got size %d\n", len); + ok( len == sizeof( expect4 ), "Expected size to be %d, got %d\n", sizeof( expect4 ), len);
Do not use sizeof() in a test.
+ /*check to see it IPv6 is available */ + v6 = socket(AF_INET6, SOCK_STREAM, IPPROTO_TCP); + if (v6 == INVALID_SOCKET) { + skip("Could not create IPv6 socket (LastError: %d; %d expected if IPv6 not available).\n", + WSAGetLastError(), WSAEAFNOSUPPORT); + goto end;
There is no reason, that the reader must guess from the log, if the result is a failure or an expected behavior. You should detect, that IPv6 is not available and handle that case nice. if ((v6 == INVALID_SOCKET) && (WSAGetLastError() == WSAEAFNOSUPPORT)) { skip("IPv6 not supported on this system\n"); goto end; } ok(v6 !== INVALID_SOCKET, "create an IPv6 socket failed with %d\n", WSAGetLastError()); if (v6 == INVALID_SOCKET) { skip("No IPv6 socket\n"); goto end; } I know, that the same message is already in the current logs. That should be handled the same way. Thanks for pick up IPv6 -- By by ... Detlef
Hi Jeff, I just wanted to clarify one of Detlef's comments:
- ok( len == sizeof( expect4 ), "Got size %d\n", len); + ok( len == sizeof( expect4 ), "Expected size to be %d, got %d\n", sizeof( expect4 ), len);
Do not use sizeof() in a test.
Using sizeof is okay, but printing the result of it is not, due to compile warnings this will introduce on some platforms. Basically, omit this change from your patch. Thanks, --Juan
participants (2)
-
Detlef Riekenberg -
Juan Lang