CMake: Use build environment prefix.bat when running tests

Tests like tst_qmake need the build environment to be able to build
apps / libraries. This is mostly needed for MSVC.

Set the TESTS_ENV_PREFIX env var to point to the proper prefix.bat
(host or target) and use that when running ctest.

Task-number: QTBUG-85240
Task-number: QTBUG-78449
Task-number: QTBUG-81365
Change-Id: I6fa68714202ac7fc703973fc772e03b84790a043
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
This commit is contained in:
Alexandru Croitor 2020-06-25 15:45:50 +02:00
parent 9a4391271b
commit a2c772dc58
3 changed files with 35 additions and 1 deletions

View File

@ -12,7 +12,7 @@ instructions:
- type: ChangeDirectory - type: ChangeDirectory
directory: "{{.SourceDir}}_standalone_tests" directory: "{{.SourceDir}}_standalone_tests"
- type: ExecuteCommand - type: ExecuteCommand
command: "ctest -V --rerun-failed" command: "{{.Env.TESTS_ENV_PREFIX}} ctest -V --rerun-failed"
ignoreExitCode: true ignoreExitCode: true
maxTimeInSeconds: 7200 maxTimeInSeconds: 7200
maxTimeBetweenOutput: 900 maxTimeBetweenOutput: 900

View File

@ -0,0 +1,30 @@
type: Group
instructions:
- type: Group
instructions:
- type: EnvironmentVariable
variableName: TESTS_ENV_PREFIX
variableValue: "{{.Env.ENV_PREFIX}}"
enable_if:
condition: and
conditions:
- condition: property
property: host.os
equals_property: target.os
- condition: property
property: target.osVersion
not_equals_value: QEMU
- type: Group
instructions:
- type: EnvironmentVariable
variableName: TESTS_ENV_PREFIX
variableValue: "{{.Env.TARGET_ENV_PREFIX}}"
disable_if:
condition: and
conditions:
- condition: property
property: host.os
equals_property: target.os
- condition: property
property: target.osVersion
not_equals_value: QEMU

View File

@ -2,6 +2,10 @@ type: Group
instructions: instructions:
- type: Group - type: Group
instructions: instructions:
# The build env is needed on MSVC so that tst_qmake can properly build apps / libraries.
- !include "{{qt/qtbase}}/prepare_building_env.yaml"
# The test env vars are needed to pick the proper prefix.bat file.
- !include "{{qt/qtbase}}/cmake_setup_running_tests_env_vars.yaml"
- !include "{{qt/qtbase}}/coin_module_test_qemu_env_vars.yaml" - !include "{{qt/qtbase}}/coin_module_test_qemu_env_vars.yaml"
- type: Group - type: Group
instructions: instructions: