[PATCH] D77818: [lit] Print substitutions with --show-suites

Louis Dionne via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 9 12:48:41 PDT 2020


ldionne updated this revision to Diff 256357.
ldionne marked 6 inline comments as done.
ldionne added a comment.

Address review comments.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D77818/new/

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
@@ -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
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 (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')]
Index: llvm/utils/lit/lit/main.py
===================================================================
--- llvm/utils/lit/lit/main.py
+++ llvm/utils/lit/lit/main.py
@@ -137,9 +137,12 @@
             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 --')


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D77818.256357.patch
Type: text/x-patch
Size: 2829 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200409/f95dd204/attachment.bin>


More information about the llvm-commits mailing list