Skip to content

Commit

Permalink
coin: Decide whether to ignore CTest exit code based on environment var
Browse files Browse the repository at this point in the history
This deduplicates some of the coin instruction files, and opens up the
possibility for other instructions to determine whether a test run
is significant or not.

The only module still using the coin_module_test_template_v2 template
is the QtMQTT module, so the behavior of ignore the test run has been
kept.

The static library opt out was a remnant from the cmake porting, and
can be removed.

Change-Id: I0f9fcbbd3a5a18bd9c8e0f545b0f0656e03bf388
Reviewed-by: Alexandru Croitor <[email protected]>
  • Loading branch information
torarnv committed May 29, 2024
1 parent 5c1ea2c commit ca95a10
Show file tree
Hide file tree
Showing 7 changed files with 48 additions and 52 deletions.
19 changes: 13 additions & 6 deletions coin/instructions/cmake_regular_test_instructions.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,15 @@
type: Group
instructions:
- !include "{{qt/qtbase}}/cmake_regular_test_instructions_common.yaml"
- !include "{{qt/qtbase}}/cmake_run_ctest_ignore_exit_code.yaml"
disable_if:
condition: property
property: configureArgs
contains_value: "-DBUILD_SHARED_LIBS=OFF"
- type: MakeDirectory
directory: "{{.SourceDir}}_standalone_tests"
- type: InstallTestBinaryArchive
relativeStoragePath: "{{.Env.MODULE_ARTIFACTS_RELATIVE_STORAGE_PATH}}/tests.tar.gz"
directory: "{{.SourceDir}}_standalone_tests"
maxTimeInSeconds: 1200
maxTimeBetweenOutput: 1200
userMessageOnFailure: >
Failed to install tests archive.
- type: ChangeDirectory
directory: "{{.SourceDir}}_standalone_tests"

- !include "{{qt/qtbase}}/cmake_run_ctest.yaml"
13 changes: 0 additions & 13 deletions coin/instructions/cmake_regular_test_instructions_common.yaml

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -104,14 +104,37 @@ instructions:
property: features
contains_value: TestOnly

- type: ExecuteCommand
command: "{{.Env.TESTS_ENV_PREFIX}} ctest {{.Env.CTEST_ARGS}}"
executeCommandArgumentSplitingBehavior: SplitAfterVariableSubstitution
ignoreExitCode: false
maxTimeInSeconds: 10800
maxTimeBetweenOutput: "{{.Env.COIN_COMMAND_OUTPUT_TIMEOUT}}"
userMessageOnFailure: >
Failed to run tests.
# Run CTest, with or without ignoring exit code
# FIXME: De-duplicate the CTest instruction when
# ignoreExitCode expands environment variables.
- type: Group
enable_if:
condition: runtime
env_var: COIN_CTEST_IGNORE_EXIT_CODE
not_equals_value: "1"
instructions:
- type: ExecuteCommand
command: "{{.Env.TESTS_ENV_PREFIX}} ctest {{.Env.CTEST_ARGS}}"
executeCommandArgumentSplitingBehavior: SplitAfterVariableSubstitution
ignoreExitCode: false
maxTimeInSeconds: 10800
maxTimeBetweenOutput: "{{.Env.COIN_COMMAND_OUTPUT_TIMEOUT}}"
userMessageOnFailure: >
Failed to run tests.
- type: Group
enable_if:
condition: runtime
env_var: COIN_CTEST_IGNORE_EXIT_CODE
equals_value: "1"
instructions:
- type: ExecuteCommand
command: "{{.Env.TESTS_ENV_PREFIX}} ctest {{.Env.CTEST_ARGS}}"
executeCommandArgumentSplitingBehavior: SplitAfterVariableSubstitution
ignoreExitCode: true
maxTimeInSeconds: 10800
maxTimeBetweenOutput: "{{.Env.COIN_COMMAND_OUTPUT_TIMEOUT}}"
userMessageOnFailure: >
Failed to run tests.
- type: Group
instructions:
Expand Down
20 changes: 0 additions & 20 deletions coin/instructions/cmake_run_ctest_ignore_exit_code.yaml

This file was deleted.

3 changes: 3 additions & 0 deletions coin/instructions/coin_module_test_template_v2.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ instructions:
- !include "{{qt/qtbase}}/coin_module_test_template_common.yaml"
- type: Group
instructions:
- type: EnvironmentVariable
variableName: COIN_CTEST_IGNORE_EXIT_CODE
variableValue: "1"
- !include "{{qt/qtbase}}/cmake_regular_test_instructions.yaml"
enable_if:
condition: or
Expand Down
2 changes: 1 addition & 1 deletion coin/instructions/coin_module_test_template_v3.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ instructions:
- !include "{{qt/qtbase}}/coin_module_test_template_common.yaml"
- type: Group
instructions:
- !include "{{qt/qtbase}}/cmake_regular_test_instructions_enforced.yaml"
- !include "{{qt/qtbase}}/cmake_regular_test_instructions.yaml"
enable_if:
condition: or
conditions:
Expand Down

0 comments on commit ca95a10

Please sign in to comment.