From de3a806def4b9a754825a2233c9d4952a9b2d0eb Mon Sep 17 00:00:00 2001 From: Alexandru Croitor Date: Fri, 1 Nov 2019 11:48:23 +0100 Subject: Make standalone tests build via top level repo project Previously repo/tests/CMakeLists.txt was a standalone project on which CMake could be called. This was useful for Coin to be able to build and package only tests, but was a bit troublesome because that means having to specify the usual boilerplate like minimum CMake version, which packages to find in every tests.pro project. Instead of having a separate standalone project, modify the top level project and associated CMake code to allow passing a special QT_BUILD_STANDALONE_TESTS variable, which causes the top level project to build only tests, and find Qt in the previously installed qt location. This also means that when building a repo, we generate a ${repo_name}TestsConfig.cmake file which does find_package on all the modules that have been built as part of that repo. So that when standalone tests bare built for that repo, the modules are automatically found. qt_set_up_standalone_tests_build() is modified to be a no-op because it is not needed anymore. Its usage should be removed from all the other repos, and then removed from qtbase. Non-adjusted tests/CMakeLists.txt projects in other repositories should still be buildable with the current code, until they are updated to the new format. Adjust the Coin build instructions to build the standalone tests in a separate directory. Adjust pro2cmake to generate new structure for the tests/tests.pro projects. Adjust the qtbase tests project. Fixes: QTBUG-79239 Change-Id: Ib4b66bc772d8876cdcbae1e90ce5a5a5234fa675 Reviewed-by: Qt CMake Build Bot Reviewed-by: Simon Hausmann --- .../cmake_build_and_upload_test_artifacts.yaml | 23 +++++++++------------- .../cmake_regular_test_instructions.yaml | 8 ++++++-- 2 files changed, 15 insertions(+), 16 deletions(-) (limited to 'coin') diff --git a/coin/instructions/cmake_build_and_upload_test_artifacts.yaml b/coin/instructions/cmake_build_and_upload_test_artifacts.yaml index 81b0f7773b..59a2f09f0d 100644 --- a/coin/instructions/cmake_build_and_upload_test_artifacts.yaml +++ b/coin/instructions/cmake_build_and_upload_test_artifacts.yaml @@ -1,21 +1,16 @@ type: Group instructions: - type: ChangeDirectory - directory: "{{.SourceDir}}/tests" - - type: EnvironmentVariable - variableName: COIN_CMAKE_ARGS - variableValue: "{{.SourceDir}}\\tests" - enable_if: - condition: property - property: host.os - equals_value: Windows + directory: "{{.SourceDir}}" + - type: MakeDirectory + directory: "standalone_tests" + - type: SetBuildDirectory + directory: "{{.SourceDir}}/standalone_tests" + - type: ChangeDirectory + directory: "{{.BuildDir}}" - type: EnvironmentVariable variableName: COIN_CMAKE_ARGS - variableValue: "{{.SourceDir}}/tests" - disable_if: - condition: property - property: host.os - equals_value: Windows + variableValue: "-DQT_BUILD_STANDALONE_TESTS=ON -S {{.SourceDir}} -B ." - !include "{{qt/qtbase}}/call_cmake.yaml" - type: ExecuteCommand command: "{{.Env.ENV_PREFIX}} cmake --build . --parallel" @@ -25,7 +20,7 @@ instructions: Failed to build sources. In the current state bug can be everywhere. Contact Liang first. - type: UploadTestArtifact transferType: UploadModuleTestsArtifact - archiveDirectory: "{{.SourceDir}}/tests" + archiveDirectory: "{{.BuildDir}}" maxTimeInSeconds: 1200 maxTimeBetweenOutput: 1200 disable_if: diff --git a/coin/instructions/cmake_regular_test_instructions.yaml b/coin/instructions/cmake_regular_test_instructions.yaml index 10a8d6fbff..6974b293dd 100644 --- a/coin/instructions/cmake_regular_test_instructions.yaml +++ b/coin/instructions/cmake_regular_test_instructions.yaml @@ -1,14 +1,18 @@ type: Group instructions: + - type: ChangeDirectory + directory: "{{.SourceDir}}" + - type: MakeDirectory + directory: "standalone_tests" - type: InstallTestBinaryArchive relativeStoragePath: "{{.Env.MODULE_ARTIFACTS_RELATIVE_STORAGE_PATH}}/tests.tar.gz" - directory: "{{.SourceDir}}/tests" + directory: "{{.SourceDir}}/standalone_tests" maxTimeInSeconds: 1200 maxTimeBetweenOutput: 1200 userMessageOnFailure: > Failed to install tests archive. - type: ChangeDirectory - directory: "{{.SourceDir}}/tests" + directory: "{{.SourceDir}}/standalone_tests" - type: ExecuteCommand command: "ctest -V --rerun-failed" ignoreExitCode: true -- cgit v1.2.3