[llvm] [LIT][NFC] Fix double slash in GoogleTest format test names (PR #210296)
via llvm-commits
llvm-commits at lists.llvm.org
Fri Jul 17 03:38:32 PDT 2026
llvmorg-github-actions[bot] wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-testing-tools
Author: kekaczma
<details>
<summary>Changes</summary>
When test_sub_dirs is empty, split creates [''] causing double slashes in test names like 'Suite :: device//device-test/Name'.
Fix: Filter empty strings and use ['.'] as default, skip '.' in path construction to produce 'Suite :: device/device-test/Name'.
This change improves test name consistency, which is needed for automated CI test result collection and analysis.
---
Full diff: https://github.com/llvm/llvm-project/pull/210296.diff
1 Files Affected:
- (modified) llvm/utils/lit/lit/formats/googletest.py (+18-8)
``````````diff
diff --git a/llvm/utils/lit/lit/formats/googletest.py b/llvm/utils/lit/lit/formats/googletest.py
index e567cce541beb..121e89531e226 100644
--- a/llvm/utils/lit/lit/formats/googletest.py
+++ b/llvm/utils/lit/lit/formats/googletest.py
@@ -16,7 +16,7 @@
class GoogleTest(TestFormat):
def __init__(self, test_sub_dirs, test_suffix, run_under=[], test_prefix=None):
self.seen_executables = set()
- self.test_sub_dirs = str(test_sub_dirs).split(";")
+ self.test_sub_dirs = [d for d in str(test_sub_dirs).split(";") if d] or ["."]
# On Windows, assume tests will also end in '.exe'.
exe_suffix = str(test_suffix)
@@ -80,12 +80,19 @@ def getTestsInDirectory(self, testSuite, path_in_suite, litConfig, localConfig):
# Create one lit test for each shard.
for idx in range(nshard):
- testPath = path_in_suite + (
- subdir,
- fn,
- str(idx),
- str(nshard),
- )
+ if subdir == ".":
+ testPath = path_in_suite + (
+ fn,
+ str(idx),
+ str(nshard),
+ )
+ else:
+ testPath = path_in_suite + (
+ subdir,
+ fn,
+ str(idx),
+ str(nshard),
+ )
json_file = (
"-".join(
[
@@ -106,7 +113,10 @@ def getTestsInDirectory(self, testSuite, path_in_suite, litConfig, localConfig):
gtest_json_file=json_file,
)
else:
- testPath = path_in_suite + (subdir, fn)
+ if subdir == ".":
+ testPath = path_in_suite + (fn,)
+ else:
+ testPath = path_in_suite + (subdir, fn)
json_file = (
"-".join(
[
``````````
</details>
https://github.com/llvm/llvm-project/pull/210296
More information about the llvm-commits
mailing list