qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cliffjan...@apache.org
Subject [1/3] qpid-proton git commit: PROTON-1349: partial implementation that compiles but does not yet pass tests. Added so that C++ proactor changes could be checked in.
Date Sat, 01 Jul 2017 01:07:20 GMT
Repository: qpid-proton
Updated Branches:
  refs/heads/master 0822dd921 -> e1c3cd031


http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/e1c3cd03/proton-c/src/tests/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/proton-c/src/tests/CMakeLists.txt b/proton-c/src/tests/CMakeLists.txt
index 9e9d1cd..50ea677 100644
--- a/proton-c/src/tests/CMakeLists.txt
+++ b/proton-c/src/tests/CMakeLists.txt
@@ -30,7 +30,7 @@ endif ()
 
 macro (pn_add_c_test test)
   add_executable (${test} ${ARGN})
-  target_link_libraries (${test} qpid-proton)
+  target_link_libraries (${test} qpid-proton ${PLATFORM_LIBS})
   if (BUILD_WITH_CXX)
     set_source_files_properties (${ARGN} PROPERTIES LANGUAGE CXX)
   endif (BUILD_WITH_CXX)
@@ -56,10 +56,14 @@ pn_add_c_test (c-condition-tests condition.c)
 pn_add_c_test (c-connection-driver-tests connection_driver.c)
 
 if(HAS_PROACTOR)
-  pn_add_c_test (c-proactor-tests proactor.c)
+  if(WIN32)
+    message(STATUS "Windows IOCP proactor tests temporarily suspended")
+  else(WIN32)
+    pn_add_c_test (c-proactor-tests proactor.c)
+  endif(WIN32)
 
   if(WIN32)
-    set(path "$<TARGET_FILE_DIR:proactor-broker>;$<TARGET_FILE_DIR:qpid-proton>")
+    # set(path "$<TARGET_FILE_DIR:proactor-broker>;$<TARGET_FILE_DIR:qpid-proton>")
   else(WIN32)
     set(path "${CMAKE_CURRENT_BINARY_DIR}:${CMAKE_BINARY_DIR}/examples/c/proactor:$ENV{PATH}")
   endif(WIN32)

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/e1c3cd03/proton-c/src/tests/proactor.c
----------------------------------------------------------------------
diff --git a/proton-c/src/tests/proactor.c b/proton-c/src/tests/proactor.c
index 817711e..9cb0e63 100644
--- a/proton-c/src/tests/proactor.c
+++ b/proton-c/src/tests/proactor.c
@@ -17,11 +17,11 @@
  * under the License.
  */
 
+#include "../platform/platform.h"
 #include "test_tools.h"
 #include "test_handler.h"
 #include "test_config.h"
 #include "../proactor/proactor-internal.h"
-#include "../platform/platform.h"
 
 #include <proton/condition.h>
 #include <proton/connection.h>
@@ -39,12 +39,27 @@
 static const char *localhost = ""; /* host for connect/listen */
 
 /* Some very simple platform-secifics to acquire an unused socket */
-#if defined(WIN32)
+#if defined(_WIN32)
 
 #include <winsock2.h>
 #include <ws2tcpip.h>
 typedef SOCKET sock_t;
 void sock_close(sock_t sock) { closesocket(sock); }
+// pni_snprintf not exported.  We can live with a simplified version
+// for this test's limited use. Abort if that assumption is wrong.
+#define pni_snprintf pnitst_snprintf
+static int pnitst_snprintf(char *buf, size_t count, const char *fmt, ...) {
+  va_list ap;
+  va_start(ap, fmt);
+  int n = _vsnprintf(buf, count, fmt, ap);
+  va_end(ap);
+  if (count == 0 || n < 0) {
+    perror("proton internal failure on Windows test snprintf");
+    abort();
+  }
+  // Windows and C99 are in agreement.
+  return n;
+}
 
 #else  /* POSIX */
 
@@ -818,8 +833,10 @@ static void test_parse_addr(test_t *t) {
    These headers are *only* needed for test_netaddr and only for the getnameinfo part.
    This is the only non-portable part of the proactor test suite.
    */
+#if !defined(_WIN32)
 #include <sys/socket.h>         /* For socket_storage */
 #include <netdb.h>              /* For NI_MAXHOST/NI_MAXSERV */
+#endif
 
 static void test_netaddr(test_t *t) {
   test_proactor_t tps[] ={ test_proactor(t, open_wake_handler), test_proactor(t, listen_handler)
};


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org


Mime
View raw message