llvm.org GIT mirror llvm / 1d4f215
[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 1 year, 4 months ago
4 changed file(s) with 20 addition(s) and 20 deletion(s). Raw diff Collapse all Expand all
10001000 def executeScriptInternal(test, litConfig, tmpBase, commands, cwd):
10011001 cmds = []
10021002 for i, ln in enumerate(commands):
1003 ln = commands[i] = re.sub(kPdbgRegex, ": '\\1'", ln)
1003 ln = commands[i] = re.sub(kPdbgRegex, ": '\\1'; ", ln)
10041004 try:
10051005 cmds.append(ShUtil.ShParser(ln, litConfig.isWindows,
10061006 test.config.pipefail).parse())
10851085 f = open(script, mode)
10861086 if isWin32CMDEXE:
10871087 for i, ln in enumerate(commands):
1088 commands[i] = re.sub(kPdbgRegex, "echo '\\1' > nul", ln)
1088 commands[i] = re.sub(kPdbgRegex, "echo '\\1' > nul && ", ln)
10891089 if litConfig.echo_all_commands:
10901090 f.write('@echo on\n')
10911091 else:
10931093 f.write('\n@if %ERRORLEVEL% NEQ 0 EXIT\n'.join(commands))
10941094 else:
10951095 for i, ln in enumerate(commands):
1096 commands[i] = re.sub(kPdbgRegex, ": '\\1'", ln)
1096 commands[i] = re.sub(kPdbgRegex, ": '\\1'; ", ln)
10971097 if test.config.pipefail:
10981098 f.write('set -o pipefail;')
10991099 if litConfig.echo_all_commands:
13831383 line_number=line_number)
13841384 assert re.match(kPdbgRegex + "$", pdbg), \
13851385 "kPdbgRegex expected to match actual %dbg usage"
1386 line = "{pdbg} && {real_command}".format(
1386 line = "{pdbg} {real_command}".format(
13871387 pdbg=pdbg,
13881388 real_command=line)
13891389 output.append(line)
1515 # CHECK-LABEL: FAIL: shtest-run-at-line :: external-shell/basic.txt
1616
1717 # CHECK: Script:
18 # CHECK: [[pdbg0]]RUN: at line 4[[pdbg1]] && true
19 # CHECK-NEXT: [[pdbg0]]RUN: at line 5[[pdbg1]] && false
20 # CHECK-NEXT: [[pdbg0]]RUN: at line 6[[pdbg1]] && true
18 # CHECK: [[pdbg0]]RUN: at line 4[[pdbg1]]; true
19 # CHECK-NEXT: [[pdbg0]]RUN: at line 5[[pdbg1]]; false
20 # CHECK-NEXT: [[pdbg0]]RUN: at line 6[[pdbg1]]; true
2121
2222 # CHECK: RUN: at line 4
2323 # CHECK: RUN: at line 5
2626 # CHECK-LABEL: FAIL: shtest-run-at-line :: external-shell/line-continuation.txt
2727
2828 # CHECK: Script:
29 # CHECK: [[pdbg0]]RUN: at line 4[[pdbg1]] && echo 'foo bar' | FileCheck
30 # CHECK-NEXT: [[pdbg0]]RUN: at line 6[[pdbg1]] && echo 'foo baz' | FileCheck
31 # CHECK-NEXT: [[pdbg0]]RUN: at line 9[[pdbg1]] && echo 'foo bar' | FileCheck
29 # CHECK: [[pdbg0]]RUN: at line 4[[pdbg1]]; echo 'foo bar' | FileCheck
30 # CHECK-NEXT: [[pdbg0]]RUN: at line 6[[pdbg1]]; echo 'foo baz' | FileCheck
31 # CHECK-NEXT: [[pdbg0]]RUN: at line 9[[pdbg1]]; echo 'foo bar' | FileCheck
3232
3333 # CHECK: RUN: at line 4
3434 # CHECK: RUN: at line 6
3838 # CHECK-LABEL: FAIL: shtest-run-at-line :: internal-shell/basic.txt
3939
4040 # CHECK: Script:
41 # CHECK: : 'RUN: at line 1' && true
42 # CHECK-NEXT: : 'RUN: at line 2' && false
43 # CHECK-NEXT: : 'RUN: at line 3' && true
41 # CHECK: : 'RUN: at line 1'; true
42 # CHECK-NEXT: : 'RUN: at line 2'; false
43 # CHECK-NEXT: : 'RUN: at line 3'; true
4444
4545 # CHECK: Command Output (stdout)
4646 # CHECK: $ ":" "RUN: at line 1"
5252 # CHECK-LABEL: FAIL: shtest-run-at-line :: internal-shell/line-continuation.txt
5353
5454 # CHECK: Script:
55 # CHECK: : 'RUN: at line 1' && : first line continued to second line
56 # CHECK-NEXT: : 'RUN: at line 3' && echo 'foo bar' | FileCheck
57 # CHECK-NEXT: : 'RUN: at line 5' && echo 'foo baz' | FileCheck
58 # CHECK-NEXT: : 'RUN: at line 8' && echo 'foo bar' | FileCheck
55 # CHECK: : 'RUN: at line 1'; : first line continued to second line
56 # CHECK-NEXT: : 'RUN: at line 3'; echo 'foo bar' | FileCheck
57 # CHECK-NEXT: : 'RUN: at line 5'; echo 'foo baz' | FileCheck
58 # CHECK-NEXT: : 'RUN: at line 8'; echo 'foo bar' | FileCheck
5959
6060 # CHECK: Command Output (stdout)
6161 # CHECK: $ ":" "RUN: at line 1"
160160 #
161161 # CHECK: FAIL: shtest-shell :: error-1.txt
162162 # CHECK: *** TEST 'shtest-shell :: error-1.txt' FAILED ***
163 # CHECK: shell parser error on: ': \'RUN: at line 3\' && echo "missing quote'
163 # CHECK: shell parser error on: ': \'RUN: at line 3\'; echo "missing quote'
164164 # CHECK: ***
165165
166166 # CHECK: FAIL: shtest-shell :: error-2.txt
9898 cmd_parser = self.get_parser(parsers, 'MY_RUN:')
9999 value = cmd_parser.getValue()
100100 self.assertEqual(len(value), 2) # there are only two run lines
101 self.assertEqual(value[0].strip(), "%dbg(MY_RUN: at line 4) && baz")
102 self.assertEqual(value[1].strip(), "%dbg(MY_RUN: at line 7) && foo bar")
101 self.assertEqual(value[0].strip(), "%dbg(MY_RUN: at line 4) baz")
102 self.assertEqual(value[1].strip(), "%dbg(MY_RUN: at line 7) foo bar")
103103
104104 def test_custom(self):
105105 parsers = self.make_parsers()