@@ -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.
0 commit comments