xref: /llvm-project/llvm/utils/lit/tests/shtest-not.py (revision 0b7ae41b23fc05c2ac3afc8566b8a923d7f76c45)
1# Check the not command
2
3# RUN: not %{lit} -a -v %{inputs}/shtest-not \
4# RUN: | FileCheck -match-full-lines %s
5#
6# END.
7
8# Make sure not and env commands are included in printed commands.
9
10# CHECK: -- Testing: 17 tests{{.*}}
11
12# CHECK: FAIL: shtest-not :: exclamation-args-nested-none.txt {{.*}}
13# CHECK: ! ! !
14# CHECK: # executed command: ! ! !
15# CHECK: # | Error: '!' requires a subcommand
16# CHECK: # error: command failed with exit status: {{.*}}
17
18# CHECK: FAIL: shtest-not :: exclamation-args-none.txt {{.*}}
19# CHECK: !
20# CHECK: # executed command: !
21# CHECK: # | Error: '!' requires a subcommand
22# CHECK: # error: command failed with exit status: {{.*}}
23
24# CHECK: FAIL: shtest-not :: exclamation-calls-external.txt {{.*}}
25
26# CHECK: ! [[PYTHON:.*]] fail.py
27# CHECK: # executed command: ! [[PYTHON_BARE:.*]] fail.py
28# CHECK: ! ! [[PYTHON]] pass.py
29# CHECK: # executed command: ! ! [[PYTHON_BARE]] pass.py
30# CHECK: ! ! ! [[PYTHON]] fail.py
31# CHECK: # executed command: ! ! ! [[PYTHON_BARE]] fail.py
32# CHECK: ! ! ! ! [[PYTHON]] pass.py
33# CHECK: # executed command: ! ! ! ! [[PYTHON_BARE]] pass.py
34
35# CHECK: ! [[PYTHON]] pass.py
36# CHECK: # executed command: ! [[PYTHON_BARE]] pass.py
37# CHECK: # error: command failed with exit status: {{.*}}
38
39# CHECK: FAIL: shtest-not :: not-args-last-is-crash.txt {{.*}}
40# CHECK: not --crash
41# CHECK: # executed command: not --crash
42# CHECK: # | Error: 'not' requires a subcommand
43# CHECK: # error: command failed with exit status: {{.*}}
44
45# CHECK: FAIL: shtest-not :: not-args-nested-none.txt {{.*}}
46# CHECK: not not not
47# CHECK: # executed command: not not not
48# CHECK: # | Error: 'not' requires a subcommand
49# CHECK: # error: command failed with exit status: {{.*}}
50
51# CHECK: FAIL: shtest-not :: not-args-none.txt {{.*}}
52# CHECK: not
53# CHECK: # executed command: not
54# CHECK: # | Error: 'not' requires a subcommand
55# CHECK: # error: command failed with exit status: {{.*}}
56
57# CHECK: FAIL: shtest-not :: not-calls-cd.txt {{.*}}
58# CHECK: not not cd foobar
59# CHECK: # executed command: not not cd foobar
60# CHECK: not --crash cd foobar
61# CHECK: # executed command: not --crash cd foobar
62# CHECK: # | Error: 'not --crash' cannot call 'cd'
63# CHECK: # error: command failed with exit status: {{.*}}
64
65# CHECK: FAIL: shtest-not :: not-calls-colon.txt {{.*}}
66# CHECK: not not : foobar
67# CHECK: # executed command: not not : foobar
68# CHECK: not --crash :
69# CHECK: # executed command: not --crash :
70# CHECK: # | Error: 'not --crash' cannot call ':'
71# CHECK: # error: command failed with exit status: {{.*}}
72
73# CHECK: FAIL: shtest-not :: not-calls-diff-with-crash.txt {{.*}}
74# CHECK: not --crash diff -u {{.*}}
75# CHECK: # executed command: not --crash diff -u {{.*}}
76# CHECK-NOT: # executed command: {{.*}}
77# CHECK-NOT: {{[Ee]rror}}
78# CHECK: # error: command failed with exit status: {{.*}}
79# CHECK-NOT: # executed command: {{.*}}
80# CHECK-NOT: {{[Ee]rror}}
81
82# CHECK: FAIL: shtest-not :: not-calls-diff.txt {{.*}}
83# CHECK: not diff {{.*}}
84# CHECK: # executed command: not diff {{.*}}
85# CHECK: not not not diff {{.*}}
86# CHECK: # executed command: not not not diff {{.*}}
87# CHECK: not not not not not diff {{.*}}
88# CHECK: # executed command: not not not not not diff {{.*}}
89# CHECK: diff {{.*}}
90# CHECK: # executed command: diff {{.*}}
91# CHECK: not not diff {{.*}}
92# CHECK: # executed command: not not diff {{.*}}
93# CHECK: not not not not diff {{.*}}
94# CHECK: # executed command: not not not not diff {{.*}}
95# CHECK: not diff {{.*}}
96# CHECK: # executed command: not diff {{.*}}
97# CHECK-NOT: # executed command: {{.*}}
98
99# CHECK: FAIL: shtest-not :: not-calls-echo.txt {{.*}}
100# CHECK: not not echo hello world
101# CHECK: # executed command: not not echo hello world
102# CHECK: not --crash echo hello world
103# CHECK: # executed command: not --crash echo hello world
104# CHECK: # | Error: 'not --crash' cannot call 'echo'
105# CHECK: # error: command failed with exit status: {{.*}}
106
107# CHECK: FAIL: shtest-not :: not-calls-env-builtin.txt {{.*}}
108# CHECK: not --crash env -u FOO BAR=3 rm {{.*}}.no-such-file
109# CHECK: # executed command: not --crash env -u FOO BAR=3 rm {{.+}}.no-such-file{{.*}}
110# CHECK: # | Error: 'env' cannot call 'rm'
111# CHECK: # error: command failed with exit status: {{.*}}
112
113# CHECK: FAIL: shtest-not :: not-calls-export.txt {{.*}}
114# CHECK: not not export FOO=1
115# CHECK: # executed command: not not export FOO=1
116# CHECK: not --crash export BAZ=3
117# CHECK: # executed command: not --crash export BAZ=3
118# CHECK: # | Error: 'not --crash' cannot call 'export'
119# CHECK: # error: command failed with exit status: {{.*}}
120
121
122# CHECK: PASS: shtest-not :: not-calls-external.txt {{.*}}
123
124# CHECK: not [[PYTHON]] fail.py
125# CHECK: # executed command: not [[PYTHON_BARE]] fail.py
126# CHECK: not not [[PYTHON]] pass.py
127# CHECK: # executed command: not not [[PYTHON_BARE]] pass.py
128# CHECK: not not not [[PYTHON]] fail.py
129# CHECK: # executed command: not not not [[PYTHON_BARE]] fail.py
130# CHECK: not not not not [[PYTHON]] pass.py
131# CHECK: # executed command: not not not not [[PYTHON_BARE]] pass.py
132
133# CHECK: not not --crash [[PYTHON]] pass.py
134# CHECK: # executed command: not not --crash [[PYTHON_BARE]] pass.py
135# CHECK: not not --crash [[PYTHON]] fail.py
136# CHECK: # executed command: not not --crash [[PYTHON_BARE]] fail.py
137# CHECK: not not --crash not [[PYTHON]] pass.py
138# CHECK: # executed command: not not --crash not [[PYTHON_BARE]] pass.py
139# CHECK: not not --crash not [[PYTHON]] fail.py
140# CHECK: # executed command: not not --crash not [[PYTHON_BARE]] fail.py
141
142# CHECK: env not [[PYTHON]] fail.py | {{.*}}
143# CHECK: # executed command: env not [[PYTHON_BARE]] fail.py
144# CHECK: not env [[PYTHON]] fail.py | {{.*}}
145# CHECK: # executed command: not env [[PYTHON_BARE]] fail.py
146# CHECK: env FOO=1 not [[PYTHON]] fail.py | {{.*}}
147# CHECK: # executed command: env FOO=1 not [[PYTHON_BARE]] fail.py
148# CHECK: not env FOO=1 BAR=1 [[PYTHON]] fail.py | {{.*}}
149# CHECK: # executed command: not env FOO=1 BAR=1 [[PYTHON_BARE]] fail.py
150# CHECK: env FOO=1 BAR=1 not env -u FOO BAR=2 [[PYTHON]] fail.py | {{.*}}
151# CHECK: # executed command: env FOO=1 BAR=1 not env -u FOO BAR=2 [[PYTHON_BARE]] fail.py
152# CHECK: not env FOO=1 BAR=1 not env -u FOO -u BAR [[PYTHON]] pass.py | {{.*}}
153# CHECK: # executed command: not env FOO=1 BAR=1 not env -u FOO -u BAR [[PYTHON_BARE]] pass.py
154# CHECK: not not env FOO=1 env FOO=2 BAR=1 [[PYTHON]] pass.py | {{.*}}
155# CHECK: # executed command: not not env FOO=1 env FOO=2 BAR=1 [[PYTHON_BARE]] pass.py
156# CHECK: env FOO=1 -u BAR env -u FOO BAR=1 not not [[PYTHON]] pass.py | {{.*}}
157# CHECK: # executed command: env FOO=1 -u BAR env -u FOO BAR=1 not not [[PYTHON_BARE]] pass.py
158
159# CHECK: not env FOO=1 BAR=1 env FOO=2 BAR=2 not --crash [[PYTHON]] pass.py | {{.*}}
160# CHECK: # executed command: not env FOO=1 BAR=1 env FOO=2 BAR=2 not --crash [[PYTHON_BARE]] pass.py
161# CHECK: not env FOO=1 BAR=1 not --crash not [[PYTHON]] pass.py | {{.*}}
162# CHECK: # executed command: not env FOO=1 BAR=1 not --crash not [[PYTHON_BARE]] pass.py
163# CHECK: not not --crash env -u BAR not env -u FOO BAR=1 [[PYTHON]] pass.py | {{.*}}
164# CHECK: # executed command: not not --crash env -u BAR not env -u FOO BAR=1 [[PYTHON_BARE]] pass.py
165
166
167# CHECK: FAIL: shtest-not :: not-calls-fail2.txt {{.*}}
168# CHECK-NEXT: {{.*}} TEST 'shtest-not :: not-calls-fail2.txt' FAILED {{.*}}
169# CHECK-NEXT: Exit Code: 1
170
171# CHECK: FAIL: shtest-not :: not-calls-mkdir.txt {{.*}}
172# CHECK: not mkdir {{.*}}
173# CHECK: # executed command: not mkdir {{.*}}
174# CHECK: not --crash mkdir foobar
175# CHECK: # executed command: not --crash mkdir foobar
176# CHECK: # | Error: 'not --crash' cannot call 'mkdir'
177# CHECK: # error: command failed with exit status: {{.*}}
178
179# CHECK: FAIL: shtest-not :: not-calls-rm.txt {{.*}}
180# CHECK: not rm {{.*}}
181# CHECK: # executed command: not rm {{.*}}
182# CHECK: not --crash rm foobar
183# CHECK: # executed command: not --crash rm foobar
184# CHECK: # | Error: 'not --crash' cannot call 'rm'
185# CHECK: # error: command failed with exit status: {{.*}}
186
187# CHECK: Total Discovered Tests: 17
188# CHECK: Passed:  1 {{\([0-9]*\.[0-9]*%\)}}
189# CHECK: Failed: 16 {{\([0-9]*\.[0-9]*%\)}}
190# CHECK-NOT: {{.}}
191