Skip to content
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
1 change: 1 addition & 0 deletions llvm/docs/CommandGuide/lit.rst
Original file line number Diff line number Diff line change
Expand Up @@ -535,6 +535,7 @@ 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
Copy link
Member

Choose a reason for hiding this comment

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

I see this is consistent with the already existing basename_t, but I feel that it would make a lot more sense if this was consistent with %{s:real} and %{/s:regex_replacement} as below, i.e. %{s:basename}.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Let me look into changing this. I agree this makes sense.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I created: #111062, will start review once checks pass.

%basename_t The last path component of %t but without the ``.tmp`` extension
%T parent directory of %t (not unique, deprecated, do not use)
%% %
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=anonymous-location.td
// RUN: llvm-tblgen --print-detailed-records %s | FileCheck %s -DFILE=%basename_s

class A<int a> {
int Num = a;
Expand Down
6 changes: 4 additions & 2 deletions llvm/utils/lit/lit/TestRunner.py
Original file line number Diff line number Diff line change
Expand Up @@ -1394,10 +1394,12 @@ def getDefaultSubstitutions(test, tmpDir, tmpBase, normalize_slashes=False):
substitutions = []
substitutions.extend(test.config.substitutions)
tmpName = tmpBase + ".tmp"
baseName = os.path.basename(tmpBase)
tmpBaseName = os.path.basename(tmpBase)
sourceBaseName = os.path.basename(sourcepath)

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

substitutions.extend(
[
Expand Down
5 changes: 5 additions & 0 deletions llvm/utils/lit/tests/substitutions.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Basic test for substitutions.
#
# RUN: echo %basename_s | FileCheck %s
#
# CHECK: substitutions.py
Loading