You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by as...@apache.org on 2016/05/05 20:55:53 UTC

qpid-proton git commit: PROTON-1192: Improve ctest configuration to directly set the test environment without using the env.py wrapper script

Repository: qpid-proton
Updated Branches:
  refs/heads/master 8c73cd2c8 -> ac1dd7c81


PROTON-1192: Improve ctest configuration to directly set the test environment without using
the env.py wrapper script


Project: http://git-wip-us.apache.org/repos/asf/qpid-proton/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-proton/commit/ac1dd7c8
Tree: http://git-wip-us.apache.org/repos/asf/qpid-proton/tree/ac1dd7c8
Diff: http://git-wip-us.apache.org/repos/asf/qpid-proton/diff/ac1dd7c8

Branch: refs/heads/master
Commit: ac1dd7c81390692f923ef7b62d1a6170b350d169
Parents: 8c73cd2
Author: Andrew Stitcher <as...@apache.org>
Authored: Thu May 5 16:54:43 2016 -0400
Committer: Andrew Stitcher <as...@apache.org>
Committed: Thu May 5 16:54:43 2016 -0400

----------------------------------------------------------------------
 examples/cpp/CMakeLists.txt          | 15 +++++-
 proton-c/CMakeLists.txt              | 79 ++++++++++++++++++-------------
 proton-c/bindings/cpp/CMakeLists.txt | 10 ++--
 proton-c/src/tests/CMakeLists.txt    | 11 ++---
 4 files changed, 69 insertions(+), 46 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/ac1dd7c8/examples/cpp/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/examples/cpp/CMakeLists.txt b/examples/cpp/CMakeLists.txt
index 2cb258f..a69183f 100644
--- a/examples/cpp/CMakeLists.txt
+++ b/examples/cpp/CMakeLists.txt
@@ -57,8 +57,16 @@ endfunction()
 
 set_test_path("$<TARGET_FILE_DIR:broker>")
 
+set(test_env
+  "PATH=${test_path}"
+  ${VALGRIND_ENV}
+)
+
 add_test(NAME cpp_container_example_test
-  COMMAND ${env_py} -- "PATH=${test_path}" ${VALGRIND_ENV} ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/example_test.py -v ContainerExampleTest)
+  COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/example_test.py -v ContainerExampleTest)
+set_tests_properties(cpp_container_example_test PROPERTIES
+  ENVIRONMENT "${test_env}"
+)
 
 # TODO aconway 2016-04-26: need portable MT and IO examples.
 if(CMAKE_SYSTEM_NAME STREQUAL "Linux" AND HAS_CPP11)
@@ -71,7 +79,10 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Linux" AND HAS_CPP11)
   endforeach()
 
   add_test(NAME cpp_mt_example_test
-    COMMAND ${env_py} -- "PATH=${test_path}" ${VALGRIND_ENV} ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/example_test.py -v MtBrokerTest)
+    COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/example_test.py -v MtBrokerTest)
+  set_tests_properties(cpp_mt_example_test PROPERTIES
+    ENVIRONMENT "${test_env}"
+  )
 endif()
 
 

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/ac1dd7c8/proton-c/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/proton-c/CMakeLists.txt b/proton-c/CMakeLists.txt
index 372e67c..bbab01f 100644
--- a/proton-c/CMakeLists.txt
+++ b/proton-c/CMakeLists.txt
@@ -506,14 +506,19 @@ if (BUILD_PYTHON)
   to_native_path ("${py_pythonpath}" py_pythonpath)
 
   to_native_path ("${py_path}" py_path)
