[PATCH] D77818: [lit] Print substitutions with --show-suites
Louis Dionne via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Apr 9 11:42:20 PDT 2020
ldionne created this revision.
ldionne added reviewers: yln, rnk, jdenny, delcypher.
Herald added subscribers: llvm-commits, dexonsmith, jkorous.
Herald added a project: LLVM.
We already print available features, and it can be useful to print
substitutions as well since those are a pretty fundamental part of
a test suite. We could also consider printing other things like the
test environment, however the need doesn't appear to be as strong.
Before:
$ lit -sv libcxx/test --show-suites
-- Test Suites --
libc++ - 6350 tests
Source Root: [...]
Exec Root : [...]
Available Features : -faligned-allocation -fsized-deallocation [...]
After:
$ lit -sv libcxx/test --show-suites
-- Test Suites --
libc++ - 6350 tests
Source Root: [...]
Exec Root : [...]
Available Features : -faligned-allocation -fsized-deallocation [...]
Available Substitutions : %{build_module} => [...]
%{build} => %{cxx} -o [...]
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D77818
Files:
llvm/utils/lit/lit/main.py
llvm/utils/lit/tests/Inputs/discovery/lit.cfg
llvm/utils/lit/tests/discovery.py
Index: llvm/utils/lit/tests/discovery.py
===================================================================
--- llvm/utils/lit/tests/discovery.py
+++ llvm/utils/lit/tests/discovery.py
@@ -17,6 +17,9 @@
# CHECK-BASIC-OUT: top-level-suite - 3 tests
# CHECK-BASIC-OUT: Source Root: {{.*[/\\]discovery$}}
# CHECK-BASIC-OUT: Exec Root : {{.*[/\\]discovery$}}
+# CHECK-BASIC-OUT: Available Features : feature1 feature2
+# CHECK-BASIC-OUT: Available Substitutions : %key1 => value1
+# CHECK-BASIC-OUT: %key2 => value2
#
# CHECK-BASIC-OUT: -- Available Tests --
# CHECK-BASIC-OUT: sub-suite :: test-one
Index: llvm/utils/lit/tests/Inputs/discovery/lit.cfg
===================================================================
--- llvm/utils/lit/tests/Inputs/discovery/lit.cfg
+++ llvm/utils/lit/tests/Inputs/discovery/lit.cfg
@@ -12,3 +12,9 @@
# Check that arbitrary config values are copied (tested by subdir/lit.local.cfg).
config.an_extra_variable = False
+
+# Check that available_features are printed by --show-suites
+config.available_features = ['feature1', 'feature2']
+
+# Check that substitutions are printed by --show-suites
+config.substitutions = [('%key1', 'value1'), ('%key2', 'value2')]
Index: llvm/utils/lit/lit/main.py
===================================================================
--- llvm/utils/lit/lit/main.py
+++ llvm/utils/lit/lit/main.py
@@ -140,6 +140,12 @@
if suite.config.available_features:
features = ' '.join(sorted(suite.config.available_features))
print(' Available Features : %s' % features)
+ if suite.config.substitutions:
+ first = lambda (x, y): x
+ substitutions = sorted(suite.config.substitutions, key=first)
+ substitutions = ('%s => %s' % (x, y) for (x, y) in substitutions)
+ substitutions = '\n '.join(substitutions)
+ print(' Available Substitutions : %s' % substitutions)
if show_tests:
print('-- Available Tests --')
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D77818.256345.patch
Type: text/x-patch
Size: 2103 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200409/fd418da8/attachment.bin>
More information about the llvm-commits
mailing list