diff options
author | Alexey Edelev <alexey.edelev@qt.io> | 2022-02-09 16:24:24 +0100 |
---|---|---|
committer | Alexey Edelev <alexey.edelev@qt.io> | 2022-02-11 21:54:44 +0100 |
commit | fdf5d11ff6f3f5034d7d7f7664f4cc76deb26ef5 (patch) | |
tree | 22e1c4b93f718930b8c40c2ab68f1b2bc790f97e /tests/auto/testlib/selftests | |
parent | 52492ff7209d2c91cbd0d549282459b58fbf3b0f (diff) |
CMake: Add BUILTIN_TESTDATA option to qt_internal_add_test
Multiple tests use qt_internal_add_resource that copies the
functionality that is already implemented inside the
qt_internal_add_test function. Simplify these test by replacing
the qt_internal_add_resource call with the new BUILTIN_TESTDATA
option.
Change-Id: I18475b817d6f87264f0de53817d6c26c5ccab4e2
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Diffstat (limited to 'tests/auto/testlib/selftests')
-rw-r--r-- | tests/auto/testlib/selftests/CMakeLists.txt | 28 |
1 files changed, 9 insertions, 19 deletions
diff --git a/tests/auto/testlib/selftests/CMakeLists.txt b/tests/auto/testlib/selftests/CMakeLists.txt index 2dd26211f2..8e64fcd6d7 100644 --- a/tests/auto/testlib/selftests/CMakeLists.txt +++ b/tests/auto/testlib/selftests/CMakeLists.txt @@ -4,6 +4,13 @@ include(../../../../src/testlib/selfcover.cmake) # ------------- Test runner ------------- +# Resources: + +file(GLOB qmake_expected_files_resource_files RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" "expected_*") +foreach(file IN LISTS qmake_expected_files_resource_files) + set_source_files_properties("${CMAKE_CURRENT_SOURCE_DIR}/${file}" PROPERTIES QT_RESOURCE_ALIAS "${file}") +endforeach() + qt_internal_add_test(tst_selftests OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/" EXCEPTIONS @@ -13,6 +20,8 @@ qt_internal_add_test(tst_selftests catch.cpp PUBLIC_LIBRARIES Qt::TestPrivate + TESTDATA ${qmake_expected_files_resource_files} + BUILTIN_TESTDATA # These lines need to be commented out as they need to be enabled # COMPILE_OPTIONS # conditionally @@ -24,25 +33,6 @@ qt_internal_add_test(tst_selftests # "$$COVERAGE_OPTIONS" ) -file(GLOB resource_glob_0 RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" "expected_*") -foreach(file IN LISTS resource_glob_0) - set_source_files_properties("${CMAKE_CURRENT_SOURCE_DIR}/${file}" PROPERTIES QT_RESOURCE_ALIAS "${file}") -endforeach() - -# Resources: -set(qmake_expected_files_resource_files - ${resource_glob_0} -) - -qt_internal_add_resource(tst_selftests "qmake_expected_files" - PREFIX - "/" - BASE - "${CMAKE_CURRENT_SOURCE_DIR}" - FILES - ${qmake_expected_files_resource_files} -) - qt_internal_apply_testlib_coverage_options(tst_selftests) # ------------- Sub tests ------------- |