Repository: qpid-proton Updated Branches: refs/heads/master ac1dd7c81 -> c39a691ed
Revert "PROTON-1192: Improve ctest configuration to directly set the test environment without using" - This has issues with older versions of cmake because they don't expand generator expressions in set_targets_properties - Also problems on Windows because of the different path separation character there This reverts commit ac1dd7c81390692f923ef7b62d1a6170b350d169. Project: http://git-wip-us.apache.org/repos/asf/qpid-proton/repo Commit: http://git-wip-us.apache.org/repos/asf/qpid-proton/commit/c39a691e Tree: http://git-wip-us.apache.org/repos/asf/qpid-proton/tree/c39a691e Diff: http://git-wip-us.apache.org/repos/asf/qpid-proton/diff/c39a691e Branch: refs/heads/master Commit: c39a691eded67b35dd40dca3eb316dac3b775369 Parents: ac1dd7c Author: Andrew Stitcher <[email protected]> Authored: Thu May 5 17:38:48 2016 -0400 Committer: Andrew Stitcher <[email protected]> Committed: Thu May 5 17:39:08 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, 46 insertions(+), 69 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/c39a691e/examples/cpp/CMakeLists.txt ---------------------------------------------------------------------- diff --git a/examples/cpp/CMakeLists.txt b/examples/cpp/CMakeLists.txt index a69183f..2cb258f 100644 --- a/examples/cpp/CMakeLists.txt +++ b/examples/cpp/CMakeLists.txt @@ -57,16 +57,8 @@ endfunction() set_test_path("$<TARGET_FILE_DIR:broker>") -set(test_env - "PATH=${test_path}" - ${VALGRIND_ENV} -) - add_test(NAME cpp_container_example_test - COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/example_test.py -v ContainerExampleTest) -set_tests_properties(cpp_container_example_test PROPERTIES - ENVIRONMENT "${test_env}" -) + COMMAND ${env_py} -- "PATH=${test_path}" ${VALGRIND_ENV} ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/example_test.py -v ContainerExampleTest) # TODO aconway 2016-04-26: need portable MT and IO examples. if(CMAKE_SYSTEM_NAME STREQUAL "Linux" AND HAS_CPP11) @@ -79,10 +71,7 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Linux" AND HAS_CPP11) endforeach() add_test(NAME cpp_mt_example_test - COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/example_test.py -v MtBrokerTest) - set_tests_properties(cpp_mt_example_test PROPERTIES - ENVIRONMENT "${test_env}" - ) + COMMAND ${env_py} -- "PATH=${test_path}" ${VALGRIND_ENV} ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/example_test.py -v MtBrokerTest) endif() http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/c39a691e/proton-c/CMakeLists.txt ---------------------------------------------------------------------- diff --git a/proton-c/CMakeLists.txt b/proton-c/CMakeLists.txt index bbab01f..372e67c 100644 --- a/proton-c/CMakeLists.txt +++ b/proton-c/CMakeLists.txt @@ -506,19 +506,14 @@ if (BUILD_PYTHON) to_native_path ("${py_pythonpath}" py_pythonpath) to_native_path ("${py_path}" py_path) - 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}" - ) + 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") # Eventually, we'll get rid of this check when other # platforms will be supported. Since `setup.py` will skip @@ -526,26 +521,24 @@ 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 ${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}" - ) + 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") else (TOX_EXE) message(STATUS "The tox tool is not available - skipping the python-tox-tests") endif (TOX_EXE) @@ -577,34 +570,26 @@ 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 ${RUBY_EXE} example_test.rb -v) - set_tests_properties(ruby-example-test PROPERTIES - ENVIRONMENT "${ruby_test_env}" - ) + COMMAND ${env_py} -- "PATH=${rb_path}" "RUBYLIB=${rb_rubylib}" + ${RUBY_EXE} example_test.rb -v) # 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 "${rb_root}/proton-test") - set_tests_properties(ruby-unit-test PROPERTIES - ENVIRONMENT "${ruby_test_env}" - ) + COMMAND ${env_py} "PATH=${rb_path}" "RUBYLIB=${rb_rubylib}" + "${rb_root}/proton-test") # 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 ${RSPEC_EXE}) - set_tests_properties(ruby-spec-test PROPERTIES - ENVIRONMENT "${ruby_test_env}" - ) + COMMAND ${env_py} "PATH=${rb_path}" "RUBYLIB=${rb_rubylib}" + ${RSPEC_EXE}) else(RSPEC_EXE) message (STATUS "Cannot find rspec, skipping rspec tests") http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/c39a691e/proton-c/bindings/cpp/CMakeLists.txt ---------------------------------------------------------------------- diff --git a/proton-c/bindings/cpp/CMakeLists.txt b/proton-c/bindings/cpp/CMakeLists.txt index 296aa56..2aec4e2 100644 --- a/proton-c/bindings/cpp/CMakeLists.txt +++ b/proton-c/bindings/cpp/CMakeLists.txt @@ -167,11 +167,13 @@ 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) - set_tests_properties(cpp_${test} PROPERTIES - ENVIRONMENT "PATH=$<TARGET_FILE_DIR:qpid-proton>" - ) + 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}) endif () endmacro(add_cpp_test) http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/c39a691e/proton-c/src/tests/CMakeLists.txt ---------------------------------------------------------------------- diff --git a/proton-c/src/tests/CMakeLists.txt b/proton-c/src/tests/CMakeLists.txt index 53a676b..3ea8bcf 100644 --- a/proton-c/src/tests/CMakeLists.txt +++ b/proton-c/src/tests/CMakeLists.txt @@ -30,12 +30,13 @@ 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) - set_tests_properties(${test} PROPERTIES - ENVIRONMENT "PATH=$<TARGET_FILE_DIR:qpid-proton>" - ) + 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}) endif () endmacro(pn_add_c_test) --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
