Skip to content

Commit

Permalink
CMake: Use build environment prefix.bat when running tests
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
alcroito committed Jun 26, 2020
1 parent 9a43912 commit a2c772d
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 1 deletion.
2 changes: 1 addition & 1 deletion coin/instructions/cmake_regular_test_instructions.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ instructions:
- type: ChangeDirectory
directory: "{{.SourceDir}}_standalone_tests"
- type: ExecuteCommand
command: "ctest -V --rerun-failed"
command: "{{.Env.TESTS_ENV_PREFIX}} ctest -V --rerun-failed"
ignoreExitCode: true
maxTimeInSeconds: 7200
maxTimeBetweenOutput: 900
Expand Down
30 changes: 30 additions & 0 deletions coin/instructions/cmake_setup_running_tests_env_vars.yaml
Original file line number Diff line number Diff line change
@@ -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
4 changes: 4 additions & 0 deletions coin/instructions/coin_module_test_template_v2.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@ type: Group
instructions:
- type: Group
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"
- type: Group
instructions:
Expand Down

0 comments on commit a2c772d

Please sign in to comment.