Skip to content

[LIT] Rename substitution %basename_s to %{s:basename} #111062

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 4, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
5 changes: 3 additions & 2 deletions llvm/docs/CommandGuide/lit.rst
Original file line number Diff line number Diff line change
Expand Up @@ -535,15 +535,16 @@ TestRunner.py:
%{fs-tmp-root} root component of file system paths pointing to the test's temporary directory
%{fs-sep} file system path separator
%t temporary file name unique to the test
%basename_s The last path component of %s
%basename_t The last path component of %t but without the ``.tmp`` extension
%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
%{S:real} %S after expanding all symbolic links and substitute drives
%{p:real} %p after expanding all symbolic links and substitute drives
Expand Down
2 changes: 1 addition & 1 deletion llvm/test/TableGen/anonymous-location.td
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// RUN: llvm-tblgen --print-detailed-records %s | FileCheck %s -DFILE=%basename_s
// RUN: llvm-tblgen --print-detailed-records %s | FileCheck %s -DFILE=%{s:basename}

class A<int a> {
int Num = a;
Expand Down
4 changes: 3 additions & 1 deletion llvm/utils/lit/lit/TestRunner.py
Original file line number Diff line number Diff line change
Expand Up @@ -1399,7 +1399,9 @@ def getDefaultSubstitutions(test, tmpDir, tmpBase, normalize_slashes=False):

substitutions.append(("%{pathsep}", os.pathsep))
substitutions.append(("%basename_t", tmpBaseName))
substitutions.append(("%basename_s", sourceBaseName))

substitutions.append(("%{s:basename}", sourceBaseName))
substitutions.append(("%{t:stem}", tmpBaseName))

substitutions.extend(
[
Expand Down
8 changes: 5 additions & 3 deletions llvm/utils/lit/tests/substitutions.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Basic test for substitutions.
#
# RUN: echo %basename_s | FileCheck %s
#
# CHECK: substitutions.py
# RUN: echo %{s:basename} | FileCheck %s --check-prefix=BASENAME
# RUN: echo %{t:stem} %basename_t | FileCheck %s --check-prefix=TMPBASENAME

# BASENAME: substitutions.py
# TMPBASENAME: [[FIRST:[^[:space:]]+]] [[FIRST]]
Loading