Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions libcxx/utils/libcxx/test/format.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ def parseScript(test, preamble):
# errors, which doesn't make sense for clang-verify tests because we may want to check
# for specific warning diagnostics.
_checkBaseSubstitutions(substitutions)
substitutions.append(("%T", tmpDir))
substitutions.append(
("%{build}", "%{cxx} %s %{flags} %{compile_flags} %{link_flags} -o %t.exe")
)
Expand Down
6 changes: 0 additions & 6 deletions llvm/docs/CommandGuide/lit.rst
Original file line number Diff line number Diff line change
Expand Up @@ -630,13 +630,11 @@ TestRunner.py:
%{fs-sep} file system path separator
%t temporary file name unique to the test
%basename_t The last path component of %t but without the ``.tmp`` extension (deprecated, use ``%{t:stem}`` instead)
%T parent directory of %t (not unique, deprecated, do not use)
%% %
%/s %s but ``\`` is replaced by ``/``
%/S %S but ``\`` is replaced by ``/``
%/p %p but ``\`` is replaced by ``/``
%/t %t but ``\`` is replaced by ``/``
%/T %T but ``\`` is replaced by ``/``
%{s:basename} The last path component of %s
%{t:stem} The last path component of %t but without the ``.tmp`` extension (alias for %basename_t)
%{s:real} %s after expanding all symbolic links and substitute drives
Expand All @@ -648,12 +646,10 @@ TestRunner.py:
%{/S:real} %/S after expanding all symbolic links and substitute drives
%{/p:real} %/p after expanding all symbolic links and substitute drives
%{/t:real} %/t after expanding all symbolic links and substitute drives
%{/T:real} %/T after expanding all symbolic links and substitute drives
%{/s:regex_replacement} %/s but escaped for use in the replacement of a ``s@@@`` command in sed
%{/S:regex_replacement} %/S but escaped for use in the replacement of a ``s@@@`` command in sed
%{/p:regex_replacement} %/p but escaped for use in the replacement of a ``s@@@`` command in sed
%{/t:regex_replacement} %/t but escaped for use in the replacement of a ``s@@@`` command in sed
%{/T:regex_replacement} %/T but escaped for use in the replacement of a ``s@@@`` command in sed
%:s On Windows, %/s but a ``:`` is removed if its the second character.
Otherwise, %s but with a single leading ``/`` removed.
%:S On Windows, %/S but a ``:`` is removed if its the second character.
Expand All @@ -662,8 +658,6 @@ TestRunner.py:
Otherwise, %p but with a single leading ``/`` removed.
%:t On Windows, %/t but a ``:`` is removed if its the second character.
Otherwise, %t but with a single leading ``/`` removed.
%:T On Windows, %/T but a ``:`` is removed if its the second character.
Otherwise, %T but with a single leading ``/`` removed.
%{readfile:<filename>} Reads the file specified.
======================= ==============

Expand Down
1 change: 1 addition & 0 deletions llvm/docs/ReleaseNotes.md
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@ Changes to the LLVM tools

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

Changes to LLDB
---------------------------------
Expand Down
14 changes: 12 additions & 2 deletions llvm/utils/lit/lit/TestRunner.py
Original file line number Diff line number Diff line change
Expand Up @@ -1541,8 +1541,10 @@ def regex_escape(s):
return s

path_substitutions = [
("s", sourcepath), ("S", sourcedir), ("p", sourcedir),
("t", tmpName), ("T", tmpDir)
("s", sourcepath),
("S", sourcedir),
("p", sourcedir),
("t", tmpName),
]
for path_substitution in path_substitutions:
letter = path_substitution[0]
Expand Down Expand Up @@ -1919,6 +1921,14 @@ def processLine(ln):
# seems reasonable.
ln = _caching_re_compile(a).sub(str(b), escapePercents(ln))

# TODO(boomanaiden154): Remove when we branch LLVM 22 so people on the
# release branch will have sufficient time to migrate.
if bool(_caching_re_compile("%T").search(ln)):
raise ValueError(
"%T is no longer supported. Please create directories with names "
"based on %t."
)

# Strip the trailing newline and any extra whitespace.
return ln.strip()

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Check that we return a decent error message when someone uses %T
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# Check that we return a decent error message when someone uses %T
# Check that we return a decent error message when someone uses %T.

