[PATCH] D82814: [lit] Replace echo_all_commands with run_with_command_output.

Varun Gandhi via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 29 15:18:24 PDT 2020


varungandhi-apple created this revision.
varungandhi-apple added a reviewer: yln.
Herald added subscribers: llvm-commits, delcypher.
Herald added a project: LLVM.

Rename LitConfig's internal field name for clarity.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D82814

Files:
  llvm/utils/lit/lit/LitConfig.py
  llvm/utils/lit/lit/TestRunner.py
  llvm/utils/lit/lit/cl_arguments.py
  llvm/utils/lit/lit/main.py


Index: llvm/utils/lit/lit/main.py
===================================================================
--- llvm/utils/lit/lit/main.py
+++ llvm/utils/lit/lit/main.py
@@ -37,7 +37,6 @@
         isWindows=is_windows,
         params=params,
         config_prefix=opts.configPrefix,
-        echo_all_commands=opts.echo_all_commands,
         script_output_style=opts.script_output_style,
         command_output_style=opts.command_output_style)
 
Index: llvm/utils/lit/lit/cl_arguments.py
===================================================================
--- llvm/utils/lit/lit/cl_arguments.py
+++ llvm/utils/lit/lit/cl_arguments.py
@@ -175,7 +175,6 @@
     opts.show_output_on_failure = True
     opts.script_output_style = OutputSettings.NO_SCRIPT
     opts.command_output_style = OutputSettings.ONLY_FAILING_COMMAND
-    opts.echo_all_commands = True
 
     if opts.quiet:
         opts.show_output_on_failure = False
@@ -186,14 +185,6 @@
             OutputSettings.UP_TO_AND_INCLUDING_FAILING_COMMAND
         )
 
-    # If we call out to an external shell, we ask for all output,
-    # regardless of whether we're going to display all commands that were run,
-    # or only the last command which failed.
-    cmd_output_style = opts.command_output_style
-    opts.echo_all_commands = (
-        cmd_output_style == OutputSettings.UP_TO_AND_INCLUDING_FAILING_COMMAND
-        or cmd_output_style == OutputSettings.ONLY_FAILING_COMMAND)
-
     # TODO(python3): Could be enum
     if opts.shuffle:
         opts.order = 'random'
Index: llvm/utils/lit/lit/TestRunner.py
===================================================================
--- llvm/utils/lit/lit/TestRunner.py
+++ llvm/utils/lit/lit/TestRunner.py
@@ -961,7 +961,7 @@
     if isWin32CMDEXE:
         for i, ln in enumerate(commands):
             commands[i] = re.sub(kPdbgRegex, "echo '\\1' > nul && ", ln)
-        if litConfig.echo_all_commands:
+        if litConfig.run_with_command_output:
             f.write('@echo on\n')
         else:
             f.write('@echo off\n')
@@ -971,7 +971,7 @@
             commands[i] = re.sub(kPdbgRegex, ": '\\1'; ", ln)
         if test.config.pipefail:
             f.write(b'set -o pipefail;' if mode == 'wb' else 'set -o pipefail;')
-        if litConfig.echo_all_commands:
+        if litConfig.run_with_command_output:
             f.write(b'set -x;' if mode == 'wb' else 'set -x;')
         if sys.version_info > (3,0) and mode == 'wb':
             f.write(bytes('{ ' + '; } &&\n{ '.join(commands) + '; }', 'utf-8'))
Index: llvm/utils/lit/lit/LitConfig.py
===================================================================
--- llvm/utils/lit/lit/LitConfig.py
+++ llvm/utils/lit/lit/LitConfig.py
@@ -27,7 +27,6 @@
                  params, config_prefix = None,
                  maxIndividualTestTime = 0,
                  parallelism_groups = {},
-                 echo_all_commands=False,
                  script_output_style=OutputSettings.NO_SCRIPT,
                  command_output_style=OutputSettings.ONLY_FAILING_COMMAND):
         # The name of the test runner.
@@ -68,7 +67,13 @@
 
         self.maxIndividualTestTime = maxIndividualTestTime
         self.parallelism_groups = parallelism_groups
-        self.echo_all_commands = echo_all_commands
+        # If we call out to an external shell, we ask for all output,
+        # regardless of whether we're going to display all commands that were
+        # run, or only the last command which failed.
+        self.run_with_command_output = (
+            (command_output_style
+             == OutputSettings.UP_TO_AND_INCLUDING_FAILING_COMMAND)
+            or command_output_style == OutputSettings.ONLY_FAILING_COMMAND)
         self.script_output_style = script_output_style
         self.command_output_style = command_output_style
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D82814.274254.patch
Type: text/x-patch
Size: 3824 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200629/d4b4665f/attachment.bin>


More information about the llvm-commits mailing list