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>
This commit is contained in:
Alexandru Croitor 2020-06-12 17:50:30 +02:00
parent 844e4f7b98
commit d8f814cdb7
8 changed files with 101 additions and 13 deletions

View File

@ -1,7 +1,7 @@
type: Group type: Group
instructions: instructions:
- type: ExecuteCommand - 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 executeCommandArgumentSplitingBehavior: SplitAfterVariableSubstitution
maxTimeInSeconds: 6000 maxTimeInSeconds: 6000
maxTimeBetweenOutput: 1200 maxTimeBetweenOutput: 1200
@ -12,7 +12,7 @@ instructions:
property: host.os property: host.os
equals_value: Windows equals_value: Windows
- type: ExecuteCommand - 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 executeCommandArgumentSplitingBehavior: SplitAfterVariableSubstitution
maxTimeInSeconds: 6000 maxTimeInSeconds: 6000
maxTimeBetweenOutput: 1200 maxTimeBetweenOutput: 1200

View File

@ -13,7 +13,7 @@ instructions:
variableValue: "-DQT_BUILD_STANDALONE_TESTS=ON -S {{.SourceDir}} -B ." variableValue: "-DQT_BUILD_STANDALONE_TESTS=ON -S {{.SourceDir}} -B ."
- !include "{{qt/qtbase}}/call_cmake_for_standalone_tests.yaml" - !include "{{qt/qtbase}}/call_cmake_for_standalone_tests.yaml"
- type: ExecuteCommand - type: ExecuteCommand
command: "{{.Env.ENV_PREFIX}} cmake --build . --parallel -v" command: "{{.Env.TESTS_ENV_PREFIX}} cmake --build . --parallel -v"
maxTimeInSeconds: 6000 maxTimeInSeconds: 6000
maxTimeBetweenOutput: 1200 maxTimeBetweenOutput: 1200
userMessageOnFailure: > userMessageOnFailure: >

View File

@ -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

View File

@ -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

View File

@ -4,7 +4,7 @@ instructions:
- type: Group - type: Group
instructions: instructions:
- !include "{{qt/qtbase}}/cmake_module_build_instructions.yaml" - !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: enable_if:
condition: and condition: and
conditions: conditions:
@ -17,6 +17,18 @@ instructions:
- type: Group - type: Group
instructions: instructions:
- !include "{{qt/qtbase}}/cmake_cross_compilation_module_build_instructions.yaml" - !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: disable_if:
condition: and condition: and
conditions: conditions:

View File

@ -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

View File

@ -2,15 +2,24 @@ type: Group
instructions: instructions:
- type: Group - type: Group
instructions: instructions:
- !include "{{qt/qtbase}}/cmake_regular_test_instructions.yaml" - !include "{{qt/qtbase}}/coin_module_test_qemu_env_vars.yaml"
enable_if: - 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 condition: property
property: host.os property: features
equals_property: target.os contains_value: DisableTests
- type: EnvironmentVariable - type: EnvironmentVariable
variableName: Dummy variableName: Dummy
variableValue: dummy variableValue: dummy
disable_if:
condition: property
property: host.os
equals_property: target.os

View File

@ -4,7 +4,7 @@ instructions:
- type: Group - type: Group
instructions: instructions:
- !include "{{qt/qtbase}}/cmake_qtbase_build_instructions.yaml" - !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: enable_if:
condition: and condition: and
conditions: conditions:
@ -17,6 +17,18 @@ instructions:
- type: Group - type: Group
instructions: instructions:
- !include "{{qt/qtbase}}/cmake_cross_compilation_qtbase_build_instructions.yaml" - !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: disable_if:
condition: and condition: and
conditions: conditions: