diff --git a/sycl/test-e2e/format.py b/sycl/test-e2e/format.py index cb4ac86008db2..74573007a681e 100644 --- a/sycl/test-e2e/format.py +++ b/sycl/test-e2e/format.py @@ -234,14 +234,19 @@ def get_extra_env(sycl_devices): new_script.append(directive) continue - # Filter commands based on split-mode + # Filter commands based on testing mode is_run_line = any( i in directive.command for i in ["%{run}", "%{run-unfiltered-devices}", "%if run-mode"] ) - if (is_run_line and test.config.test_mode == "build-only") or ( - not is_run_line and test.config.test_mode == "run-only" + ignore_line_filtering = ( + "build-and-run-mode" in test.requires + and test.config.fallback_build_run_only + ) + if not ignore_line_filtering and ( + (is_run_line and test.config.test_mode == "build-only") + or (not is_run_line and test.config.test_mode == "run-only") ): directive.command = "" diff --git a/sycl/test-e2e/lit.cfg.py b/sycl/test-e2e/lit.cfg.py index acd681718facd..441ad084aa133 100644 --- a/sycl/test-e2e/lit.cfg.py +++ b/sycl/test-e2e/lit.cfg.py @@ -39,12 +39,16 @@ # test-mode: Set if tests should run normally or only build/run config.test_mode = lit_config.params.get("test-mode", "full") +config.fallback_build_run_only = False if config.test_mode == "full": config.available_features.add("run-mode") config.available_features.add("build-and-run-mode") elif config.test_mode == "run-only": lit_config.note("run-only test mode enabled, only executing tests") config.available_features.add("run-mode") + if lit_config.params.get("fallback-to-build-if-requires-build-and-run", False): + config.available_features.add("build-and-run-mode") + config.fallback_build_run_only = True elif config.test_mode == "build-only": lit_config.note("build-only test mode enabled, only compiling tests") config.sycl_devices = []