diff options
author | Alexandru Croitor <alexandru.croitor@qt.io> | 2020-06-12 17:50:30 +0200 |
---|---|---|
committer | Alexandru Croitor <alexandru.croitor@qt.io> | 2020-06-25 14:11:56 +0200 |
commit | d8f814cdb7c56902665f95c3890c6ceaf069f0c2 (patch) | |
tree | 4472e8dea67f6baca1e34944c0aa71513af19dc4 /coin | |
parent | 844e4f7b982f2622dbdce0c4b70775d5bd17f043 (diff) |
CMake: Add instructions for building and testing qemu configs
Before this change, tests were never built for cross-compiling
configurations.
Add instructions that build and run tests for qemu configurations.
This required a bit of abstraction / indirection to find out what's
the path to the correct qt-cmake call, as well as prepending the
correct env prefix to each call (either the host one or the target
one).
Also, the QEMU configuration requires a few environment variables
to pick up the correct runtime linker and which qpa plugin to use
for running tests.
Finally, make sure the tests are not built and run if the DisableTests
feature is set in the configuration.
Task-number: QTBUG-84423
Change-Id: I0cec28c801a657e67cfa48f3c61cfe487109946b
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Diffstat (limited to 'coin')
8 files changed, 101 insertions, 13 deletions
diff --git a/coin/instructions/call_cmake_for_standalone_tests.yaml b/coin/instructions/call_cmake_for_standalone_tests.yaml index bbebd6af33..8414ee44a1 100644 --- a/coin/instructions/call_cmake_for_standalone_tests.yaml +++ b/coin/instructions/call_cmake_for_standalone_tests.yaml @@ -1,7 +1,7 @@ type: Group instructions: - type: ExecuteCommand - command: "{{.Env.ENV_PREFIX}} {{.InstallDir}}\\bin\\qt-cmake {{.Env.COIN_CMAKE_ARGS}}" + command: "{{.Env.TESTS_ENV_PREFIX}} {{.Env.INSTALL_DIR_FOR_CMAKE_TESTS}}\\bin\\qt-cmake {{.Env.COIN_CMAKE_ARGS}}" executeCommandArgumentSplitingBehavior: SplitAfterVariableSubstitution maxTimeInSeconds: 6000 maxTimeBetweenOutput: 1200 @@ -12,7 +12,7 @@ instructions: property: host.os equals_value: Windows - type: ExecuteCommand - command: "{{.InstallDir}}/bin/qt-cmake {{.Env.COIN_CMAKE_ARGS}}" + command: "{{.Env.TESTS_ENV_PREFIX}} {{.Env.INSTALL_DIR_FOR_CMAKE_TESTS}}/bin/qt-cmake {{.Env.COIN_CMAKE_ARGS}}" executeCommandArgumentSplitingBehavior: SplitAfterVariableSubstitution maxTimeInSeconds: 6000 maxTimeBetweenOutput: 1200 diff --git a/coin/instructions/cmake_build_and_upload_test_artifacts.yaml b/coin/instructions/cmake_build_and_upload_test_artifacts.yaml index 92e2816346..df22b9d34d 100644 --- a/coin/instructions/cmake_build_and_upload_test_artifacts.yaml +++ b/coin/instructions/cmake_build_and_upload_test_artifacts.yaml @@ -13,7 +13,7 @@ instructions: variableValue: "-DQT_BUILD_STANDALONE_TESTS=ON -S {{.SourceDir}} -B ." - !include "{{qt/qtbase}}/call_cmake_for_standalone_tests.yaml" - type: ExecuteCommand - command: "{{.Env.ENV_PREFIX}} cmake --build . --parallel -v" + command: "{{.Env.TESTS_ENV_PREFIX}} cmake --build . --parallel -v" maxTimeInSeconds: 6000 maxTimeBetweenOutput: 1200 userMessageOnFailure: > diff --git a/coin/instructions/cmake_build_and_upload_test_artifacts_host.yaml b/coin/instructions/cmake_build_and_upload_test_artifacts_host.yaml new file mode 100644 index 0000000000..e2cdd15407 --- /dev/null +++ b/coin/instructions/cmake_build_and_upload_test_artifacts_host.yaml @@ -0,0 +1,15 @@ +type: Group +instructions: + - type: Group + instructions: + - type: EnvironmentVariable + variableName: TESTS_ENV_PREFIX + variableValue: "{{.Env.ENV_PREFIX}}" + - type: EnvironmentVariable + variableName: INSTALL_DIR_FOR_CMAKE_TESTS + variableValue: "{{.InstallDir}}" + - !include "{{qt/qtbase}}/cmake_build_and_upload_test_artifacts.yaml" + disable_if: + condition: property + property: features + contains_value: DisableTests diff --git a/coin/instructions/cmake_build_and_upload_test_artifacts_target.yaml b/coin/instructions/cmake_build_and_upload_test_artifacts_target.yaml new file mode 100644 index 0000000000..3dd2844537 --- /dev/null +++ b/coin/instructions/cmake_build_and_upload_test_artifacts_target.yaml @@ -0,0 +1,26 @@ +type: Group +instructions: + - type: Group + instructions: + - type: EnvironmentVariable + variableName: TESTS_ENV_PREFIX + variableValue: "{{.Env.TARGET_ENV_PREFIX}}" + - type: EnvironmentVariable + variableName: INSTALL_DIR_FOR_CMAKE_TESTS + variableValue: "{{.InstallDir}}\\target" + enable_if: + condition: property + property: host.os + equals_value: Windows + - type: EnvironmentVariable + variableName: INSTALL_DIR_FOR_CMAKE_TESTS + variableValue: "{{.InstallDir}}/target" + disable_if: + condition: property + property: host.os + equals_value: Windows + - !include "{{qt/qtbase}}/cmake_build_and_upload_test_artifacts.yaml" + disable_if: + condition: property + property: features + contains_value: DisableTests diff --git a/coin/instructions/coin_module_build_template_v2.yaml b/coin/instructions/coin_module_build_template_v2.yaml index 8fa5729590..bee930d447 100644 --- a/coin/instructions/coin_module_build_template_v2.yaml +++ b/coin/instructions/coin_module_build_template_v2.yaml @@ -4,7 +4,7 @@ instructions: - type: Group instructions: - !include "{{qt/qtbase}}/cmake_module_build_instructions.yaml" - - !include "{{qt/qtbase}}/cmake_build_and_upload_test_artifacts.yaml" + - !include "{{qt/qtbase}}/cmake_build_and_upload_test_artifacts_host.yaml" enable_if: condition: and conditions: @@ -17,6 +17,18 @@ instructions: - type: Group instructions: - !include "{{qt/qtbase}}/cmake_cross_compilation_module_build_instructions.yaml" + - type: Group + instructions: + - !include "{{qt/qtbase}}/cmake_build_and_upload_test_artifacts_target.yaml" + enable_if: + condition: and + conditions: + - condition: property + property: host.os + equals_property: target.os + - condition: property + property: target.osVersion + equals_value: QEMU disable_if: condition: and conditions: diff --git a/coin/instructions/coin_module_test_qemu_env_vars.yaml b/coin/instructions/coin_module_test_qemu_env_vars.yaml new file mode 100644 index 0000000000..cd7c53d455 --- /dev/null +++ b/coin/instructions/coin_module_test_qemu_env_vars.yaml @@ -0,0 +1,14 @@ +type: Group +instructions: + - type: Group + instructions: + - type: EnvironmentVariable + variableName: QEMU_LD_PREFIX + variableValue: "{{.Env.QT_SYSROOT_FOR_RUNNING_TESTS}}" + - type: EnvironmentVariable + variableName: QT_QPA_PLATFORM + variableValue: "offscreen" + enable_if: + condition: property + property: target.osVersion + equals_value: QEMU diff --git a/coin/instructions/coin_module_test_template_v2.yaml b/coin/instructions/coin_module_test_template_v2.yaml index a94ed9fd84..f4f65d7d37 100644 --- a/coin/instructions/coin_module_test_template_v2.yaml +++ b/coin/instructions/coin_module_test_template_v2.yaml @@ -2,15 +2,24 @@ type: Group instructions: - type: Group instructions: - - !include "{{qt/qtbase}}/cmake_regular_test_instructions.yaml" - enable_if: + - !include "{{qt/qtbase}}/coin_module_test_qemu_env_vars.yaml" + - type: Group + instructions: + - !include "{{qt/qtbase}}/cmake_regular_test_instructions.yaml" + enable_if: + condition: or + conditions: + - condition: property + property: host.os + equals_property: target.os + - condition: property + property: target.osVersion + equals_value: QEMU + disable_if: condition: property - property: host.os - equals_property: target.os + property: features + contains_value: DisableTests + - type: EnvironmentVariable variableName: Dummy variableValue: dummy - disable_if: - condition: property - property: host.os - equals_property: target.os diff --git a/coin/instructions/coin_qtbase_build_template_v2.yaml b/coin/instructions/coin_qtbase_build_template_v2.yaml index 433b326e25..ec3856d5a5 100644 --- a/coin/instructions/coin_qtbase_build_template_v2.yaml +++ b/coin/instructions/coin_qtbase_build_template_v2.yaml @@ -4,7 +4,7 @@ instructions: - type: Group instructions: - !include "{{qt/qtbase}}/cmake_qtbase_build_instructions.yaml" - - !include "{{qt/qtbase}}/cmake_build_and_upload_test_artifacts.yaml" + - !include "{{qt/qtbase}}/cmake_build_and_upload_test_artifacts_host.yaml" enable_if: condition: and conditions: @@ -17,6 +17,18 @@ instructions: - type: Group instructions: - !include "{{qt/qtbase}}/cmake_cross_compilation_qtbase_build_instructions.yaml" + - type: Group + instructions: + - !include "{{qt/qtbase}}/cmake_build_and_upload_test_artifacts_target.yaml" + enable_if: + condition: and + conditions: + - condition: property + property: host.os + equals_property: target.os + - condition: property + property: target.osVersion + equals_value: QEMU disable_if: condition: and conditions: |