Skip to content

Commit 7432d1c

Browse files
committed
Add functionality to split build and run of e2e tests
1 parent aebfdc0 commit 7432d1c

File tree

2 files changed

+45
-11
lines changed

2 files changed

+45
-11
lines changed

sycl/test-e2e/format.py

Lines changed: 33 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -154,18 +154,26 @@ def execute(self, test, litConfig):
154154
if isinstance(script, lit.Test.Result):
155155
return script
156156

157-
devices_for_test = self.select_devices_for_test(test)
158-
if not devices_for_test:
159-
return lit.Test.Result(
160-
lit.Test.UNSUPPORTED, "No supported devices to run the test on"
161-
)
162-
163-
substitutions = lit.TestRunner.getDefaultSubstitutions(test, tmpDir, tmpBase)
157+
devices_for_test = []
164158
triples = set()
165-
for sycl_device in devices_for_test:
166-
(backend, _) = sycl_device.split(":")
167-
triples.add(get_triple(test, backend))
159+
if "run-mode" not in test.config.available_features:
160+
if "unsplit-mode" in test.requires or "TEMPORARY_DISABLED" in test.requires:
161+
return lit.Test.Result(
162+
lit.Test.UNSUPPORTED, "Test unsupported for this environment"
163+
)
164+
triples = {"spir64"}
165+
else:
166+
devices_for_test = self.select_devices_for_test(test)
167+
if not devices_for_test:
168+
return lit.Test.Result(
169+
lit.Test.UNSUPPORTED, "No supported devices to run the test on"
170+
)
171+
172+
for sycl_device in devices_for_test:
173+
(backend, _) = sycl_device.split(":")
174+
triples.add(get_triple(test, backend))
168175

176+
substitutions = lit.TestRunner.getDefaultSubstitutions(test, tmpDir, tmpBase)
169177
substitutions.append(("%{sycl_triple}", format(",".join(triples))))
170178
# -fsycl-targets is needed for CUDA/HIP, so just use it be default so
171179
# -that new tests by default would runnable there (unless they have
@@ -223,6 +231,17 @@ def get_extra_env(sycl_devices):
223231
new_script.append(directive)
224232
continue
225233

234+
# Filter commands based on split-mode
235+
is_run_line = any(
236+
i in directive.command
237+
for i in ["%{run}", "%{run-unfiltered-devices}", "%if run-mode"]
238+
)
239+
240+
if (is_run_line and "run-mode" not in test.config.available_features) or (
241+
not is_run_line and "build-mode" not in test.config.available_features
242+
):
243+
directive.command = ""
244+
226245
if "%{run}" not in directive.command:
227246
new_script.append(directive)
228247
continue
@@ -278,7 +297,10 @@ def get_extra_env(sycl_devices):
278297
test, litConfig, useExternalSh, script, tmpBase
279298
)
280299

281-
if len(devices_for_test) > 1:
300+
if (
301+
len(devices_for_test) > 1
302+
or "run-mode" not in test.config.available_features
303+
):
282304
return result
283305

284306
# Single device - might be an XFAIL.

sycl/test-e2e/lit.cfg.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,18 @@
3737
config.required_features = []
3838
config.unsupported_features = []
3939

40+
# split-mode: Set if tests should run normally or with split build/run
41+
match lit_config.params.get("split-mode", "both"):
42+
case "run":
43+
config.available_features.add("run-mode")
44+
case "build":
45+
config.available_features.add("build-mode")
46+
config.sycl_devices = []
47+
case _:
48+
config.available_features.add("run-mode")
49+
config.available_features.add("build-mode")
50+
config.available_features.add("unsplit-mode")
51+
4052
# Cleanup environment variables which may affect tests
4153
possibly_dangerous_env_vars = [
4254
"COMPILER_PATH",

0 commit comments

Comments
 (0)