Эх сурвалжийг харах

[lit] Terminate ": RUN at line N" with ";" not "&&"

This fixes projects/compiler-rt/test/fuzzer/sigusr.test, which was
broken by r333614.  The trouble was that "&&" changes the command for
which "$!" gives the pid.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@333620 91177308-0d34-0410-b5e6-96231b3b80d8
Joel E. Denny 7 жил өмнө
parent
commit
1d4f2158ac

+ 4 - 4
utils/lit/lit/TestRunner.py

@@ -1001,7 +1001,7 @@ def _executeShCmd(cmd, shenv, results, timeoutHelper):
 def executeScriptInternal(test, litConfig, tmpBase, commands, cwd):
 def executeScriptInternal(test, litConfig, tmpBase, commands, cwd):
     cmds = []
     cmds = []
     for i, ln in enumerate(commands):
     for i, ln in enumerate(commands):
-        ln = commands[i] = re.sub(kPdbgRegex, ": '\\1'", ln)
+        ln = commands[i] = re.sub(kPdbgRegex, ": '\\1'; ", ln)
         try:
         try:
             cmds.append(ShUtil.ShParser(ln, litConfig.isWindows,
             cmds.append(ShUtil.ShParser(ln, litConfig.isWindows,
                                         test.config.pipefail).parse())
                                         test.config.pipefail).parse())
@@ -1086,7 +1086,7 @@ def executeScript(test, litConfig, tmpBase, commands, cwd):
     f = open(script, mode)
     f = open(script, mode)
     if isWin32CMDEXE:
     if isWin32CMDEXE:
         for i, ln in enumerate(commands):
         for i, ln in enumerate(commands):
-            commands[i] = re.sub(kPdbgRegex, "echo '\\1' > nul", ln)
+            commands[i] = re.sub(kPdbgRegex, "echo '\\1' > nul && ", ln)
         if litConfig.echo_all_commands:
         if litConfig.echo_all_commands:
             f.write('@echo on\n')
             f.write('@echo on\n')
         else:
         else:
@@ -1094,7 +1094,7 @@ def executeScript(test, litConfig, tmpBase, commands, cwd):
         f.write('\n@if %ERRORLEVEL% NEQ 0 EXIT\n'.join(commands))
         f.write('\n@if %ERRORLEVEL% NEQ 0 EXIT\n'.join(commands))
     else:
     else:
         for i, ln in enumerate(commands):
         for i, ln in enumerate(commands):
-            commands[i] = re.sub(kPdbgRegex, ": '\\1'", ln)
+            commands[i] = re.sub(kPdbgRegex, ": '\\1'; ", ln)
         if test.config.pipefail:
         if test.config.pipefail:
             f.write('set -o pipefail;')
             f.write('set -o pipefail;')
         if litConfig.echo_all_commands:
         if litConfig.echo_all_commands:
@@ -1384,7 +1384,7 @@ class IntegratedTestKeywordParser(object):
                 line_number=line_number)
                 line_number=line_number)
             assert re.match(kPdbgRegex + "$", pdbg), \
             assert re.match(kPdbgRegex + "$", pdbg), \
                    "kPdbgRegex expected to match actual %dbg usage"
                    "kPdbgRegex expected to match actual %dbg usage"
-            line = "{pdbg} && {real_command}".format(
+            line = "{pdbg} {real_command}".format(
                 pdbg=pdbg,
                 pdbg=pdbg,
                 real_command=line)
                 real_command=line)
             output.append(line)
             output.append(line)

+ 13 - 13
utils/lit/tests/shtest-run-at-line.py

@@ -16,9 +16,9 @@
 # CHECK-LABEL: FAIL: shtest-run-at-line :: external-shell/basic.txt
 # CHECK-LABEL: FAIL: shtest-run-at-line :: external-shell/basic.txt
 
 
 # CHECK:      Script:
 # CHECK:      Script:
-# CHECK:      [[pdbg0]]RUN: at line 4[[pdbg1]] &&  true
-# CHECK-NEXT: [[pdbg0]]RUN: at line 5[[pdbg1]] &&  false
-# CHECK-NEXT: [[pdbg0]]RUN: at line 6[[pdbg1]] &&  true
+# CHECK:      [[pdbg0]]RUN: at line 4[[pdbg1]];  true
+# CHECK-NEXT: [[pdbg0]]RUN: at line 5[[pdbg1]];  false
+# CHECK-NEXT: [[pdbg0]]RUN: at line 6[[pdbg1]];  true
 
 
 # CHECK:     RUN: at line 4
 # CHECK:     RUN: at line 4
 # CHECK:     RUN: at line 5
 # CHECK:     RUN: at line 5
@@ -27,9 +27,9 @@
 # CHECK-LABEL: FAIL: shtest-run-at-line :: external-shell/line-continuation.txt
 # CHECK-LABEL: FAIL: shtest-run-at-line :: external-shell/line-continuation.txt
 
 
 # CHECK:      Script:
 # CHECK:      Script:
