summaryrefslogtreecommitdiffstats
path: root/coin/instructions/cmake_run_ctest.yaml
blob: 0c58a83b20934c277cc1135a68f47ddcabc9a7af (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
type: Group
instructions:
  - type: ScheduleUploadTestResults
  - type: PrependToEnvironmentVariable
    variableName: PATH
    variableValue: "{{.Env.PYTHON3_PATH}}:"
    disable_if:
      condition: property
      property: host.os
      equals_value: Windows
  - type: EnvironmentVariable
    variableName: TESTRUNNER
    variableValue: "{{.Env.LIBEXEC_INSTALL_DIR}}qt-testrunner.py --"
    # Running wasm tests with the coin testrunner is not yet implemented
    disable_if:
      condition: property
      property: target.osVersion
      in_values: [WebAssembly]
  - type: AppendToEnvironmentVariable
    variableName: TESTRUNNER
    variableValue: " {{.SourceDir}}/coin_qnx_qemu_runner.sh"
    enable_if:
      condition: property
      property: target.os
      equals_value: QNX
  - type: AppendToEnvironmentVariable
    variableName: TESTRUNNER
    variableValue: " {{.AgentWorkingDir}}/coin_vxworks_qemu_runner.sh"
    enable_if:
      condition: property
      property: target.osVersion
      in_values: [VxWorks]
  - type: Group
    enable_if:
      condition: property
      property: features
      contains_value: UseAddressSanitizer
    instructions:
    - type: EnvironmentVariable
      variableName: ASAN_OPTIONS
      variableValue: "malloc_context_size=100:detect_leaks=0"
    - type: EnvironmentVariable
      # Override qt-testrunner as we don't want to gather test statistics
      # because many tests FAIL when built with ASAN.
      variableName: TESTRUNNER
      variableValue: "{{.Env.LIBEXEC_INSTALL_DIR}}sanitizer-testrunner.py"
  - type: EnvironmentVariable
    variableName: COIN_CTEST_RESULTSDIR
    variableValue: "{{.AgentWorkingDir}}\\testresults"
    enable_if:
      condition: property
      property: host.os
      equals_value: Windows
  - type: EnvironmentVariable
    variableName: COIN_CTEST_RESULTSDIR
    variableValue: "{{.AgentWorkingDir}}/testresults"
    disable_if:
      condition: property
      property: host.os
      equals_value: Windows

  - !include "{{qt/qtbase}}/vxworks_test_env_setup.yaml"

  # Only output verbose test output for failures, unless
  # the VerboseCTestOutput feature is enabled. The full
  # test output for all tests are still stored and uploaded
  # to coin for deeper investigations (see LastTest.log below)
  - type: AppendToEnvironmentVariable
    variableName: CTEST_ARGS
    variableValue: " --output-on-failure"
    disable_if:
      condition: property
      property: features
      contains_value: VerboseCTestOutput
  - type: AppendToEnvironmentVariable
    variableName: CTEST_ARGS
    variableValue: " -V"
    enable_if:
      condition: property
      property: features
      contains_value: VerboseCTestOutput

  - type: AppendToEnvironmentVariable
    variableName: CTEST_ARGS
    variableValue: " --stop-on-failure"
    enable_if:
      condition: property
      property: features
      contains_value: AbortTestingOnFirstFailure

  - type: AppendToEnvironmentVariable
    variableName: CTEST_ARGS
    variableValue: " --no-label-summary"

    # Enable CTest's JUnit XML summary
  - type: AppendToEnvironmentVariable
    variableName: CTEST_ARGS
    variableValue: " --output-junit {{.Env.COIN_CTEST_RESULTSDIR}}{{.Env.CI_PATH_SEP}}test_summary.ctest_junit_xml"
    disable_if:    # CMake < v3.21 does not support it
      condition: and
      conditions:
        - condition: runtime
          env_var: CMAKE_MIN_SUPPORTED_BIN_PATH
          not_equals_value: null
        - condition: runtime
          env_var: PATH
          contains_value: "{{.Env.CMAKE_MIN_SUPPORTED_BIN_PATH}}"

  - !include "{{qt/qtbase}}/coin_module_test_android_start_emulator.yaml"

  - type: EnvironmentVariable
    variableName: COIN_CROSS_PLATFORM_VERSION_TEST
    variableValue: "TRUE"
    enable_if:
      condition: and
      conditions:
        - condition: property
          property: platformDependency
          not_equals_value: null
        - condition: property
          property: platformDependency.target.osVersion
          not_equals_property: target.osVersion
        - condition: property
          property: features
          contains_value: TestOnly

  # 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: 14400
        maxTimeBetweenOutput: 14400
        userMessageOnFailure: >
          Failed to run tests.
      - type: ExecuteCommand
        command: >
          cmake -E copy
            Testing{{.Env.CI_PATH_SEP}}Temporary{{.Env.CI_PATH_SEP}}LastTest.log
            {{.Env.COIN_CTEST_RESULTSDIR}}{{.Env.CI_PATH_SEP}}CTest.log
        executeCommandArgumentSplitingBehavior: SplitAfterVariableSubstitution
        ignoreExitCode: false
        userMessageOnFailure: >
          Failed to copy LastTest.log to testresults directory.
        executeOn: always
  - 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: 14400
        maxTimeBetweenOutput: 14400
        userMessageOnFailure: >
          Failed to run tests.
      - type: ExecuteCommand
        command: >
          cmake -E copy
            Testing{{.Env.CI_PATH_SEP}}Temporary{{.Env.CI_PATH_SEP}}LastTest.log
            {{.Env.COIN_CTEST_RESULTSDIR}}{{.Env.CI_PATH_SEP}}CTest.log
        executeCommandArgumentSplitingBehavior: SplitAfterVariableSubstitution
        ignoreExitCode: true
        userMessageOnFailure: >
          Failed to copy LastTest.log to testresults directory.
        executeOn: always

  - type: Group
    instructions:
      # Qttestrunner does not work with bic tests.
      - type: EnvironmentVariable
        variableName: TESTRUNNER
        variableValue: ""
      - type: EnvironmentVariable
        variableName: QT_MODULE_TO_TEST
        variableValue: "{{.SourceDir}}"
      - type: PrependToEnvironmentVariable
        variableName: PATH
        variableValue: "{{.InstallDir}}/bin:"
      - type: InstallSourceArchive
        maxTimeInSeconds: 600
        maxTimeBetweenOutput: 600
        project: qt/qtqa
        ref: dev
        directory: qt/qtqa
        userMessageOnFailure: "Could not install qt/qtqa source archive. Please investigate why."
      - type: ChangeDirectory
        directory: "{{.AgentWorkingDir}}/qt/qtqa/tests/postbuild/bic"
      - type: ExecuteCommand
        command: ["{{.InstallDir}}/bin/qmake"]
        maxTimeInSeconds: 7200
        maxTimeBetweenOutput: 300
        userMessageOnFailure: "Failed to execute qmake for bic tests"
      - type: RunQtUnitTest
        runTestCommand: ["make", "check", "-j1"]
        directory: "{{.AgentWorkingDir}}/qt/qtqa/tests/postbuild/bic"
        testRepetitionAllowance: 0
        maxTimeInSeconds: 7200
        maxTimeBetweenOutput: 300
        userMessageOnFailure: "Running bic tests failed."
    enable_if:
      condition: and
      conditions:
        - condition: property
          property: features
          contains_value: Packaging
        - condition: property
          property: target.os
          equals_value: Linux
        - condition: property
          property: features
          contains_value: EnableBicTests