[llvm] [lit] Add --per-test-output-subdir to isolate test_exec_root across concurrent runs (PR #206826)

Aiden Grossman via llvm-commits llvm-commits at lists.llvm.org
Sun Jul 19 14:29:50 PDT 2026


================
@@ -243,6 +244,18 @@ def finish(self, litConfig):
             # FIXME: This should really only be suite in test suite config
             # files. Should we distinguish them?
             self.test_exec_root = str(self.test_exec_root)
+        # Optionally relocate this suite's writable output tree under a
+        # caller-specified root, so %t/Output/.lit_test_times.txt/etc. resolve
+        # under <root>/<suite-name> instead of the build tree.
+        if litConfig.test_output_root and not getattr(
+            self, "_test_output_root_applied", False
+        ):
+            # Sanitize the suite name into a single safe path component.
+            suite_dir = re.sub(r"[^\w.-]", "_", self.name)
+            self.test_exec_root = os.path.join(
+                os.path.abspath(litConfig.test_output_root), suite_dir
+            )
+            self._test_output_root_applied = True
----------------
boomanaiden154 wrote:

I'm thinking it would be good to have a regression test with a site specific lit config to ensure that this works as expected.

https://github.com/llvm/llvm-project/pull/206826


More information about the llvm-commits mailing list