# RUN: echo %T > %t
56 changes: 28 additions & 28 deletions llvm/utils/lit/tests/Inputs/shtest-shell/valid-shell.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,50 +18,50 @@
# Check force remove commands success whether the directory does or doesn't exist.
#
# Check the mkdir command with -p option.
# RUN: rm -f -r %T/test
# RUN: %{python} %S/../check_path.py dir %T/test > %t.out
# RUN: rm -f -r %t.test
# RUN: %{python} %S/../check_path.py dir %t.test > %t.out
# RUN: FileCheck --check-prefix=REMOVE-PARENT-DIR < %t.out %s
# RUN: mkdir -p %T/test
# RUN: %{python} %S/../check_path.py dir %T/test > %t.out
# RUN: mkdir -p %t.test
# RUN: %{python} %S/../check_path.py dir %t.test > %t.out
# RUN: FileCheck --check-prefix=MAKE-PARENT-DIR < %t.out %s
# RUN: rm -f %T/test || true
# RUN: rm -f -r %T/test
# RUN: %{python} %S/../check_path.py dir %T/test > %t.out
# RUN: rm -f %t.test || true
# RUN: rm -f -r %t.test
# RUN: %{python} %S/../check_path.py dir %t.test > %t.out
# RUN: FileCheck --check-prefix=REMOVE-PARENT-DIR < %t.out %s
#
# MAKE-PARENT-DIR: True
# REMOVE-PARENT-DIR: False
#
# Check the mkdir command without -p option.
#
# RUN: rm -rf %T/test1
# RUN: mkdir %T/test1
# RUN: %{python} %S/../check_path.py dir %T/test1 > %t.out
# RUN: rm -rf %t.test1
# RUN: mkdir %t.test1
# RUN: %{python} %S/../check_path.py dir %t.test1 > %t.out
# RUN: FileCheck --check-prefix=MAKE-DIR < %t.out %s
# RUN: cd %T/test1 && mkdir foo
# RUN: %{python} %S/../check_path.py dir %T/test1 > %t.out
# RUN: cd %t.test1 && mkdir foo
# RUN: %{python} %S/../check_path.py dir %t.test1 > %t.out
# RUN: FileCheck --check-prefix=MAKE-DIR < %t.out %s
# RUN: cd %T && rm -rf %T/test1
# RUN: %{python} %S/../check_path.py dir %T/test1 > %t.out
# RUN: cd .. && rm -rf %t.test1
# RUN: %{python} %S/../check_path.py dir %t.test1 > %t.out
# RUN: FileCheck --check-prefix=REMOVE-DIR < %t.out %s
#
# MAKE-DIR: True
# REMOVE-DIR: False
#
# Check creating and removing multiple folders and rm * operation.
#
# RUN: rm -rf %T/test
# RUN: mkdir -p %T/test/test1 %T/test/test2
# RUN: %{python} %S/../check_path.py dir %T/test %T/test/test1 %T/test/test2 > %t.out
# RUN: rm -rf %t.test
# RUN: mkdir -p %t.test/test1 %t.test/test2
# RUN: %{python} %S/../check_path.py dir %t.test %t.test/test1 %t.test/test2 > %t.out
# RUN: FileCheck --check-prefix=DIRS-EXIST < %t.out %s
# RUN: mkdir %T/test || true
# RUN: echo "create a temp file" > %T/test/temp.write
# RUN: echo "create a temp1 file" > %T/test/test1/temp1.write
# RUN: echo "create a temp2 file" > %T/test/test2/temp2.write
# RUN: %{python} %S/../check_path.py file %T/test/temp.write %T/test/test1/temp1.write %T/test/test2/temp2.write> %t.out
# RUN: mkdir %t.test || true
# RUN: echo "create a temp file" > %t.test/temp.write
# RUN: echo "create a temp1 file" > %t.test/test1/temp1.write
# RUN: echo "create a temp2 file" > %t.test/test2/temp2.write
# RUN: %{python} %S/../check_path.py file %t.test/temp.write %t.test/test1/temp1.write %t.test/test2/temp2.write> %t.out
# RUN: FileCheck --check-prefix=FILES-EXIST < %t.out %s
# RUN: rm -r -f %T/*
# RUN: %{python} %S/../check_path.py dir %T/test > %t.out
# RUN: rm -r -f %t*
# RUN: %{python} %S/../check_path.py dir %t.test > %t.out
# RUN: FileCheck --check-prefix=REMOVE-ALL < %t.out %s
#
# DIRS-EXIST: True
Expand All @@ -81,7 +81,7 @@
# RUN: echo "hello-2" > %t1.stdout
# RUN: diff %t.stdout %t1.stdout || true
#
# RUN: mkdir -p %T/dir1 %T/dir2
# RUN: cd %T/dir1 && echo "hello" > temp1.txt
# RUN: cd %T/dir2 && echo "hello" > temp2.txt
# RUN: diff temp2.txt ../dir1/temp1.txt
# RUN: mkdir -p %t.dir1 %t.dir2
# RUN: cd %t.dir1 && echo "hello" > temp1.txt
# RUN: cd %t.dir2 && echo "hello" > temp2.txt
# RUN: diff temp2.txt ../%{t:stem}.tmp.dir1/temp1.txt
6 changes: 5 additions & 1 deletion llvm/utils/lit/tests/shtest-shell.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@

# CHECK: -- Testing:

# CHECK: UNRESOLVED: shtest-shell :: capital-t-error-message.txt
# CHECK: *** TEST 'shtest-shell :: capital-t-error-message.txt' FAILED ***
# CHECK: ValueError: %T is no longer supported. Please create directories with names based on %t.

# CHECK: FAIL: shtest-shell :: colon-error.txt
# CHECK: *** TEST 'shtest-shell :: colon-error.txt' FAILED ***
# CHECK: :
Expand Down Expand Up @@ -633,5 +637,5 @@
# CHECK: ***

# CHECK: PASS: shtest-shell :: valid-shell.txt
# CHECK: Unresolved Tests (1)
# CHECK: Unresolved Tests (2)
# CHECK: Failed Tests (37)
Loading