Skip to content
11 changes: 8 additions & 3 deletions sycl/test-e2e/format.py
Original file line number Diff line number Diff line change
Expand Up @@ -234,14 +234,19 @@ def get_extra_env(sycl_devices):
new_script.append(directive)
continue

# Filter commands based on split-mode
# Filter commands based on testing mode
is_run_line = any(
i in directive.command
for i in ["%{run}", "%{run-unfiltered-devices}", "%if run-mode"]
)

if (is_run_line and test.config.test_mode == "build-only") or (
not is_run_line and test.config.test_mode == "run-only"
ignore_line_filtering = (
"build-and-run-mode" in test.requires
and test.config.fallback_build_run_only
)
if not ignore_line_filtering and (
(is_run_line and test.config.test_mode == "build-only")
or (not is_run_line and test.config.test_mode == "run-only")
):
directive.command = ""

Expand Down
4 changes: 4 additions & 0 deletions sycl/test-e2e/lit.cfg.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,16 @@

# test-mode: Set if tests should run normally or only build/run
config.test_mode = lit_config.params.get("test-mode", "full")
config.fallback_build_run_only = False
if config.test_mode == "full":
config.available_features.add("run-mode")
config.available_features.add("build-and-run-mode")
elif config.test_mode == "run-only":
lit_config.note("run-only test mode enabled, only executing tests")
config.available_features.add("run-mode")
if lit_config.params.get("fallback-to-build-if-requires-build-and-run", False):
config.available_features.add("build-and-run-mode")
config.fallback_build_run_only = True
elif config.test_mode == "build-only":
lit_config.note("build-only test mode enabled, only compiling tests")
config.sycl_devices = []
Expand Down
Loading