diff --git a/llvm/utils/lit/lit/main.py b/llvm/utils/lit/lit/main.py --- a/llvm/utils/lit/lit/main.py +++ b/llvm/utils/lit/lit/main.py @@ -139,9 +139,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 --') diff --git a/llvm/utils/lit/tests/Inputs/discovery/lit.cfg b/llvm/utils/lit/tests/Inputs/discovery/lit.cfg --- a/llvm/utils/lit/tests/Inputs/discovery/lit.cfg +++ b/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')] diff --git a/llvm/utils/lit/tests/discovery.py b/llvm/utils/lit/tests/discovery.py --- 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