Add `skip_on_os` to test.json

This commit is contained in:
Jon Turney 2021-06-21 15:16:51 +01:00 committed by Daniel Mensinger
parent 7126fbaf81
commit a2e44296c9
3 changed files with 25 additions and 0 deletions

View File

@ -147,6 +147,12 @@
"items": { "items": {
"type": "string" "type": "string"
} }
},
"skip_on_os": {
"type": "array",
"items": {
"type": "string"
}
} }
} }
} }

View File

@ -390,6 +390,14 @@ for whatever reason).
The test is failed if it skips or runs unexpectedly. The test is failed if it skips or runs unexpectedly.
#### skip_on_os
The `skip_on_os` key can be used to specify a list of OS names (or their
negations, prefixed with a `!`). If at least one item in the `skip_on_os` list
is matched, the test is expected to be skipped.
The test is failed if it skips or runs unexpectedly.
### Skipping integration tests ### Skipping integration tests
Meson uses several continuous integration testing systems that have Meson uses several continuous integration testing systems that have

View File

@ -779,6 +779,17 @@ def load_test_json(t: TestDef, stdout_mandatory: bool) -> T.List[TestDef]:
else: else:
skip_expected = False skip_expected = False
# Test is expected to skip if os matches
if 'skip_on_os' in test_def:
mesonenv = environment.Environment(None, None, get_fake_options('/'))
for skip_os in test_def['skip_on_os']:
if skip_os.startswith('!'):
if mesonenv.machines.host.system != skip_os[1:]:
skip_expected = True
else:
if mesonenv.machines.host.system == skip_os:
skip_expected = True
# Skip the matrix code and just update the existing test # Skip the matrix code and just update the existing test
if 'matrix' not in test_def: if 'matrix' not in test_def:
t.env.update(env) t.env.update(env)