You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[Fortran/gfortran] Initial support to override DejaGNU annotations
The DejaGNU annotations in the gfortran test suite sometimes need to be
overridden, for instance in cases where the one of the compilers generates a
compile error for some non-standard extension while the other does not. This
PR adds support to override the some annotations, such as forcing a test to
pass with flang where it would fail in gfortran.
For now, only some of the behavior can be overridden, but this could be
extended in the future. The documentation was updated to reflect this (some
cleanup of the documentation was also carried out). Similarly, the static
test configuration generation script was updated and cleaned up.
An override file is also provided for two tests that were disabled in
27a6a3a since they are expected to pass in flang. The static test
configuration was also updated to reflect this change.
`DisabledFiles_FOO.cmake` files can be created in the appropriate subdirectories
132
132
if enabling the feature/flag results in the failure of tests that otherwise pass.
133
133
Conversely, the feature/flag may cause some disabled tests to pass. These can be
134
-
added to an allowlist file, `EnabledFiles_FOO.cmake` in the corresponding
135
-
directory. The file must contain a single variable named `ENABLED_FILES` with
134
+
added to an allowlist file, `EnabledFiles_FOO.cmake` in the corresponding
135
+
directory. The file must contain a single variable named `ENABLED_FILES` with
136
136
the file names of the tests that should be enabled (in the case of multi-file
137
137
tests, this should be the name of the "main" file). An example of such a list is
138
138
below.
@@ -152,8 +152,8 @@ implemented at a steady pace. The relevant tests in this directory should be
152
152
enabled. This would involve building the test suite with one of the
153
153
`TEST_SUITE_FORTRAN_*` flags described above.
154
154
155
-
The build system uses static test configuration files named `tests.cmake` to be
156
-
found in the various subdirectories of the test suite. These are generated by
155
+
The build system uses static test configuration files named `tests.cmake` to be
156
+
found in the various subdirectories of the test suite. These are generated by
157
157
`utils/update-test-config.py`. The configuration files are the result of parsing
158
158
the relevant DejaGNU annotations from the test files and are used by the various
159
159
`CMakeLists.txt` files to set up the tests. These configuration files *must not*
@@ -178,29 +178,169 @@ Each field is described in the table below:
178
178
| `<disabled-on>`| A space-separated list of targets on which the test is disabled. Each element of the list will be a regular expression that is expected to match an LLVM target triple.
179
179
180
180
The test `kind`'s generally reflect what is being tested. For instance,
181
-
`preprocess` tests only run the preprocessor, `assemble` tests generate assembly
181
+
`preprocess` tests only run the preprocessor, `assemble` tests generate assembly
182
182
but no object code, the `compile` tests generate object code but do not invoke
183
183
the linker while the `link` tests do invoke the linker. The `run` tests are
184
184
"end-to-end" in that the code is compiled, linked and executed. These tests
185
185
generally examine the output of the execution to ensure that the behavior of the
186
186
generated executable is as expected.
187
187
188
-
The test files should be kept in sync with gfortran. This has to be done
189
-
manually. When performing this update, the test configuration files must be
188
+
The test files should be kept in sync with gfortran. This has to be done
189
+
manually. When performing this update, the test configuration files must be
190
190
regenerated. This can be done by running `update-test-config.py` in the root of
191
191
the test suite. The `-h` switch can be provided to the script for additional
192
192
options.
193
193
194
194
The test files in `regression` and `torture`*must not* be modified.
195
195
196
+
### Overriding DejaGNU annotations ###
197
+
198
+
In some cases, it may be necessary to override the DejaGNU annotations. Some of
199
+
these include:
200
+
201
+
- To invert the xfail status of a test (which is usually needed when there is
202
+
a difference in behavior between gfortran and flang)
203
+
204
+
- To selectively enable/disable a test on a particular platform.
205
+
206
+
- In cases where a warning is expected, to override the gfortran-specific
207
+
warning message with a flang-specific one.
208
+
209
+
For now, only limited forms of overriding are supported. In particular, we
210
+
do not support overriding warning messages, but that might be supported in the
211
+
future.
212
+
213
+
In order to override annotations for tests in a given directory, create a
214
+
file named `override.yaml` in that directory. The format of the file is
215
+
described below. After the file has been populated, the static test
216
+
configuration files must be updated by running `update-test-config.py` as shown
217
+
below. This will update all the `tests.cmake` files in the test suite.
218
+
219
+
```
220
+
$ cd /path/to/llvm-test-suite/Fortran/gfortran
221
+
$ ./utils/update-test-config.py
222
+
```
223
+
224
+
#### override.yaml ####
225
+
226
+
The `override.yaml` file can only be used to override attributes of tests
227
+
contained within the directory containing `override.yaml`. In order to override
228
+
attributes of tests in subdirectories, an `override.yaml` file must be created
229
+
in the subdirectory. This file only needs to be created if necessary. Unlike
230
+
the `DisabledFiles.cmake` files, it does not need to be present if test
231
+
attributes do not need to be overridden. At a high level, the format of the
232
+
file is as follows:
233
+
234
+
```
235
+
---
236
+
"file1":
237
+
attr-name-1: attr-val-1
238
+
attr-name-2: attr-val-2
239
+
...
240
+
241
+
"file2":
242
+
attr-name-1: attr-val-2
243
+
...
244
+
245
+
...
246
+
247
+
```
248
+
249
+
Here each "fileN" is the full file name (including the extension) of the test.
250
+
In the case of multi-file tests, this must be the name of the main test file.
251
+
This must not contain paths (relative or absolute).
252
+
253
+
The following attributes are currently supported.
254
+
255
+
#### `disabled_on` ###
256
+
257
+
The value must be a list of strings. Each string describes a platform on which
258
+
the test must be disabled. This will usually be a target triple, and may be a
259
+
regex.
260
+
261
+
This can be used to disable tests on platforms on which they have been
262
+
explicitly enabled (this usually occurs when tests are restricted to run only
263
+
on certain platforms). In such cases, the string that is used to specify the
264
+
platform must exactly match the string that was used in a DejaGNU annotation.
265
+
For instance, the test `regression/simd-builtins-1.f90` is explicitly enabled
266
+
on certain Linux platforms only. This is done in the following annotation:
0 commit comments