summaryrefslogtreecommitdiffstats
path: root/tests/auto/cmake
diff options
context:
space:
mode:
authorAlexey Edelev <alexey.edelev@qt.io>2021-03-25 11:10:47 +0100
committerAlexey Edelev <alexey.edelev@qt.io>2021-04-07 17:56:57 +0200
commitcbdce59cd24861210a01fa9f319607b3a538ebbb (patch)
tree4b213681f8e9c371d1088d6c910941b7b9cb4b41 /tests/auto/cmake
parent89a0ed100977a86f12ce0837b4d7787b88f09922 (diff)
Add the SIMULATE_IN_SOURCE argument to _qt_internal_test_expect_pass
test_QFINDTESTDATA builds the project in the source tree, this is necessary because the test requires relative paths to the source file names. This function could be useful for other tests, so it makes sense to extend the _qt_internal_test_expect_pass/fail macros to support build in the source tree. Note that, the SIMULATE_IN_SOURCE argument doesn't build the test in the existing source tree, but copies source files to the build tree first to do not litter the source directory. Change-Id: I16e790d74be2a0c5ca0593e0f88580dbe09882b9 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Diffstat (limited to 'tests/auto/cmake')
-rw-r--r--tests/auto/cmake/CMakeLists.txt22
1 files changed, 3 insertions, 19 deletions
diff --git a/tests/auto/cmake/CMakeLists.txt b/tests/auto/cmake/CMakeLists.txt
index b43aa8f0a6..4fb6c24d8d 100644
--- a/tests/auto/cmake/CMakeLists.txt
+++ b/tests/auto/cmake/CMakeLists.txt
@@ -108,26 +108,10 @@ _qt_internal_test_expect_pass(test_platform_defs_include)
_qt_internal_test_expect_pass(test_qtmainwin_library)
if (CMAKE_GENERATOR STREQUAL Ninja AND UNIX AND NOT WIN32)
- set(qfindtestdata_build_dir "${CMAKE_CURRENT_SOURCE_DIR}/test_QFINDTESTDATA/build")
- add_test(test_QFINDTESTDATA ${CMAKE_CTEST_COMMAND}
- --build-and-test
- "${CMAKE_CURRENT_SOURCE_DIR}/test_QFINDTESTDATA"
- # Build in a subdir of the source dir.
- # This causes Ninja to use relative paths.
- "${qfindtestdata_build_dir}"
- --build-config "${CMAKE_BUILD_TYPE}"
- --build-generator "${CMAKE_GENERATOR}"
- --build-makeprogram "${CMAKE_MAKE_PROGRAM}"
- --build-options "-DCMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH}" ${BUILD_OPTIONS_LIST}
+ _qt_internal_test_expect_pass(test_QFINDTESTDATA
+ BINARY "tests/test_QFINDTESTDATA"
+ SIMULATE_IN_SOURCE
)
- set_tests_properties(test_QFINDTESTDATA PROPERTIES FIXTURES_SETUP QFINDTESTDATA)
-
- add_test(NAME run_test_QFINDTESTDATA COMMAND sh -c "cd \"${qfindtestdata_build_dir}/tests\" && ./test_QFINDTESTDATA -v2")
- set_tests_properties(run_test_QFINDTESTDATA PROPERTIES FIXTURES_REQUIRED QFINDTESTDATA)
-
- # source dir should be untouched by build, so remove build results
- add_test(NAME cleanup_test_QFINDTESTDATA COMMAND sh -c "rm -rf \"${qfindtestdata_build_dir}\"")
- set_tests_properties(cleanup_test_QFINDTESTDATA PROPERTIES FIXTURES_CLEANUP QFINDTESTDATA)
endif()
if (NOT NO_DBUS)