From bf2e609c8cc95d5794267c8d9e84867950f8b9c3 Mon Sep 17 00:00:00 2001 From: Katarzyna Kaczmarska Date: Fri, 10 Jul 2026 12:19:59 +0200 Subject: [PATCH] [LIT] 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'. --- 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( [