aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorRenato Filho <renato.filho@openbossa.org>2010-07-20 14:50:00 -0300
committerRenato Filho <renato.filho@openbossa.org>2010-08-19 11:37:05 -0300
commit285c84f27d60df6bf117731fa71a33717d063013 (patch)
tree58ec8b2042684821150df124a0e84d593b73211b /tests
parent3478cb5e2d3ea79c265e10a0a5963c967aa48d79 (diff)
Fixed tests to run on windows.
Reviewer: Hugo Parente Lima <hugo.pl@gmail.com> Luciano Wolf <luciano.wolf@openbossa.org>
Diffstat (limited to 'tests')
-rw-r--r--tests/CMakeLists.txt44
-rwxr-xr-xtests/run_test.sh13
2 files changed, 27 insertions, 30 deletions
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
index 645e8b3a..32e31060 100644
--- a/tests/CMakeLists.txt
+++ b/tests/CMakeLists.txt
@@ -12,22 +12,32 @@ if(NOT CTEST_TESTING_TIMEOUT)
set(CTEST_TESTING_TIMEOUT 60)
endif()
-foreach(test_file ${TEST_FILES})
- string(REGEX MATCH "/([^/]+)_test.py" test_name ${test_file})
- list(FIND test_blacklist ${CMAKE_MATCH_1} expect_fail)
- add_test("${CMAKE_MATCH_1}" sh
- "${CMAKE_CURRENT_SOURCE_DIR}/run_test.sh"
- "${libsample_BINARY_DIR}:${libother_BINARY_DIR}:${libshiboken_BINARY_DIR}"
- "${sample_BINARY_DIR}:${other_BINARY_DIR}"
- "${PYTHON_EXECUTABLE}"
- "${test_file}")
- set_tests_properties(${CMAKE_MATCH_1} PROPERTIES TIMEOUT ${CTEST_TESTING_TIMEOUT})
- if (${expect_fail} GREATER -1)
- set_tests_properties(${CMAKE_MATCH_1} PROPERTIES WILL_FAIL TRUE)
- endif(${expect_fail} GREATER -1)
+if(CMAKE_VERSION VERSION_LESS 2.8)
+ message("CMake version greater than 2.8 necessary to run tests")
+else()
+ if(WIN32)
+ set(TEST_PYTHONPATH "${sample_BINARY_DIR};${other_BINARY_DIR}")
+ set(TEST_LIBRARY_PATH "$ENV{PATH};${libsample_BINARY_DIR};${libother_BINARY_DIR};${libshiboken_BINARY_DIR}")
+ set(LIBRARY_PATH_VAR "PATH")
+ string(REPLACE "\\" "/" TEST_PYTHONPATH "${TEST_PYTHONPATH}")
+ string(REPLACE "\\" "/" TEST_LIBRARY_PATH "${TEST_LIBRARY_PATH}")
-# Should set python path here
-# Looks like it's fixed in 2.8:
-# http://www.vtk.org/Bug/print_bug_page.php?bug_id=7885
-endforeach(test_file ${TEST_FILES})
+ string(REPLACE ";" "\\;" TEST_PYTHONPATH "${TEST_PYTHONPATH}")
+ string(REPLACE ";" "\\;" TEST_LIBRARY_PATH "${TEST_LIBRARY_PATH}")
+ else()
+ set(TEST_PYTHONPATH "$PYTHONPATH:${sample_BINARY_DIR}:${other_BINARY_DIR}")
+ set(TEST_LIBRARY_PATH "$LD_LIBRARY_PATH:${libsample_BINARY_DIR}:${libother_BINARY_DIR}:${libshiboken_BINARY_DIR}")
+ set(LIBRARY_PATH_VAR "LD_LIBRARY_PATH")
+ endif()
+ foreach(test_file ${TEST_FILES})
+ string(REGEX MATCH "/([^/]+)_test.py" test_name ${test_file})
+ list(FIND test_blacklist ${CMAKE_MATCH_1} expect_fail)
+ add_test(${CMAKE_MATCH_1} ${PYTHON_EXECUTABLE} ${test_file})
+ set_tests_properties(${CMAKE_MATCH_1} PROPERTIES ENVIRONMENT "PYTHONPATH=${TEST_PYTHONPATH};${LIBRARY_PATH_VAR}=${TEST_LIBRARY_PATH}")
+ set_tests_properties(${CMAKE_MATCH_1} PROPERTIES TIMEOUT ${CTEST_TESTING_TIMEOUT})
+ if (${expect_fail} GREATER -1)
+ set_tests_properties(${CMAKE_MATCH_1} PROPERTIES WILL_FAIL TRUE)
+ endif()
+ endforeach()
+endif()
diff --git a/tests/run_test.sh b/tests/run_test.sh
deleted file mode 100755
index e73840fa..00000000
--- a/tests/run_test.sh
+++ /dev/null
@@ -1,13 +0,0 @@
-#!/usr/bin/sh
-
-# This is a nasty workaround of a CTest limitation
-# of setting the environment variables for the test.
-
-
-LIB_PATH=$LD_LIBRARY_PATH:$1
-PYTHON_PATH=$PYTHONPATH:$2
-PYTHON_EXEC=$3
-TEST_FILE=$4
-
-LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$LIB_PATH PYTHONPATH=$PYTHON_PATH $PYTHON_EXEC $TEST_FILE
-