summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRenato Filho <renato.filho@openbossa.org>2010-08-19 18:24:20 -0300
committerRenato Filho <renato.filho@openbossa.org>2010-08-19 18:26:41 -0300
commit18d65457dc735543cfcead4a4cac427138b522bb (patch)
treeb8140ca145823251e20670f95365afea2334aa0e
parent0fb81692e3804ff92e326566994c4e1d1255b737 (diff)
downloadshiboken-18d65457dc735543cfcead4a4cac427138b522bb.tar.gz
shiboken-18d65457dc735543cfcead4a4cac427138b522bb.tar.xz
shiboken-18d65457dc735543cfcead4a4cac427138b522bb.zip
Updated test to work with Cmake 2.8 in multiples plataforms.
Reviewer: Luciano Wolf <luciano.wolf@openbossa.org> Hugo Parente Lima <hugo.pl@gmail.com>
-rw-r--r--tests/CMakeLists.txt127
1 files changed, 74 insertions, 53 deletions
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
index a3f52784..fe4f7ec2 100644
--- a/tests/CMakeLists.txt
+++ b/tests/CMakeLists.txt
@@ -1,59 +1,80 @@
-if(NOT CTEST_TESTING_TIMEOUT)
- set(CTEST_TESTING_TIMEOUT 60)
-endif()
+if(CMAKE_VERSION VERSION_LESS 2.8)
+ message("CMake version greater than 2.8 necessary to run tests")
+else()
+ if(NOT CTEST_TESTING_TIMEOUT)
+ set(CTEST_TESTING_TIMEOUT 60)
+ endif()
-macro(TEST_QT_MODULE var name)
- if(NOT DISABLE_${name} AND ${var})
- add_subdirectory(${name})
- endif()
-endmacro(TEST_QT_MODULE)
+ if(WIN32)
+ set(TEST_PYTHONPATH "${CMAKE_BINARY_DIR};${CMAKE_SOURCE_DIR}/tests/util")
+ set(TEST_LIBRARY_PATH "$ENV{PATH};${libpyside_BINARY_DIR}")
+ set(LIBRARY_PATH_VAR "PATH")
+ string(REPLACE "\\" "/" TEST_PYTHONPATH "${TEST_PYTHONPATH}")
+ string(REPLACE "\\" "/" TEST_LIBRARY_PATH "${TEST_LIBRARY_PATH}")
-macro(PYSIDE_TEST)
- string(REGEX MATCH "/([^/]+)//?([^/]+)\\.py" foo "${CMAKE_CURRENT_SOURCE_DIR}/${ARGV0}" )
- set(TEST_NAME "${CMAKE_MATCH_1}_${CMAKE_MATCH_2}")
- if (${ARGC} EQUAL 1)
- set(EXPECT_TO_FAIL 0)
- elseif(${ARGC} EQUAL 2)
- set(EXPECT_TO_FAIL ${ARGV1})
+ string(REPLACE ";" "\\;" TEST_PYTHONPATH "${TEST_PYTHONPATH}")
+ string(REPLACE ";" "\\;" TEST_LIBRARY_PATH "${TEST_LIBRARY_PATH}")
else()
- message(WARNING "Ivalid call of macro PYSIDE_TEST")
+ set(TEST_PYTHONPATH "${CMAKE_BINARY_DIR}:${CMAKE_SOURCE_DIR}/tests/util")
+ set(TEST_LIBRARY_PATH "$ENV{LD_LIBRARY_PATH}:${libpyside_BINARY_DIR}")
+ set(LIBRARY_PATH_VAR "LD_LIBRARY_PATH")
endif()
- set(TEST_CMD ${XVFB_EXEC} ${CMAKE_SOURCE_DIR}/tests/run_test.sh ${libpyside_BINARY_DIR} "${CMAKE_BINARY_DIR}:${CMAKE_SOURCE_DIR}/tests/util" ${PYTHON_EXECUTABLE} "${CMAKE_CURRENT_SOURCE_DIR}/${ARGV0}")
- add_test(${TEST_NAME} ${TEST_CMD})
- set_tests_properties(${TEST_NAME} PROPERTIES
- TIMEOUT ${CTEST_TESTING_TIMEOUT}
- WILL_FAIL ${EXPECT_TO_FAIL})
-endmacro(PYSIDE_TEST)
-# Try to find QtMultimedia
-# TODO: Remove this hack when cmake support QtMultimedia module
-if (NOT QT_QTMULTIMEDIA_FOUND AND ${QTVERSION} VERSION_GREATER 4.5.9)
- find_path(QT_QTMULTIMEDIA_INCLUDE_DIR QtMultimedia
- PATHS ${QT_HEADERS_DIR}/QtMultimedia
- ${QT_LIBRARY_DIR}/QtMultimedia.framework/Headers
- NO_DEFAULT_PATH)
- find_library(QT_QTMULTIMEDIA_LIBRARY QtMultimedia PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH)
- if (QT_QTMULTIMEDIA_INCLUDE_DIR AND QT_QTMULTIMEDIA_LIBRARY)
- set(QT_QTMULTIMEDIA_FOUND ON)
- endif()
-endif ()
-add_subdirectory(signals)
-TEST_QT_MODULE(QT_QTCORE_FOUND QtCore)
-TEST_QT_MODULE(QT_QTGUI_FOUND QtGui)
-TEST_QT_MODULE(QT_QTNETWORK_FOUND QtNetwork)
-TEST_QT_MODULE(QT_QTWEBKIT_FOUND QtWebKit)
-TEST_QT_MODULE(QT_QTSVG_FOUND QtSvg)
-TEST_QT_MODULE(QT_QTXML_FOUND QtXml)
-TEST_QT_MODULE(QT_QTTEST_FOUND QtTest)
-TEST_QT_MODULE(QT_QTOPENGL_FOUND QtOpenGL)
-TEST_QT_MODULE(QT_QTSQL_FOUND QtSql)
-TEST_QT_MODULE(QT_QTUITOOLS_FOUND QtUiTools)
-TEST_QT_MODULE(QT_QTHELP_FOUND QtHelp)
-TEST_QT_MODULE(QT_QTXMLPATTERNS_FOUND QtXmlPatterns)
-TEST_QT_MODULE(QT_QTMAEMO5_FOUND QtMaemo5)
-TEST_QT_MODULE(QT_QTSCRIPT_FOUND QtScript)
-TEST_QT_MODULE(QT_QTSCRIPTTOOLS_FOUND QtScriptTools)
-TEST_QT_MODULE(QT_QTMULTIMEDIA_FOUND QtMultimedia)
-TEST_QT_MODULE(QT_PHONON_FOUND phonon)
-TEST_QT_MODULE(QT_QTDECLARATIVE_FOUND QtDeclarative)
+ macro(TEST_QT_MODULE var name)
+ if(NOT DISABLE_${name} AND ${var})
+ add_subdirectory(${name})
+ endif()
+ endmacro(TEST_QT_MODULE)
+
+ macro(PYSIDE_TEST)
+ string(REGEX MATCH "/([^/]+)//?([^/]+)\\.py" foo "${CMAKE_CURRENT_SOURCE_DIR}/${ARGV0}" )
+ set(TEST_NAME "${CMAKE_MATCH_1}_${CMAKE_MATCH_2}")
+ if (${ARGC} EQUAL 1)
+ set(EXPECT_TO_FAIL 0)
+ elseif(${ARGC} EQUAL 2)
+ set(EXPECT_TO_FAIL ${ARGV1})
+ else()
+ message(WARNING "Ivalid call of macro PYSIDE_TEST")
+ endif()
+ set(TEST_CMD ${XVFB_EXEC} ${PYTHON_EXECUTABLE} "${CMAKE_CURRENT_SOURCE_DIR}/${ARGV0}")
+ add_test(${TEST_NAME} ${TEST_CMD})
+ set_tests_properties(${TEST_NAME} PROPERTIES
+ TIMEOUT ${CTEST_TESTING_TIMEOUT}
+ WILL_FAIL ${EXPECT_TO_FAIL}
+ ENVIRONMENT "PYTHONPATH=${TEST_PYTHONPATH};${LIBRARY_PATH_VAR}=${TEST_LIBRARY_PATH}")
+ endmacro(PYSIDE_TEST)
+
+ # Try to find QtMultimedia
+ # TODO: Remove this hack when cmake support QtMultimedia module
+ if (NOT QT_QTMULTIMEDIA_FOUND AND ${QTVERSION} VERSION_GREATER 4.5.9)
+ find_path(QT_QTMULTIMEDIA_INCLUDE_DIR QtMultimedia
+ PATHS ${QT_HEADERS_DIR}/QtMultimedia
+ ${QT_LIBRARY_DIR}/QtMultimedia.framework/Headers
+ NO_DEFAULT_PATH)
+ find_library(QT_QTMULTIMEDIA_LIBRARY QtMultimedia PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH)
+ if (QT_QTMULTIMEDIA_INCLUDE_DIR AND QT_QTMULTIMEDIA_LIBRARY)
+ set(QT_QTMULTIMEDIA_FOUND ON)
+ endif()
+ endif ()
+
+ add_subdirectory(signals)
+ TEST_QT_MODULE(QT_QTCORE_FOUND QtCore)
+ TEST_QT_MODULE(QT_QTGUI_FOUND QtGui)
+ TEST_QT_MODULE(QT_QTNETWORK_FOUND QtNetwork)
+ TEST_QT_MODULE(QT_QTWEBKIT_FOUND QtWebKit)
+ TEST_QT_MODULE(QT_QTSVG_FOUND QtSvg)
+ TEST_QT_MODULE(QT_QTXML_FOUND QtXml)
+ TEST_QT_MODULE(QT_QTTEST_FOUND QtTest)
+ TEST_QT_MODULE(QT_QTOPENGL_FOUND QtOpenGL)
+ TEST_QT_MODULE(QT_QTSQL_FOUND QtSql)
+ TEST_QT_MODULE(QT_QTUITOOLS_FOUND QtUiTools)
+ TEST_QT_MODULE(QT_QTHELP_FOUND QtHelp)
+ TEST_QT_MODULE(QT_QTXMLPATTERNS_FOUND QtXmlPatterns)
+ TEST_QT_MODULE(QT_QTMAEMO5_FOUND QtMaemo5)
+ TEST_QT_MODULE(QT_QTSCRIPT_FOUND QtScript)
+ TEST_QT_MODULE(QT_QTSCRIPTTOOLS_FOUND QtScriptTools)
+ TEST_QT_MODULE(QT_QTMULTIMEDIA_FOUND QtMultimedia)
+ TEST_QT_MODULE(QT_PHONON_FOUND phonon)
+ TEST_QT_MODULE(QT_QTDECLARATIVE_FOUND QtDeclarative)
+endif()