diff --git a/data/test.schema.json b/data/test.schema.json index fc84d860f..1bcefea26 100644 --- a/data/test.schema.json +++ b/data/test.schema.json @@ -147,6 +147,12 @@ "items": { "type": "string" } + }, + "skip_on_os": { + "type": "array", + "items": { + "type": "string" + } } } } diff --git a/docs/markdown/Contributing.md b/docs/markdown/Contributing.md index 77981d795..474f88005 100644 --- a/docs/markdown/Contributing.md +++ b/docs/markdown/Contributing.md @@ -390,6 +390,14 @@ for whatever reason). 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 Meson uses several continuous integration testing systems that have diff --git a/run_project_tests.py b/run_project_tests.py index 73e85fa5f..ec356c43b 100755 --- a/run_project_tests.py +++ b/run_project_tests.py @@ -779,6 +779,17 @@ def load_test_json(t: TestDef, stdout_mandatory: bool) -> T.List[TestDef]: else: 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 if 'matrix' not in test_def: t.env.update(env)