[llvm] dd3feec - [lit] Print substitutions with --show-suites
Louis Dionne via llvm-commits
llvm-commits at lists.llvm.org
Mon Apr 13 09:01:22 PDT 2020
Author: Louis Dionne
Date: 2020-04-13T12:01:12-04:00
New Revision: dd3feecd7304bf611aa49247383fb78f51a9a6ab
URL: https://github.com/llvm/llvm-project/commit/dd3feecd7304bf611aa49247383fb78f51a9a6ab
DIFF: https://github.com/llvm/llvm-project/commit/dd3feecd7304bf611aa49247383fb78f51a9a6ab.diff
LOG: [lit] Print substitutions with --show-suites
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.
As a fly-by fix, we also always print available features, even when
there are none.
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 [...]
Differential Revision: https://reviews.llvm.org/D77818
Added:
Modified:
llvm/utils/lit/lit/main.py
llvm/utils/lit/tests/Inputs/discovery/lit.cfg
llvm/utils/lit/tests/discovery.py
Removed:
################################################################################
diff --git a/llvm/utils/lit/lit/main.py b/llvm/utils/lit/lit/main.py
index d0ee1fa8a754..25f15107a211 100755
--- a/llvm/utils/lit/lit/main.py
+++ b/llvm/utils/lit/lit/main.py
@@ -139,9 +139,12 @@ def print_discovered(tests, show_suites, show_tests):
print(' %s - %d tests' % (suite.name, test_count))
print(' Source Root: %s' % suite.source_root)
print(' Exec Root : %s' % suite.exec_root)
- if suite.config.available_features:
- features = ' '.join(sorted(suite.config.available_features))
- print(' Available Features : %s' % features)
+ features = ' '.join(sorted(suite.config.available_features))
+ print(' Available Features: %s' % features)
+ substitutions = sorted(suite.config.substitutions)
+ substitutions = ('%s => %s' % (x, y) for (x, y) in substitutions)
+ substitutions = '\n'.ljust(30).join(substitutions)
+ print(' Available Substitutions: %s' % substitutions)
if show_tests:
print('-- Available Tests --')
diff --git a/llvm/utils/lit/tests/Inputs/discovery/lit.cfg b/llvm/utils/lit/tests/Inputs/discovery/lit.cfg
index c48ca0bc0365..f64d905888be 100644
--- a/llvm/utils/lit/tests/Inputs/discovery/lit.cfg
+++ b/llvm/utils/lit/tests/Inputs/discovery/lit.cfg
@@ -12,3 +12,9 @@ config.test_format = lit.formats.ShTest()
# 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 (and in the right order)
+config.available_features = ['feature2', 'feature1']
+
+# Check that substitutions are printed by --show-suites (and in the right order)
+config.substitutions = [('%key2', 'value2'), ('%key1', 'value1')]
diff --git a/llvm/utils/lit/tests/discovery.py b/llvm/utils/lit/tests/discovery.py
index b15468f10159..94b227f33fb3 100644
--- a/llvm/utils/lit/tests/discovery.py
+++ b/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
@@ -150,5 +153,7 @@
# CHECK-ASEXEC-INTREE: exec-discovery-in-tree-suite - 1 tests
# CHECK-ASEXEC-INTREE-NEXT: Source Root: {{.*[/\\]exec-discovery-in-tree$}}
# CHECK-ASEXEC-INTREE-NEXT: Exec Root : {{.*[/\\]exec-discovery-in-tree[/\\]obj$}}
+# CHECK-ASEXEC-INTREE-NEXT: Available Features:
+# CHECK-ASEXEC-INTREE-NEXT: Available Substitutions:
# CHECK-ASEXEC-INTREE-NEXT: -- Available Tests --
# CHECK-ASEXEC-INTREE-NEXT: exec-discovery-in-tree-suite :: test-one
More information about the llvm-commits
mailing list