-  add_test (NAME python-test
-            COMMAND ${env_py}
-              "PATH=${py_path}" "PYTHONPATH=${py_pythonpath}" "PKG_CONFIG_PATH=${pn_c_root}"
-              "CLASSPATH=${CMAKE_BINARY_DIR}/proton-j/proton-j.jar"
-              "SASLPASSWD=${SASLPASSWD_EXE}"
-              ${VALGRIND_ENV}
-              ${PYTHON_EXECUTABLE} "${py_root}/proton-test")
-  set_tests_properties(python-test PROPERTIES PASS_REGULAR_EXPRESSION "Totals: .* 0 failed")
+  add_test (NAME python-test COMMAND ${PYTHON_EXECUTABLE} "${py_root}/proton-test")
+  set (env_vars
+    "PATH=${py_path}"
+    "PYTHONPATH=${py_pythonpath}"
+    "PKG_CONFIG_PATH=${pn_c_root}"
+    "CLASSPATH=${CMAKE_BINARY_DIR}/proton-j/proton-j.jar"
+    "SASLPASSWD=${SASLPASSWD_EXE}"
+    ${VALGRIND_ENV}
+  )
+  set_tests_properties(python-test PROPERTIES
+    PASS_REGULAR_EXPRESSION "Totals: .* 0 failed"
+    ENVIRONMENT "${env_vars}"
+  )
 
   # Eventually, we'll get rid of this check when other
   # platforms will be supported. Since `setup.py` will skip
@@ -521,24 +526,26 @@ if (BUILD_PYTHON)
   # to try to run them.
   option(TOX_TEST "Enable muti-version python testing with TOX" ON)
   if (CMAKE_SYSTEM_NAME STREQUAL Linux AND TOX_TEST)
-     find_program(TOX_EXE "tox")
-     if (TOX_EXE)
-       configure_file(
-         "${CMAKE_CURRENT_SOURCE_DIR}/tox.ini.in"
-         "${CMAKE_CURRENT_BINARY_DIR}/tox.ini")
-         to_native_path ("${py_path}" py_path)
-         add_test (NAME python-tox-test
-                   COMMAND ${env_py}
-		   "PATH=${py_path}" "QPID_PROTON_SRC=${CMAKE_CURRENT_SOURCE_DIR}/../"
-                   "CLASSPATH=${CMAKE_BINARY_DIR}/proton-j/proton-j.jar"
-                   "SASLPASSWD=${SASLPASSWD_EXE}"
-                   "SWIG=${SWIG_EXECUTABLE}"
-                   ${VALGRIND_ENV}
-                   ${TOX_EXE})
-         set_tests_properties(python-tox-test
-                              PROPERTIES
-                              PASS_REGULAR_EXPRESSION "Totals: .* ignored, 0 failed"
-                              FAIL_REGULAR_EXPRESSION "ERROR:[ ]+py[0-9]*: commands failed")
+    find_program(TOX_EXE "tox")
+    if (TOX_EXE)
+      configure_file(
+        "${CMAKE_CURRENT_SOURCE_DIR}/tox.ini.in"
+        "${CMAKE_CURRENT_BINARY_DIR}/tox.ini")
+        to_native_path ("${py_path}" py_path)
+        add_test (NAME python-tox-test COMMAND ${TOX_EXE})
+        set (tox_test_env_vars
+          "PATH=${py_path}"
+          "QPID_PROTON_SRC=${CMAKE_SOURCE_DIR}"
+          "CLASSPATH=${CMAKE_BINARY_DIR}/proton-j/proton-j.jar"
+          "SASLPASSWD=${SASLPASSWD_EXE}"
+          "SWIG=${SWIG_EXECUTABLE}"
+          ${VALGRIND_ENV}
+        )
+        set_tests_properties(python-tox-test PROPERTIES
+          PASS_REGULAR_EXPRESSION "Totals: .* ignored, 0 failed"
+          FAIL_REGULAR_EXPRESSION "ERROR:[ ]+py[0-9]*: commands failed"
+          ENVIRONMENT "${tox_test_env_vars}"
+        )
      else (TOX_EXE)
          message(STATUS "The tox tool is not available - skipping the python-tox-tests")
      endif (TOX_EXE)
@@ -570,26 +577,34 @@ if (RUBY_EXE AND BUILD_RUBY)
   to_native_path("${rb_path}" rb_path)
   to_native_path("${rb_rubylib}" rb_rubylib)
 
