Skip to content

Commit 7ff6973

Browse files
[lit] Remove support for %T
This patch removes support for %T from llvm-lit. For now we mark the test unresolved and add an error message noting the substitution is deprecated. This is exactly the same as the error handling for other substitution failures. We intend to remove support for the nice error message once 22 branches as users should have moved over by the they are upgrading to v23. Reviewers: petrhosek, jh7370, ilovepi, pogo59, cmtice Reviewed By: cmtice, jh7370, ilovepi Pull Request: #160028
1 parent be6c5d0 commit 7ff6973

File tree

5 files changed

+20
-9
lines changed

5 files changed

+20
-9
lines changed

llvm/docs/CommandGuide/lit.rst

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -630,13 +630,11 @@ TestRunner.py:
630630
%{fs-sep} file system path separator
631631
%t temporary file name unique to the test
632632
%basename_t The last path component of %t but without the ``.tmp`` extension (deprecated, use ``%{t:stem}`` instead)
633-
%T parent directory of %t (not unique, deprecated, do not use)
634633
%% %
635634
%/s %s but ``\`` is replaced by ``/``
636635
%/S %S but ``\`` is replaced by ``/``
637636
%/p %p but ``\`` is replaced by ``/``
638637
%/t %t but ``\`` is replaced by ``/``
639-
%/T %T but ``\`` is replaced by ``/``
640638
%{s:basename} The last path component of %s
641639
%{t:stem} The last path component of %t but without the ``.tmp`` extension (alias for %basename_t)
642640
%{s:real} %s after expanding all symbolic links and substitute drives
@@ -648,12 +646,10 @@ TestRunner.py:
648646
%{/S:real} %/S after expanding all symbolic links and substitute drives
649647
%{/p:real} %/p after expanding all symbolic links and substitute drives
650648
%{/t:real} %/t after expanding all symbolic links and substitute drives
651-
%{/T:real} %/T after expanding all symbolic links and substitute drives
652649
%{/s:regex_replacement} %/s but escaped for use in the replacement of a ``s@@@`` command in sed
653650
%{/S:regex_replacement} %/S but escaped for use in the replacement of a ``s@@@`` command in sed
654651
%{/p:regex_replacement} %/p but escaped for use in the replacement of a ``s@@@`` command in sed
655652
%{/t:regex_replacement} %/t but escaped for use in the replacement of a ``s@@@`` command in sed
656-
%{/T:regex_replacement} %/T but escaped for use in the replacement of a ``s@@@`` command in sed
657653
%:s On Windows, %/s but a ``:`` is removed if its the second character.
658654
Otherwise, %s but with a single leading ``/`` removed.
659655
%:S On Windows, %/S but a ``:`` is removed if its the second character.
@@ -662,8 +658,6 @@ TestRunner.py:
662658
Otherwise, %p but with a single leading ``/`` removed.
663659
%:t On Windows, %/t but a ``:`` is removed if its the second character.
664660
Otherwise, %t but with a single leading ``/`` removed.
665-
%:T On Windows, %/T but a ``:`` is removed if its the second character.
666-
Otherwise, %T but with a single leading ``/`` removed.
667661
%{readfile:<filename>} Reads the file specified.
668662
======================= ==============
669663

llvm/docs/ReleaseNotes.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,7 @@ Changes to the LLVM tools
160160

161161
* `llvm-readelf` now dumps all hex format values in lower-case mode.
162162
* Some code paths for supporting Python 2.7 in `llvm-lit` have been removed.
163+
* Support for `%T` in lit has been removed.
163164

164165
Changes to LLDB
165166
---------------------------------

llvm/utils/lit/lit/TestRunner.py

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1541,8 +1541,10 @@ def regex_escape(s):
15411541
return s
15421542

15431543
path_substitutions = [
1544-
("s", sourcepath), ("S", sourcedir), ("p", sourcedir),
1545-
("t", tmpName), ("T", tmpDir)
1544+
("s", sourcepath),
1545+
("S", sourcedir),
1546+
("p", sourcedir),
1547+
("t", tmpName),
15461548
]
15471549
for path_substitution in path_substitutions:
15481550
letter = path_substitution[0]
@@ -1919,6 +1921,14 @@ def processLine(ln):
19191921
# seems reasonable.
19201922
ln = _caching_re_compile(a).sub(str(b), escapePercents(ln))
19211923

1924+
# TODO(boomanaiden154): Remove when we branch LLVM 22 so people on the
1925+
# release branch will have sufficient time to migrate.
1926+
if bool(_caching_re_compile("%T").search(ln)):
1927+
raise ValueError(
1928+
"%T is no longer supported. Please create directories with names "
1929+
"based on %t."
1930+
)
1931+
19221932
# Strip the trailing newline and any extra whitespace.
19231933
return ln.strip()
19241934

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# Check that we return a decent error message when someone uses %T
2+
# RUN: echo %T > %t

llvm/utils/lit/tests/shtest-shell.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@
1212

1313
# CHECK: -- Testing:
1414

15+
# CHECK: UNRESOLVED: shtest-shell :: capital-t-error-message.txt
16+
# CHECK: *** TEST 'shtest-shell :: capital-t-error-message.txt' FAILED ***
17+
# CHECK: ValueError: %T is no longer supported. Please create directories with names based on %t.
18+
1519
# CHECK: FAIL: shtest-shell :: colon-error.txt
1620
# CHECK: *** TEST 'shtest-shell :: colon-error.txt' FAILED ***
1721
# CHECK: :
@@ -633,5 +637,5 @@
633637
# CHECK: ***
634638

635639
# CHECK: PASS: shtest-shell :: valid-shell.txt
636-
# CHECK: Unresolved Tests (1)
640+
# CHECK: Unresolved Tests (2)
637641
# CHECK: Failed Tests (37)

0 commit comments

Comments
 (0)