llvm.org GIT mirror llvm / ac1b2e5
[lit] Add a test for internal shell execution behaviors. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@174102 91177308-0d34-0410-b5e6-96231b3b80d8 Daniel Dunbar 6 years ago
10 changed file(s) with 125 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
0 # Check error on an internal shell error (unable to find command).
1 #
2 # RUN: not-a-real-command
0 # Check error on a shell parsing failure.
1 #
2 # RUN: echo "missing quote
0 # Check error on a unsupported redirect.
1 #
2 # RUN: echo "hello" 3>&1
0 config.name = 'shtest-shell'
1 config.suffixes = ['.txt']
2 config.test_format = lit.formats.ShTest()
3 config.test_source_root = None
4 config.test_exec_root = None
0 # Check stdout redirect (> and >>).
1 #
2 # RUN: echo "not-present" > %t.stdout-write
3 # RUN: echo "is-present" > %t.stdout-write
4 # RUN: FileCheck --check-prefix=STDOUT-WRITE < %t.stdout-write %s
5 #
6 # STDOUT-WRITE-NOT: not-present
7 # STDOUT-WRITE: is-present
8 #
9 # RUN: echo "appended-line" >> %t.stdout-write
10 # RUN: FileCheck --check-prefix=STDOUT-APPEND < %t.stdout-write %s
11 #
12 # STDOUT-APPEND: is-present
13 # STDOUT-APPEND: appended-line
14
15
16 # Check stderr redirect (2> and 2>>).
17 #
18 # RUN: echo "not-present" > %t.stderr-write
19 # RUN: %S/write-to-stderr.sh 2> %t.stderr-write
20 # RUN: FileCheck --check-prefix=STDERR-WRITE < %t.stderr-write %s
21 #
22 # STDERR-WRITE-NOT: not-present
23 # STDERR-WRITE: a line on stderr
24 #
25 # RUN: %S/write-to-stderr.sh 2>> %t.stderr-write
26 # RUN: FileCheck --check-prefix=STDERR-APPEND < %t.stderr-write %s
27 #
28 # STDERR-APPEND: a line on stderr
29 # STDERR-APPEND: a line on stderr
30
31
32 # Check combined redirect (&>).
33 #
34 # RUN: echo "not-present" > %t.combined
35 # RUN: %S/write-to-stdout-and-stderr.sh &> %t.combined
36 # RUN: FileCheck --check-prefix=COMBINED-WRITE < %t.combined %s
37 #
38 # COMBINED-WRITE-NOT: not-present
39 # COMBINED-WRITE: a line on stdout
40 # COMBINED-WRITE: a line on stderr
0 # Check sequencing operations.
1 #
2 # RUN: echo "first-line" > %t.out && echo "second-line" >> %t.out
3 # RUN: FileCheck --check-prefix CHECK-AND < %t.out %s
4 #
5 # CHECK-AND: first-line
6 # CHECK-AND: second-line
7 #
8 # The false case of && is tested in sequencing-2.txt
9
10
11 # RUN: echo "first-line" > %t.out || echo "second-line" >> %t.out
12 # RUN: FileCheck --check-prefix CHECK-OR-1 < %t.out %s
13 #
14 # CHECK-OR-1: first-line
15 # CHECK-OR-1-NOT: second-line
16
17 # RUN: false || echo "second-line" > %t.out
18 # RUN: FileCheck --check-prefix CHECK-OR-2 < %t.out %s
19 #
20 # CHECK-OR-2: second-line
21
22
23 # RUN: echo "first-line" > %t.out; echo "second-line" >> %t.out
24 # RUN: FileCheck --check-prefix CHECK-SEQ < %t.out %s
25 #
26 # CHECK-SEQ: first-line
27 # CHECK-SEQ: second-line
0 #!/bin/sh
1
2 echo "a line on stderr" 1>&2
0 #!/bin/sh
1
2 echo "a line on stdout"
3 echo "a line on stderr" 1>&2
0 # Check the internal shell handling component of the ShTest format.
1 #
2 # RUN: not %{lit} -j 1 -v %{inputs}/shtest-shell > %t.out
3 # RUN: FileCheck < %t.out %s
4 #
5 # END.
6
7 # CHECK: -- Testing:
8
9 # CHECK: FAIL: shtest-shell :: error-0.txt
10 # CHECK: *** TEST 'shtest-shell :: error-0.txt' FAILED ***
11 # CHECK: Command 0: "not-a-real-command"
12 # CHECK: Command 0 Result: 127
13 # CHECK: Command 0 Stderr:
14 # CHECK: 'not-a-real-command': command not found
15 # CHECK: ***
16
17 # FIXME: The output here sucks.
18 #
19 # CHECK: FAIL: shtest-shell :: error-1.txt
20 # CHECK: *** TEST 'shtest-shell :: error-1.txt' FAILED ***
21 # CHECK: shell parser error on: 'echo "missing quote'
22 # CHECK: ***
23
24 # CHECK: FAIL: shtest-shell :: error-2.txt
25 # CHECK: *** TEST 'shtest-shell :: error-2.txt' FAILED ***
26 # CHECK: Unsupported redirect:
27 # CHECK: ***
28
29 # CHECK: PASS: shtest-shell :: redirects.txt
30 # CHECK: PASS: shtest-shell :: sequencing-0.txt
31 # CHECK: XFAIL: shtest-shell :: sequencing-1.txt
32 # CHECK: Failing Tests (3)