+  set(ruby_test_env "PATH=${rb_path}" "RUBYLIB=${rb_rubylib}")
+
   # ruby example tests have no dependencies other than standard ruby.
   add_test(NAME ruby-example-test
     WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/examples/ruby
-    COMMAND ${env_py} -- "PATH=${rb_path}" "RUBYLIB=${rb_rubylib}"
-    ${RUBY_EXE} example_test.rb -v)
+    COMMAND ${RUBY_EXE} example_test.rb -v)
+  set_tests_properties(ruby-example-test PROPERTIES
+    ENVIRONMENT "${ruby_test_env}"
+  )
 
   # ruby unit tests:  tests/ruby/proton-test
   # only enable the tests if the Ruby gem dependencies were found
   if (DEFAULT_RUBY_TESTING)
     add_test (NAME ruby-unit-test
-              COMMAND ${env_py} "PATH=${rb_path}" "RUBYLIB=${rb_rubylib}"
-                      "${rb_root}/proton-test")
+              COMMAND "${rb_root}/proton-test")
+    set_tests_properties(ruby-unit-test PROPERTIES
+      ENVIRONMENT "${ruby_test_env}"
+    )
 
     # ruby spec tests
     find_program(RSPEC_EXE rspec)
     if (RSPEC_EXE)
       add_test (NAME ruby-spec-test
                 WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/bindings/ruby
-                COMMAND ${env_py} "PATH=${rb_path}" "RUBYLIB=${rb_rubylib}"
-                        ${RSPEC_EXE})
+                COMMAND ${RSPEC_EXE})
+      set_tests_properties(ruby-spec-test PROPERTIES
+        ENVIRONMENT "${ruby_test_env}"
+      )
 
     else(RSPEC_EXE)
       message (STATUS "Cannot find rspec, skipping rspec tests")

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/ac1dd7c8/proton-c/bindings/cpp/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/CMakeLists.txt b/proton-c/bindings/cpp/CMakeLists.txt
index 2aec4e2..296aa56 100644
--- a/proton-c/bindings/cpp/CMakeLists.txt
+++ b/proton-c/bindings/cpp/CMakeLists.txt
@@ -167,13 +167,11 @@ endif ()
 macro(add_cpp_test test)
   add_executable (${test} src/${test}.cpp)
   target_link_libraries (${test} qpid-proton qpid-proton-cpp)
+  add_test (NAME cpp_${test} COMMAND ${memcheck-cmd} $<TARGET_FILE:${test}> ${ARGN})
   if (CMAKE_SYSTEM_NAME STREQUAL Windows)
-    add_test (NAME cpp_${test}
-      COMMAND ${env_py}
-      "PATH=$<TARGET_FILE_DIR:qpid-proton>"
-      $<TARGET_FILE:${test}> ${ARGN})
-  else ()
-    add_test (NAME cpp_${test} COMMAND ${memcheck-cmd} ${CMAKE_CURRENT_BINARY_DIR}/${test} ${ARGN})
+    set_tests_properties(cpp_${test} PROPERTIES
+      ENVIRONMENT "PATH=$<TARGET_FILE_DIR:qpid-proton>"
+    )
   endif ()
 endmacro(add_cpp_test)
 

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/ac1dd7c8/proton-c/src/tests/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/proton-c/src/tests/CMakeLists.txt b/proton-c/src/tests/CMakeLists.txt
index 3ea8bcf..53a676b 100644
--- a/proton-c/src/tests/CMakeLists.txt
+++ b/proton-c/src/tests/CMakeLists.txt
@@ -30,13 +30,12 @@ macro (pn_add_c_test test file)
   if (BUILD_WITH_CXX)
     set_source_files_properties (${file} PROPERTIES LANGUAGE CXX)
   endif (BUILD_WITH_CXX)
+
+  add_test (NAME ${test} COMMAND ${memcheck-cmd} $<TARGET_FILE:${test}>)
   if (CMAKE_SYSTEM_NAME STREQUAL Windows)
-    add_test (NAME ${test}
-              COMMAND ${env_py}
-                "PATH=$<TARGET_FILE_DIR:qpid-proton>"
-                $<TARGET_FILE:${test}>)
-  else ()
-    add_test (${test} ${memcheck-cmd} ${CMAKE_CURRENT_BINARY_DIR}/${test})
+    set_tests_properties(${test} PROPERTIES
+      ENVIRONMENT "PATH=$<TARGET_FILE_DIR:qpid-proton>"
+    )
   endif ()
 endmacro(pn_add_c_test)
 


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