Skip to content

Commit 0f19c31

Browse files
committed
Add test.config.split_mode variable to clean up if statements
1 parent b8e6cfc commit 0f19c31

File tree

2 files changed

+7
-9
lines changed

2 files changed

+7
-9
lines changed

sycl/test-e2e/format.py

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ def execute(self, test, litConfig):
156156

157157
devices_for_test = []
158158
triples = set()
159-
if "run-mode" not in test.config.available_features:
159+
if test.config.split_mode == "build-only":
160160
if "unsplit-test-mode" in test.requires or "TEMPORARY_DISABLED" in test.requires:
161161
return lit.Test.Result(
162162
lit.Test.UNSUPPORTED, "Test unsupported for this environment"
@@ -237,8 +237,8 @@ def get_extra_env(sycl_devices):
237237
for i in ["%{run}", "%{run-unfiltered-devices}", "%if run-mode"]
238238
)
239239

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
240+
if (is_run_line and test.config.split_mode == "build-only") or (
241+
not is_run_line and test.config.split_mode == "run-only"
242242
):
243243
directive.command = ""
244244

@@ -297,10 +297,7 @@ def get_extra_env(sycl_devices):
297297
test, litConfig, useExternalSh, script, tmpBase
298298
)
299299

300-
if (
301-
len(devices_for_test) > 1
302-
or "run-mode" not in test.config.available_features
303-
):
300+
if (len(devices_for_test) > 1 or test.config.split_mode == "build-only"):
304301
return result
305302

306303
# Single device - might be an XFAIL.

sycl/test-e2e/lit.cfg.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,14 @@
4040
# split-mode: Set if tests should run normally or with split build/run
4141
match lit_config.params.get("split-mode", "both"):
4242
case "run":
43+
config.split_mode="run-only"
4344
config.available_features.add("run-mode")
4445
case "build":
45-
config.available_features.add("build-mode")
46+
config.split_mode="build-only"
4647
config.sycl_devices = []
4748
case _:
49+
config.split_mode="unsplit"
4850
config.available_features.add("run-mode")
49-
config.available_features.add("build-mode")
5051
config.available_features.add("unsplit-test-mode")
5152

5253
# Cleanup environment variables which may affect tests

0 commit comments

Comments
 (0)