xref: /netbsd-src/external/apache2/llvm/dist/llvm/utils/lit/tests/shtest-not.py (revision 82d56013d7b633d116a93943de88e08335357a7c)
1# Check the not command
2
3# FIXME: this test depends on order of tests
4# RUN: rm -f %{inputs}/shtest-not/.lit_test_times.txt
5
6# RUN: not %{lit} -j 1 -a -v %{inputs}/shtest-not \
7# RUN: | FileCheck -match-full-lines %s
8#
9# END.
10
11# Make sure not and env commands are included in printed commands.
12
13# CHECK: -- Testing: 17 tests{{.*}}
14
15# CHECK: FAIL: shtest-not :: exclamation-args-nested-none.txt {{.*}}
16# CHECK: $ "!" "!" "!"
17# CHECK: Error: '!' requires a subcommand
18# CHECK: error: command failed with exit status: {{.*}}
19
20# CHECK: FAIL: shtest-not :: exclamation-args-none.txt {{.*}}
21# CHECK: $ "!"
22# CHECK: Error: '!' requires a subcommand
23# CHECK: error: command failed with exit status: {{.*}}
24
25# CHECK: FAIL: shtest-not :: exclamation-calls-external.txt {{.*}}
26
27# CHECK: $ "!" "{{[^"]*}}" "fail.py"
28# CHECK: $ "!" "!" "{{[^"]*}}" "pass.py"
29# CHECK: $ "!" "!" "!" "{{[^"]*}}" "fail.py"
30# CHECK: $ "!" "!" "!" "!" "{{[^"]*}}" "pass.py"
31
32# CHECK: $ "!" "{{[^"]*}}" "pass.py"
33# CHECK: error: command failed with exit status: {{.*}}
34
35# CHECK: FAIL: shtest-not :: not-args-last-is-crash.txt {{.*}}
36# CHECK: $ "not" "--crash"
37# CHECK: Error: 'not' requires a subcommand
38# CHECK: error: command failed with exit status: {{.*}}
39
40# CHECK: FAIL: shtest-not :: not-args-nested-none.txt {{.*}}
41# CHECK: $ "not" "not" "not"
42# CHECK: Error: 'not' requires a subcommand
43# CHECK: error: command failed with exit status: {{.*}}
44
45# CHECK: FAIL: shtest-not :: not-args-none.txt {{.*}}
46# CHECK: $ "not"
47# CHECK: Error: 'not' requires a subcommand
48# CHECK: error: command failed with exit status: {{.*}}
49
50# CHECK: FAIL: shtest-not :: not-calls-cd.txt {{.*}}
51# CHECK: $ "not" "not" "cd" "foobar"
52# CHECK: $ "not" "--crash" "cd" "foobar"
53# CHECK: Error: 'not --crash' cannot call 'cd'
54# CHECK: error: command failed with exit status: {{.*}}
55
56# CHECK: FAIL: shtest-not :: not-calls-colon.txt {{.*}}
57# CHECK: $ "not" "not" ":" "foobar"
58# CHECK: $ "not" "--crash" ":"
59# CHECK: Error: 'not --crash' cannot call ':'
60# CHECK: error: command failed with exit status: {{.*}}
61
62# CHECK: FAIL: shtest-not :: not-calls-diff-with-crash.txt {{.*}}
63# CHECK: $ "not" "--crash" "diff" "-u" {{.*}}
64# CHECK-NOT: "$"
65# CHECK-NOT: {{[Ee]rror}}
66# CHECK: error: command failed with exit status: {{.*}}
67# CHECK-NOT: {{[Ee]rror}}
68# CHECK-NOT: "$"
69
70# CHECK: FAIL: shtest-not :: not-calls-diff.txt {{.*}}
71# CHECK: $ "not" "diff" {{.*}}
72# CHECK: $ "not" "not" "not" "diff" {{.*}}
73# CHECK: $ "not" "not" "not" "not" "not" "diff" {{.*}}
74# CHECK: $ "diff" {{.*}}
75# CHECK: $ "not" "not" "diff" {{.*}}
76# CHECK: $ "not" "not" "not" "not" "diff" {{.*}}
77# CHECK: $ "not" "diff" {{.*}}
78# CHECK-NOT: "$"
79
80# CHECK: FAIL: shtest-not :: not-calls-echo.txt {{.*}}
81# CHECK: $ "not" "not" "echo" "hello" "world"
82# CHECK: $ "not" "--crash" "echo" "hello" "world"
83# CHECK: Error: 'not --crash' cannot call 'echo'
84# CHECK: error: command failed with exit status: {{.*}}
85
86# CHECK: FAIL: shtest-not :: not-calls-env-builtin.txt {{.*}}
87# CHECK: $ "not" "--crash" "env" "-u" "FOO" "BAR=3" "rm" "{{.*}}.no-such-file"
88# CHECK: Error: 'env' cannot call 'rm'
89# CHECK: error: command failed with exit status: {{.*}}
90
91# CHECK: FAIL: shtest-not :: not-calls-export.txt {{.*}}
92# CHECK: $ "not" "not" "export" "FOO=1"
93# CHECK: $ "not" "--crash" "export" "BAZ=3"
94# CHECK: Error: 'not --crash' cannot call 'export'
95# CHECK: error: command failed with exit status: {{.*}}
96
97
98# CHECK: PASS: shtest-not :: not-calls-external.txt {{.*}}
99
100# CHECK: $ "not" "{{[^"]*}}" "fail.py"
101# CHECK: $ "not" "not" "{{[^"]*}}" "pass.py"
102# CHECK: $ "not" "not" "not" "{{[^"]*}}" "fail.py"
103# CHECK: $ "not" "not" "not" "not" "{{[^"]*}}" "pass.py"
104
105# CHECK: $ "not" "not" "--crash" "{{[^"]*}}" "pass.py"
106# CHECK: $ "not" "not" "--crash" "{{[^"]*}}" "fail.py"
107# CHECK: $ "not" "not" "--crash" "not" "{{[^"]*}}" "pass.py"
108# CHECK: $ "not" "not" "--crash" "not" "{{[^"]*}}" "fail.py"
109
110# CHECK: $ "env" "not" "{{[^"]*}}" "fail.py"
111# CHECK: $ "not" "env" "{{[^"]*}}" "fail.py"
112# CHECK: $ "env" "FOO=1" "not" "{{[^"]*}}" "fail.py"
113# CHECK: $ "not" "env" "FOO=1" "BAR=1" "{{[^"]*}}" "fail.py"
114# CHECK: $ "env" "FOO=1" "BAR=1" "not" "env" "-u" "FOO" "BAR=2" "{{[^"]*}}" "fail.py"
115# CHECK: $ "not" "env" "FOO=1" "BAR=1" "not" "env" "-u" "FOO" "-u" "BAR" "{{[^"]*}}" "pass.py"
116# CHECK: $ "not" "not" "env" "FOO=1" "env" "FOO=2" "BAR=1" "{{[^"]*}}" "pass.py"
117# CHECK: $ "env" "FOO=1" "-u" "BAR" "env" "-u" "FOO" "BAR=1" "not" "not" "{{[^"]*}}" "pass.py"
118
119# CHECK: $ "not" "env" "FOO=1" "BAR=1" "env" "FOO=2" "BAR=2" "not" "--crash" "{{[^"]*}}" "pass.py"
120# CHECK: $ "not" "env" "FOO=1" "BAR=1" "not" "--crash" "not" "{{[^"]*}}" "pass.py"
121# CHECK: $ "not" "not" "--crash" "env" "-u" "BAR" "not" "env" "-u" "FOO" "BAR=1" "{{[^"]*}}" "pass.py"
122
123
124# CHECK: FAIL: shtest-not :: not-calls-fail2.txt {{.*}}
125# CHECK-NEXT: {{.*}} TEST 'shtest-not :: not-calls-fail2.txt' FAILED {{.*}}
126# CHECK-NEXT: Script:
127# CHECK-NEXT: --
128# CHECK:      --
129# CHECK-NEXT: Exit Code: 1
130
131# CHECK: FAIL: shtest-not :: not-calls-mkdir.txt {{.*}}
132# CHECK: $ "not" "mkdir" {{.*}}
133# CHECK: $ "not" "--crash" "mkdir" "foobar"
134# CHECK: Error: 'not --crash' cannot call 'mkdir'
135# CHECK: error: command failed with exit status: {{.*}}
136
137# CHECK: FAIL: shtest-not :: not-calls-rm.txt {{.*}}
138# CHECK: $ "not" "rm" {{.*}}
139# CHECK: $ "not" "--crash" "rm" "foobar"
140# CHECK: Error: 'not --crash' cannot call 'rm'
141# CHECK: error: command failed with exit status: {{.*}}
142
143# CHECK: Passed:  1
144# CHECK: Failed: 16
145# CHECK-NOT: {{.}}
146