llvm.org GIT mirror llvm / 80a06ba
[lit] Ensure test output is converted to strings where possible. - This cleans up the text output of failing tests when run under PY3. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@188416 91177308-0d34-0410-b5e6-96231b3b80d8 Daniel Dunbar 6 years ago
7 changed file(s) with 63 addition(s) and 4 deletion(s). Raw diff Collapse all Expand all
197197 if res == -signal.SIGINT:
198198 raise KeyboardInterrupt
199199
200 # Ensure the resulting output is always of string type.
201 try:
202 out = str(out.decode('ascii'))
203 except:
204 out = str(out)
205 try:
206 err = str(err.decode('ascii'))
207 except:
208 err = str(err)
209
200210 results.append((cmd.commands[i], out, err, res))
201211 if cmd.pipe_err:
202212 # Python treats the exit code as a signed char.
155155 if exitCode == -signal.SIGINT:
156156 raise KeyboardInterrupt
157157
158 # Ensure the resulting output is always of string type.
159 try:
160 out = str(out.decode('ascii'))
161 except:
162 out = str(out)
163 try:
164 err = str(err.decode('ascii'))
165 except:
166 err = str(err)
167
158168 return out, err, exitCode
0 # Run a command that fails with error on stdout.
11 #
2 # RUN: echo "line 1: failed test output on stdout"
3 # RUN: echo "line 2: failed test output on stdout"
24 # RUN: cat "does-not-exist"
0 # Run a command that fails with error on stdout.
1 #
2 # RUN: %S/write-bad-encoding.sh
3 # RUN: false
4
0 #!/bin/sh
1
2 echo "a line with bad encoding: Â."
0 # RUN: printf "line 1: failed test output on stdout\nline 2: failed test output on stdout"
1 # RUN: false
77 # CHECK: -- Testing:
88
99 # CHECK: FAIL: shtest-format :: external_shell/fail.txt
10 # CHECK: *** TEST 'shtest-format :: external_shell/fail.txt' FAILED ***
10 # CHECK-NEXT: *** TEST 'shtest-format :: external_shell/fail.txt' FAILED ***
11 # CHECK: Command Output (stdout):
12 # CHECK-NEXT: --
13 # CHECK-NEXT: line 1: failed test output on stdout
14 # CHECK-NEXT: line 2: failed test output on stdout
1115 # CHECK: Command Output (stderr):
12 # CHECK: cat: does-not-exist: No such file or directory
16 # CHECK-NEXT: --
17 # CHECK-NEXT: cat: does-not-exist: No such file or directory
18 # CHECK: --
19
20 # CHECK: FAIL: shtest-format :: external_shell/fail_with_bad_encoding.txt
21 # CHECK-NEXT: *** TEST 'shtest-format :: external_shell/fail_with_bad_encoding.txt' FAILED ***
22 # CHECK: Command Output (stdout):
23 # CHECK-NEXT: --
24 # CHECK-NEXT: a line with bad encoding:
1325 # CHECK: --
1426
1527 # CHECK: PASS: shtest-format :: external_shell/pass.txt
1628
1729 # CHECK: FAIL: shtest-format :: fail.txt
30 # CHECK-NEXT: *** TEST 'shtest-format :: fail.txt' FAILED ***
31 # CHECK-NEXT: Script:
32 # CHECK-NEXT: --
33 # CHECK-NEXT: printf "line 1
34 # CHECK-NEXT: false
35 # CHECK-NEXT: --
36 # CHECK-NEXT: Exit Code: 1
37 #
38 # CHECK: Command Output (stdout):
39 # CHECK-NEXT: --
40 # CHECK-NEXT: Command 0: "printf"
41 # CHECK-NEXT: Command 0 Result: 0
42 # CHECK-NEXT: Command 0 Output:
43 # CHECK-NEXT: line 1: failed test output on stdout
44 # CHECK-NEXT: line 2: failed test output on stdout
1845
1946 # CHECK: UNRESOLVED: shtest-format :: no-test-line.txt
2047 # CHECK: PASS: shtest-format :: pass.txt
3057 # CHECK: Unexpected Passing Tests (1)
3158 # CHECK: shtest-format :: xpass.txt
3259
33 # CHECK: Failing Tests (2)
60 # CHECK: Failing Tests (3)
3461 # CHECK: shtest-format :: external_shell/fail.txt
62 # CHECK: shtest-format :: external_shell/fail_with_bad_encoding.txt
3563 # CHECK: shtest-format :: fail.txt
3664
3765 # CHECK: Expected Passes : 3
3967 # CHECK: Unsupported Tests : 2
4068 # CHECK: Unresolved Tests : 1
4169 # CHECK: Unexpected Passes : 1
42 # CHECK: Unexpected Failures: 2
70 # CHECK: Unexpected Failures: 3