test-vconn: Change the expected error for Windows.
authorGurucharan Shetty <shettyg@nicira.com>
Wed, 25 Jun 2014 02:52:54 +0000 (02:52 +0000)
committerGurucharan Shetty <gshetty@nicira.com>
Tue, 1 Jul 2014 18:30:04 +0000 (11:30 -0700)
On Windows ECONNRESET is WSAECONNRESET.

Also, "unix" connections are done through TCP sockets.
For the 'refuse-connection' test, the error message for Windows
is WSAECONNRESET instead of EPIPE.

Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
tests/test-vconn.c

index ec66f86..8a2efa3 100644 (file)
@@ -156,12 +156,20 @@ test_refuse_connection(int argc OVS_UNUSED, char *argv[])
 
     error = vconn_connect_block(vconn);
     if (!strcmp(type, "tcp")) {
-        if (error != ECONNRESET && error != EPIPE) {
+        if (error != ECONNRESET && error != EPIPE
+#ifdef _WIN32
+            && error != WSAECONNRESET
+#endif
+            ) {
             ovs_fatal(0, "unexpected vconn_connect() return value %d (%s)",
                       error, ovs_strerror(error));
         }
     } else if (!strcmp(type, "unix")) {
+#ifndef _WIN32
         CHECK_ERRNO(error, EPIPE);
+#else
+        CHECK_ERRNO(error, WSAECONNRESET);
+#endif
     } else if (!strcmp(type, "ssl")) {
         if (error != EPROTO && error != ECONNRESET) {
             ovs_fatal(0, "unexpected vconn_connect() return value %d (%s)",
@@ -194,7 +202,11 @@ test_accept_then_close(int argc OVS_UNUSED, char *argv[])
 
     error = vconn_connect_block(vconn);
     if (!strcmp(type, "tcp") || !strcmp(type, "unix")) {
-        if (error != ECONNRESET && error != EPIPE) {
+        if (error != ECONNRESET && error != EPIPE
+#ifdef _WIN32
+            && error != WSAECONNRESET
+#endif
+            ) {
             ovs_fatal(0, "unexpected vconn_connect() return value %d (%s)",
                       error, ovs_strerror(error));
         }