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 @@ -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 --') 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 +config.available_features = ['feature1', 'feature2'] + +# Check that substitutions are printed by --show-suites +config.substitutions = [('%key1', 'value1'), ('%key2', 'value2')] 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