diff --git a/.github/workflows/sycl-linux-run-tests.yml b/.github/workflows/sycl-linux-run-tests.yml index eb018efe0d62d..f49b6d1850f60 100644 --- a/.github/workflows/sycl-linux-run-tests.yml +++ b/.github/workflows/sycl-linux-run-tests.yml @@ -90,6 +90,7 @@ on: - '["amdgpu"]' - '["Linux", "arc"]' - '["cts-cpu"]' + - '["Linux", "build"]' image: description: | Use option ending with ":build" for AMDGPU, ":latest" for the rest. diff --git a/sycl/test-e2e/format.py b/sycl/test-e2e/format.py index e0cf41d8b118f..589074f68a076 100644 --- a/sycl/test-e2e/format.py +++ b/sycl/test-e2e/format.py @@ -154,18 +154,31 @@ def execute(self, test, litConfig): if isinstance(script, lit.Test.Result): return script - devices_for_test = self.select_devices_for_test(test) - if not devices_for_test: - return lit.Test.Result( - lit.Test.UNSUPPORTED, "No supported devices to run the test on" - ) - - substitutions = lit.TestRunner.getDefaultSubstitutions(test, tmpDir, tmpBase) + devices_for_test = [] triples = set() - for sycl_device in devices_for_test: - (backend, _) = sycl_device.split(":") - triples.add(get_triple(test, backend)) + unsplit_test = False + for l in test.requires: + if "run-mode" in re.findall("[-+=._a-zA-Z0-9]+", l): + unsplit_test = True + break + if "run-mode" not in test.config.available_features: + if unsplit_test: + return lit.Test.Result( + lit.Test.UNSUPPORTED, "Tests unsupported on split build" + ) + triples = {"spir64"} + else: + devices_for_test = self.select_devices_for_test(test) + if not devices_for_test: + return lit.Test.Result( + lit.Test.UNSUPPORTED, "No supported devices to run the test on" + ) + + for sycl_device in devices_for_test: + (backend, _) = sycl_device.split(":") + triples.add(get_triple(test, backend)) + substitutions = lit.TestRunner.getDefaultSubstitutions(test, tmpDir, tmpBase) substitutions.append(("%{sycl_triple}", format(",".join(triples)))) # -fsycl-targets is needed for CUDA/HIP, so just use it be default so # -that new tests by default would runnable there (unless they have @@ -223,6 +236,17 @@ def get_extra_env(sycl_devices): new_script.append(directive) continue + # Filter commands based on split-mode + is_run_line = unsplit_test or any( + i in directive.command + for i in ["%{run}", "%{run-unfiltered-devices}", "%if run-mode"] + ) + + if (is_run_line and "run-mode" not in test.config.available_features) or ( + not is_run_line and "build-mode" not in test.config.available_features + ): + directive.command = "" + if "%{run}" not in directive.command: new_script.append(directive) continue @@ -278,7 +302,10 @@ def get_extra_env(sycl_devices): test, litConfig, useExternalSh, script, tmpBase ) - if len(devices_for_test) > 1: + if ( + len(devices_for_test) > 1 + or "run-mode" not in test.config.available_features + ): return result # Single device - might be an XFAIL. diff --git a/sycl/test-e2e/lit.cfg.py b/sycl/test-e2e/lit.cfg.py index ee91220fd3be3..b8908b871ab37 100644 --- a/sycl/test-e2e/lit.cfg.py +++ b/sycl/test-e2e/lit.cfg.py @@ -16,6 +16,16 @@ # Configuration file for the 'lit' test runner. +# split-mode: Set if tests should run normally or with split build/run +match lit_config.params.get("split-mode", "both"): + case "run": + config.available_features.add("run-mode") + case "build": + config.available_features.add("build-mode") + case _: + config.available_features.add("run-mode") + config.available_features.add("build-mode") + # name: The name of this test suite. config.name = "SYCL"