-# CHECK:      [[pdbg0]]RUN: at line 4[[pdbg1]] &&  echo 'foo bar'  | FileCheck
-# CHECK-NEXT: [[pdbg0]]RUN: at line 6[[pdbg1]] &&  echo  'foo baz'  | FileCheck
-# CHECK-NEXT: [[pdbg0]]RUN: at line 9[[pdbg1]] &&  echo 'foo bar'  | FileCheck
+# CHECK:      [[pdbg0]]RUN: at line 4[[pdbg1]];  echo 'foo bar'  | FileCheck
+# CHECK-NEXT: [[pdbg0]]RUN: at line 6[[pdbg1]];  echo  'foo baz'  | FileCheck
+# CHECK-NEXT: [[pdbg0]]RUN: at line 9[[pdbg1]];  echo 'foo bar'  | FileCheck
 
 
 # CHECK:     RUN: at line 4
 # CHECK:     RUN: at line 4
 # CHECK:     RUN: at line 6
 # CHECK:     RUN: at line 6
@@ -39,9 +39,9 @@
 # CHECK-LABEL: FAIL: shtest-run-at-line :: internal-shell/basic.txt
 # CHECK-LABEL: FAIL: shtest-run-at-line :: internal-shell/basic.txt
 
 
 # CHECK:      Script:
 # CHECK:      Script:
-# CHECK:      : 'RUN: at line 1' &&  true
-# CHECK-NEXT: : 'RUN: at line 2' &&  false
-# CHECK-NEXT: : 'RUN: at line 3' &&  true
+# CHECK:      : 'RUN: at line 1';  true
+# CHECK-NEXT: : 'RUN: at line 2';  false
+# CHECK-NEXT: : 'RUN: at line 3';  true
 
 
 # CHECK:      Command Output (stdout)
 # CHECK:      Command Output (stdout)
 # CHECK:      $ ":" "RUN: at line 1"
 # CHECK:      $ ":" "RUN: at line 1"
@@ -53,10 +53,10 @@
 # CHECK-LABEL: FAIL: shtest-run-at-line :: internal-shell/line-continuation.txt
 # CHECK-LABEL: FAIL: shtest-run-at-line :: internal-shell/line-continuation.txt
 
 
 # CHECK:      Script:
 # CHECK:      Script:
-# CHECK:      : 'RUN: at line 1' &&  : first line continued to second line
-# CHECK-NEXT: : 'RUN: at line 3' &&  echo 'foo bar'  | FileCheck
-# CHECK-NEXT: : 'RUN: at line 5' &&  echo  'foo baz'  | FileCheck
-# CHECK-NEXT: : 'RUN: at line 8' &&  echo 'foo bar'  | FileCheck
+# CHECK:      : 'RUN: at line 1';  : first line continued to second line
+# CHECK-NEXT: : 'RUN: at line 3';  echo 'foo bar'  | FileCheck
+# CHECK-NEXT: : 'RUN: at line 5';  echo  'foo baz'  | FileCheck
+# CHECK-NEXT: : 'RUN: at line 8';  echo 'foo bar'  | FileCheck
 
 
 # CHECK:      Command Output (stdout)
 # CHECK:      Command Output (stdout)
 # CHECK:      $ ":" "RUN: at line 1"
 # CHECK:      $ ":" "RUN: at line 1"

+ 1 - 1
utils/lit/tests/shtest-shell.py

@@ -161,7 +161,7 @@
 #
 #
 # CHECK: FAIL: shtest-shell :: error-1.txt
 # CHECK: FAIL: shtest-shell :: error-1.txt
 # CHECK: *** TEST 'shtest-shell :: error-1.txt' FAILED ***
 # CHECK: *** TEST 'shtest-shell :: error-1.txt' FAILED ***
-# CHECK: shell parser error on: ': \'RUN: at line 3\' && echo "missing quote'
+# CHECK: shell parser error on: ': \'RUN: at line 3\'; echo "missing quote'
 # CHECK: ***
 # CHECK: ***
 
 
 # CHECK: FAIL: shtest-shell :: error-2.txt
 # CHECK: FAIL: shtest-shell :: error-2.txt

+ 2 - 2
utils/lit/tests/unit/TestRunner.py

@@ -99,8 +99,8 @@ class TestIntegratedTestKeywordParser(unittest.TestCase):
         cmd_parser = self.get_parser(parsers, 'MY_RUN:')
         cmd_parser = self.get_parser(parsers, 'MY_RUN:')
         value = cmd_parser.getValue()
         value = cmd_parser.getValue()
         self.assertEqual(len(value), 2)  # there are only two run lines
         self.assertEqual(len(value), 2)  # there are only two run lines
-        self.assertEqual(value[0].strip(), "%dbg(MY_RUN: at line 4) &&  baz")
-        self.assertEqual(value[1].strip(), "%dbg(MY_RUN: at line 7) &&  foo  bar")
+        self.assertEqual(value[0].strip(), "%dbg(MY_RUN: at line 4)  baz")
+        self.assertEqual(value[1].strip(), "%dbg(MY_RUN: at line 7)  foo  bar")
 
 
     def test_custom(self):
     def test_custom(self):
         parsers = self.make_parsers()
         parsers = self.make_parsers()