Index: llvm/trunk/docs/CommandGuide/lit.rst =================================================================== --- llvm/trunk/docs/CommandGuide/lit.rst +++ llvm/trunk/docs/CommandGuide/lit.rst @@ -80,6 +80,13 @@ Show more information on test failures, for example the entire test output instead of just the test result. +.. option:: -vv, --echo-all-commands + + Echo all commands to stdout, as they are being executed. + This can be valuable for debugging test failures, as the last echoed command + will be the one which has failed. + This option implies ``--verbose``. + .. option:: -a, --show-all Show more information about all tests, for example the entire test Index: llvm/trunk/utils/lit/lit/LitConfig.py =================================================================== --- llvm/trunk/utils/lit/lit/LitConfig.py +++ llvm/trunk/utils/lit/lit/LitConfig.py @@ -25,7 +25,8 @@ params, config_prefix = None, maxIndividualTestTime = 0, maxFailures = None, - parallelism_groups = []): + parallelism_groups = [], + echo_all_commands = False): # The name of the test runner. self.progname = progname # The items to add to the PATH environment variable. @@ -64,6 +65,7 @@ self.maxIndividualTestTime = maxIndividualTestTime self.maxFailures = maxFailures self.parallelism_groups = parallelism_groups + self.echo_all_commands = echo_all_commands @property def maxIndividualTestTime(self): Index: llvm/trunk/utils/lit/lit/TestRunner.py =================================================================== --- llvm/trunk/utils/lit/lit/TestRunner.py +++ llvm/trunk/utils/lit/lit/TestRunner.py @@ -715,6 +715,8 @@ else: if test.config.pipefail: f.write('set -o pipefail;') + if litConfig.echo_all_commands: + f.write('set -x;') f.write('{ ' + '; } &&\n{ '.join(commands) + '; }') f.write('\n') f.close() Index: llvm/trunk/utils/lit/lit/main.py =================================================================== --- llvm/trunk/utils/lit/lit/main.py +++ llvm/trunk/utils/lit/lit/main.py @@ -199,6 +199,12 @@ format_group.add_argument("-v", "--verbose", dest="showOutput", help="Show test output for failures", action="store_true", default=False) + format_group.add_argument("-vv", "--echo-all-commands", + dest="echoAllCommands", + action="store_true", default=False, + help="Echo all commands as they are executed to stdout.\ + In case of failure, last command shown will be the\ + failing one.") format_group.add_argument("-a", "--show-all", dest="showAllOutput", help="Display all commandlines and output", action="store_true", default=False) @@ -303,6 +309,9 @@ if opts.maxFailures == 0: parser.error("Setting --max-failures to 0 does not have any effect.") + if opts.echoAllCommands: + opts.showOutput = True + inputs = args # Create the user defined parameters. @@ -338,7 +347,8 @@ config_prefix = opts.configPrefix, maxIndividualTestTime = maxIndividualTestTime, maxFailures = opts.maxFailures, - parallelism_groups = {}) + parallelism_groups = {}, + echo_all_commands = opts.echoAllCommands) # Perform test discovery. run = lit.run.Run(litConfig,