[ovs-dev] [PATCH 08/17] test-vconn: Change the expected error for Windows.

Gurucharan Shetty shettyg at nicira.com
Tue Jun 24 18:52:54 UTC 2014


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 at nicira.com>
---
 tests/test-vconn.c |   16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)

diff --git a/tests/test-vconn.c b/tests/test-vconn.c
index ec66f86..8a2efa3 100644
--- a/tests/test-vconn.c
+++ b/tests/test-vconn.c
@@ -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));
         }
-- 
1.7.9.5




More information about the dev mailing list