@@ -154,18 +154,23 @@ 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" in test .config .available_features :
160+ devices_for_test = self .select_devices_for_test (test )
161+ if not devices_for_test :
162+ return lit .Test .Result (
163+ lit .Test .UNSUPPORTED , "No supported devices to run the test on"
164+ )
168165
166+ for sycl_device in devices_for_test :
167+ (backend , _ ) = sycl_device .split (":" )
168+ triples .add (get_triple (test , backend ))
169+ elif "build-mode" in test .config .available_features :
170+ # TODO: Use requires/unsupported to decide triples to build for
171+ triples .add ("spir64" )
172+
173+ substitutions = lit .TestRunner .getDefaultSubstitutions (test , tmpDir , tmpBase )
169174 substitutions .append (("%{sycl_triple}" , format ("," .join (triples ))))
170175 # -fsycl-targets is needed for CUDA/HIP, so just use it be default so
171176 # -that new tests by default would runnable there (unless they have
@@ -223,6 +228,15 @@ def get_extra_env(sycl_devices):
223228 new_script .append (directive )
224229 continue
225230
231+ # Filter commands based on split-mode
232+ is_run_line = any (i in directive .command for i in
233+ ["%{run}" ,"%{run-unfiltered-devices}" ,"%if run-mode" ])
234+
235+ if ((is_run_line and "run-mode" not in test .config .available_features ) or
236+ (not is_run_line and "build-mode" not in test .config .available_features )):
237+ directive .command = ""
238+
239+ # %{run} mode expansion
226240 if "%{run}" not in directive .command :
227241 new_script .append (directive )
228242 continue
@@ -278,7 +292,8 @@ def get_extra_env(sycl_devices):
278292 test , litConfig , useExternalSh , script , tmpBase
279293 )
280294
281- if len (devices_for_test ) > 1 :
295+ if (len (devices_for_test ) > 1 or
296+ "run-mode" not in test .config .available_features ):
282297 return result
283298
284299 # Single device - might be an XFAIL.
0 commit comments