You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by cl...@apache.org on 2013/02/15 07:01:24 UTC

svn commit: r1446451 - in /qpid/proton/trunk: CMakeLists.txt proton-c/CMakeLists.txt proton-c/env.py

Author: cliffjansen
Date: Fri Feb 15 06:01:23 2013
New Revision: 1446451

URL: http://svn.apache.org/r1446451
Log:
PROTON-238: initial ctest support for Linux and Windows

Modified:
    qpid/proton/trunk/CMakeLists.txt
    qpid/proton/trunk/proton-c/CMakeLists.txt
    qpid/proton/trunk/proton-c/env.py

Modified: qpid/proton/trunk/CMakeLists.txt
URL: http://svn.apache.org/viewvc/qpid/proton/trunk/CMakeLists.txt?rev=1446451&r1=1446450&r2=1446451&view=diff
==============================================================================
--- qpid/proton/trunk/CMakeLists.txt (original)
+++ qpid/proton/trunk/CMakeLists.txt Fri Feb 15 06:01:23 2013
@@ -34,6 +34,10 @@ set (PN_VERSION_MAJOR 0)
 set (PN_VERSION_MINOR 3)
 set (PN_VERSION "${PN_VERSION_MAJOR}.${PN_VERSION_MINOR}")
 
+enable_testing()
+include (CTest)
+set (pn_test_root "${CMAKE_CURRENT_SOURCE_DIR}/tests")
+
 # Start of variables used during install
 set (INCLUDE_INSTALL_DIR include CACHE PATH "Include file directory")
 set (LIB_INSTALL_DIR "lib${LIB_SUFFIX}" CACHE PATH "Library object file directory")
@@ -67,3 +71,11 @@ add_subdirectory(proton-c)
 install (FILES LICENSE README TODO
          DESTINATION ${PROTON_SHARE})
 
+# add relevant CTest support
+find_program (MAVEN_EXECUTABLE mvn DOC "Location of the maven program")
+if (JAVA_FOUND AND MAVEN_EXECUTABLE AND DEFINED ENV{M2_HOME})
+  add_test (proton-jni mvn test -P proton-jni --file ${CMAKE_CURRENT_SOURCE_DIR}/pom.xml) 
+  set_tests_properties(proton-jni PROPERTIES PASS_REGULAR_EXPRESSION "Tests run:.*Failures: 0, Errors: 0")
+else (JAVA_FOUND AND MAVEN_EXECUTABLE AND DEFINED ENV{M2_HOME})
+  message (STATUS "Cannot find both Java and Maven: testing disabled for Proton-J and JNI Bindings")
+endif (JAVA_FOUND AND MAVEN_EXECUTABLE AND DEFINED ENV{M2_HOME})

Modified: qpid/proton/trunk/proton-c/CMakeLists.txt
URL: http://svn.apache.org/viewvc/qpid/proton/trunk/proton-c/CMakeLists.txt?rev=1446451&r1=1446450&r2=1446451&view=diff
==============================================================================
--- qpid/proton/trunk/proton-c/CMakeLists.txt (original)
+++ qpid/proton/trunk/proton-c/CMakeLists.txt Fri Feb 15 06:01:23 2013
@@ -338,3 +338,35 @@ configure_file(${CMAKE_CURRENT_SOURCE_DI
          ${CMAKE_CURRENT_BINARY_DIR}/libqpid-proton.pc @ONLY)
 install (FILES ${CMAKE_CURRENT_BINARY_DIR}/libqpid-proton.pc
          DESTINATION ${LIB_INSTALL_DIR}/pkgconfig)
+
+# CTest
+
+# suffix for Visual Studio targets.  Only support RelWithDebInfo for now.
+if (MSVC)
+  set (bld_suffix "/RelWithDebInfo")
+endif (MSVC)
+
+# directories of interest
+set (tdir1 "${pn_test_root}/python")
+set (tdir2 "${CMAKE_CURRENT_SOURCE_DIR}/bindings/python")
+set (tdir3 "${CMAKE_CURRENT_BINARY_DIR}/bindings/python")
+set (tdir4 "${CMAKE_CURRENT_BINARY_DIR}${bld_suffix}")
+
+
+# test #1:  python [...]tests/python/proton-test
+
+if (CMAKE_SYSTEM_NAME STREQUAL Windows)
+  # Windows uses a ';' separator and needs extra PATH help
+  set (newpath "PATH=$ENV{PATH};${tdir4}")
+  string (REGEX REPLACE "\\\\" "/" newpath "${newpath}")
+  add_test(proton-c python "${CMAKE_CURRENT_SOURCE_DIR}/env.py"
+           "PYTHONPATH=${tdir1};${tdir2};${tdir3};${tdir3}${bld_suffix}" 
+	   "${newpath}"
+           python "${pn_test_root}/python/proton-test")
+else (CMAKE_SYSTEM_NAME STREQUAL Windows)
+  add_test(proton-c python "${CMAKE_CURRENT_SOURCE_DIR}/env.py"
+           "PYTHONPATH=${tdir1}:${tdir2}:${tdir3}"
+           python "${pn_test_root}/python/proton-test")
+endif (CMAKE_SYSTEM_NAME STREQUAL Windows)
+
+set_tests_properties(proton-c PROPERTIES PASS_REGULAR_EXPRESSION "Totals:.*, 0 failed")

Modified: qpid/proton/trunk/proton-c/env.py
URL: http://svn.apache.org/viewvc/qpid/proton/trunk/proton-c/env.py?rev=1446451&r1=1446450&r2=1446451&view=diff
==============================================================================
--- qpid/proton/trunk/proton-c/env.py (original)
+++ qpid/proton/trunk/proton-c/env.py Fri Feb 15 06:01:23 2013
@@ -23,6 +23,7 @@
 
 import sys
 import os
+import subprocess
 from optparse import OptionParser
 
 def main(argv=None):
@@ -57,7 +58,8 @@ def main(argv=None):
     if len(args) == 0 or len(args[0]) == 0:
         raise Exception("Error: syntax error in command arguments")
 
-    os.execvpe(args[0], args, new_env)
+    p = subprocess.Popen(args, env=new_env)
+    p.wait()
     return 0
 
 if __name__ == "__main__":



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