Skip to content

Commit 0841f5c

Browse files
authored
[SYCL][E2E] Add option to build tests on run-only mode if marked as REQUIRES: build-and-run-mode (#16306)
Prior if a test was marked as `REQUIRES: build-and-run-mode` it would be reported as unsupported in `run-only` mode, because there would be no test binaries created from `build-only` mode to be able to run the test. When calling lit with `--param test-mode=run-only --param fallback-to-build-if-requires-build-and-run=True`, tests that are marked with `REQUIRES: build-and-run-mode` will override the `RUN:` line filtering, and run all lines, including those that compile the test binaries. This makes it so we still have coverage of tests marked as exceptions for splitting on the `run-only` system.
1 parent 7f465fc commit 0841f5c

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

sycl/test-e2e/format.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -234,14 +234,19 @@ def get_extra_env(sycl_devices):
234234
new_script.append(directive)
235235
continue
236236

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

243-
if (is_run_line and test.config.test_mode == "build-only") or (
244-
not is_run_line and test.config.test_mode == "run-only"
243+
ignore_line_filtering = (
244+
"build-and-run-mode" in test.requires
245+
and test.config.fallback_build_run_only
246+
)
247+
if not ignore_line_filtering and (
248+
(is_run_line and test.config.test_mode == "build-only")
249+
or (not is_run_line and test.config.test_mode == "run-only")
245250
):
246251
directive.command = ""
247252

sycl/test-e2e/lit.cfg.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,12 +39,16 @@
3939

4040
# test-mode: Set if tests should run normally or only build/run
4141
config.test_mode = lit_config.params.get("test-mode", "full")
42+
config.fallback_build_run_only = False
4243
if config.test_mode == "full":
4344
config.available_features.add("run-mode")
4445
config.available_features.add("build-and-run-mode")
4546
elif config.test_mode == "run-only":
4647
lit_config.note("run-only test mode enabled, only executing tests")
4748
config.available_features.add("run-mode")
49+
if lit_config.params.get("fallback-to-build-if-requires-build-and-run", False):
50+
config.available_features.add("build-and-run-mode")
51+
config.fallback_build_run_only = True
4852
elif config.test_mode == "build-only":
4953
lit_config.note("build-only test mode enabled, only compiling tests")
5054
config.sycl_devices = []

0 commit comments

Comments
 (0)