[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:37:31 PDT 2026
https://github.com/kekaczma created https://github.com/llvm/llvm-project/pull/210296
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.
>From d4207be33e7d934119b94d1b1cb542796a88e520 Mon Sep 17 00:00:00 2001
From: Katarzyna Kaczmarska <katarzynax.e.kaczmarska at intel.com>
Date: Fri, 17 Jul 2026 12:40:28 +0200
Subject: [PATCH] [LIT][NFC] Fix double slash in GoogleTest format test names
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.
---
llvm/utils/lit/lit/formats/googletest.py | 26 ++++++++++++++++--------
1 file changed, 18 insertions(+), 8 deletions(-)
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(
[
More information about the llvm-commits
mailing list