blob: 150c2fe362c5de43b0f309f4c052459dfc436d90 [file] [log] [blame]
Daniel Dunbar38d37982013-01-31 22:15:20 +00001# Check the internal shell handling component of the ShTest format.
2#
3# RUN: not %{lit} -j 1 -v %{inputs}/shtest-shell > %t.out
Reid Kleckner125c74b2017-07-28 16:24:18 +00004# FIXME: Temporarily dump test output so we can debug failing tests on
5# buildbots.
6# RUN: cat %t.out
Joel E. Denny57046e82019-10-12 18:51:51 +00007# RUN: FileCheck --input-file %t.out %s
Daniel Dunbar38d37982013-01-31 22:15:20 +00008#
9# END.
10
11# CHECK: -- Testing:
12
Reid Kleckner82528922018-03-26 18:05:12 +000013# CHECK: FAIL: shtest-shell :: cat-error-0.txt
14# CHECK: *** TEST 'shtest-shell :: cat-error-0.txt' FAILED ***
15# CHECK: $ "cat" "-b" "temp1.txt"
16# CHECK: # command stderr:
17# CHECK: Unsupported: 'cat': option -b not recognized
18# CHECK: error: command failed with exit status: 1
19# CHECK: ***
20
21# CHECK: FAIL: shtest-shell :: cat-error-1.txt
22# CHECK: *** TEST 'shtest-shell :: cat-error-1.txt' FAILED ***
23# CHECK: $ "cat" "temp1.txt"
24# CHECK: # command stderr:
25# CHECK: [Errno 2] No such file or directory: 'temp1.txt'
26# CHECK: error: command failed with exit status: 1
27# CHECK: ***
Ying Yicfb08e92017-12-01 09:54:27 +000028
Joel E. Denny31b37392018-05-31 00:55:32 +000029# CHECK: FAIL: shtest-shell :: colon-error.txt
30# CHECK: *** TEST 'shtest-shell :: colon-error.txt' FAILED ***
31# CHECK: $ ":"
32# CHECK: # command stderr:
33# CHECK: Unsupported: ':' cannot be part of a pipeline
34# CHECK: error: command failed with exit status: 127
35# CHECK: ***
36
Joel E. Dennyf095b8c2019-10-16 17:21:24 +000037
38# CHECK: FAIL: shtest-shell :: diff-encodings.txt
39# CHECK: *** TEST 'shtest-shell :: diff-encodings.txt' FAILED ***
40
41# CHECK: $ "diff" "-u" "diff-in.bin" "diff-in.bin"
42# CHECK-NOT: error
43
44# CHECK: $ "diff" "-u" "diff-in.utf16" "diff-in.bin"
45# CHECK: # command output:
46# CHECK-NEXT: ---
47# CHECK-NEXT: +++
48# CHECK-NEXT: @@
49# CHECK-NEXT: {{^ .f.o.o.$}}
50# CHECK-NEXT: {{^-.b.a.r.$}}
51# CHECK-NEXT: {{^\+.b.a.r..}}
52# CHECK-NEXT: {{^ .b.a.z.$}}
53# CHECK: error: command failed with exit status: 1
54# CHECK: $ "true"
55
56# CHECK: $ "diff" "-u" "diff-in.utf8" "diff-in.bin"
57# CHECK: # command output:
58# CHECK-NEXT: ---
59# CHECK-NEXT: +++
60# CHECK-NEXT: @@
61# CHECK-NEXT: -foo
62# CHECK-NEXT: -bar
63# CHECK-NEXT: -baz
64# CHECK-NEXT: {{^\+.f.o.o.$}}
65# CHECK-NEXT: {{^\+.b.a.r..}}
66# CHECK-NEXT: {{^\+.b.a.z.$}}
67# CHECK: error: command failed with exit status: 1
68# CHECK: $ "true"
69
70# CHECK: $ "diff" "-u" "diff-in.bin" "diff-in.utf8"
71# CHECK: # command output:
72# CHECK-NEXT: ---
73# CHECK-NEXT: +++
74# CHECK-NEXT: @@
75# CHECK-NEXT: {{^\-.f.o.o.$}}
76# CHECK-NEXT: {{^\-.b.a.r..}}
77# CHECK-NEXT: {{^\-.b.a.z.$}}
78# CHECK-NEXT: +foo
79# CHECK-NEXT: +bar
80# CHECK-NEXT: +baz
81# CHECK: error: command failed with exit status: 1
82# CHECK: $ "true"
83
84# CHECK: $ "false"
85
86# CHECK: ***
87
88
Ying Yicfb08e92017-12-01 09:54:27 +000089# CHECK: FAIL: shtest-shell :: diff-error-1.txt
90# CHECK: *** TEST 'shtest-shell :: diff-error-1.txt' FAILED ***
91# CHECK: $ "diff" "-B" "temp1.txt" "temp2.txt"
92# CHECK: # command stderr:
93# CHECK: Unsupported: 'diff': option -B not recognized
Joel E. Dennyb1638062019-10-17 14:02:42 +000094# CHECK: error: command failed with exit status: 1
Ying Yicfb08e92017-12-01 09:54:27 +000095# CHECK: ***
96
97# CHECK: FAIL: shtest-shell :: diff-error-2.txt
98# CHECK: *** TEST 'shtest-shell :: diff-error-2.txt' FAILED ***
99# CHECK: $ "diff" "temp.txt"
100# CHECK: # command stderr:
Joel E. Dennyb1638062019-10-17 14:02:42 +0000101# CHECK: Error: missing or extra operand
102# CHECK: error: command failed with exit status: 1
Ying Yicfb08e92017-12-01 09:54:27 +0000103# CHECK: ***
104
105# CHECK: FAIL: shtest-shell :: diff-error-3.txt
106# CHECK: *** TEST 'shtest-shell :: diff-error-3.txt' FAILED ***
107# CHECK: $ "diff" "temp.txt" "temp1.txt"
108# CHECK: # command stderr:
109# CHECK: Error: 'diff' command failed
110# CHECK: error: command failed with exit status: 1
111# CHECK: ***
112
113# CHECK: FAIL: shtest-shell :: diff-error-4.txt
114# CHECK: *** TEST 'shtest-shell :: diff-error-4.txt' FAILED ***
115# CHECK: Exit Code: 1
116# CHECK: # command output:
117# CHECK: diff-error-4.txt.tmp
118# CHECK: diff-error-4.txt.tmp1
119# CHECK: *** 1 ****
120# CHECK: ! hello-first
121# CHECK: --- 1 ----
122# CHECK: ! hello-second
123# CHECK: ***
124
125# CHECK: FAIL: shtest-shell :: diff-error-5.txt
126# CHECK: *** TEST 'shtest-shell :: diff-error-5.txt' FAILED ***
127# CHECK: $ "diff"
128# CHECK: # command stderr:
Joel E. Dennyb1638062019-10-17 14:02:42 +0000129# CHECK: Error: missing or extra operand
130# CHECK: error: command failed with exit status: 1
Ying Yicfb08e92017-12-01 09:54:27 +0000131# CHECK: ***
132
133# CHECK: FAIL: shtest-shell :: diff-error-6.txt
134# CHECK: *** TEST 'shtest-shell :: diff-error-6.txt' FAILED ***
135# CHECK: $ "diff"
136# CHECK: # command stderr:
Joel E. Dennyb1638062019-10-17 14:02:42 +0000137# CHECK: Error: missing or extra operand
138# CHECK: error: command failed with exit status: 1
Ying Yicfb08e92017-12-01 09:54:27 +0000139# CHECK: ***
140
Joel E. Dennyb1638062019-10-17 14:02:42 +0000141
142# CHECK: FAIL: shtest-shell :: diff-pipes.txt
143
144# CHECK: *** TEST 'shtest-shell :: diff-pipes.txt' FAILED ***
145
146# CHECK: $ "diff" "{{[^"]*}}.foo" "{{[^"]*}}.foo"
147# CHECK-NOT: note
148# CHECK-NOT: error
149# CHECK: $ "FileCheck"
150# CHECK-NOT: note
151# CHECK-NOT: error
152
153# CHECK: $ "diff" "-u" "{{[^"]*}}.foo" "{{[^"]*}}.bar"
154# CHECK: note: command had no output on stdout or stderr
155# CHECK: error: command failed with exit status: 1
156# CHECK: $ "FileCheck"
157# CHECK-NOT: note
158# CHECK-NOT: error
159# CHECK: $ "true"
160
161# CHECK: $ "false"
162
163# CHECK: ***
164
165
Max Moroz975eaca2018-01-09 18:23:34 +0000166# CHECK: FAIL: shtest-shell :: diff-r-error-0.txt
167# CHECK: *** TEST 'shtest-shell :: diff-r-error-0.txt' FAILED ***
Dmitri Gribenko60e52f52019-02-28 10:58:13 +0000168# CHECK: $ "diff" "-r"
Max Moroz975eaca2018-01-09 18:23:34 +0000169# CHECK: # command output:
170# CHECK: Only in {{.*}}dir1: dir1unique
171# CHECK: Only in {{.*}}dir2: dir2unique
172# CHECK: error: command failed with exit status: 1
173
174# CHECK: FAIL: shtest-shell :: diff-r-error-1.txt
175# CHECK: *** TEST 'shtest-shell :: diff-r-error-1.txt' FAILED ***
Dmitri Gribenko60e52f52019-02-28 10:58:13 +0000176# CHECK: $ "diff" "-r"
Max Moroz975eaca2018-01-09 18:23:34 +0000177# CHECK: # command output:
178# CHECK: *** {{.*}}dir1{{.*}}subdir{{.*}}f01
179# CHECK: --- {{.*}}dir2{{.*}}subdir{{.*}}f01
180# CHECK: 12345
181# CHECK: 00000
182# CHECK: error: command failed with exit status: 1
183
184# CHECK: FAIL: shtest-shell :: diff-r-error-2.txt
185# CHECK: *** TEST 'shtest-shell :: diff-r-error-2.txt' FAILED ***
Dmitri Gribenko60e52f52019-02-28 10:58:13 +0000186# CHECK: $ "diff" "-r"
Max Moroz975eaca2018-01-09 18:23:34 +0000187# CHECK: # command output:
188# CHECK: Only in {{.*}}dir2: extrafile
189# CHECK: error: command failed with exit status: 1
190
191# CHECK: FAIL: shtest-shell :: diff-r-error-3.txt
192# CHECK: *** TEST 'shtest-shell :: diff-r-error-3.txt' FAILED ***
Dmitri Gribenko60e52f52019-02-28 10:58:13 +0000193# CHECK: $ "diff" "-r"
Max Moroz975eaca2018-01-09 18:23:34 +0000194# CHECK: # command output:
195# CHECK: Only in {{.*}}dir1: extra_subdir
196# CHECK: error: command failed with exit status: 1
197
198# CHECK: FAIL: shtest-shell :: diff-r-error-4.txt
199# CHECK: *** TEST 'shtest-shell :: diff-r-error-4.txt' FAILED ***
Dmitri Gribenko60e52f52019-02-28 10:58:13 +0000200# CHECK: $ "diff" "-r"
Max Moroz975eaca2018-01-09 18:23:34 +0000201# CHECK: # command output:
202# CHECK: File {{.*}}dir1{{.*}}extra_subdir is a directory while file {{.*}}dir2{{.*}}extra_subdir is a regular file
203# CHECK: error: command failed with exit status: 1
204
205# CHECK: FAIL: shtest-shell :: diff-r-error-5.txt
206# CHECK: *** TEST 'shtest-shell :: diff-r-error-5.txt' FAILED ***
Dmitri Gribenko60e52f52019-02-28 10:58:13 +0000207# CHECK: $ "diff" "-r"
Max Moroz975eaca2018-01-09 18:23:34 +0000208# CHECK: # command output:
209# CHECK: Only in {{.*}}dir1: extra_subdir
210# CHECK: error: command failed with exit status: 1
211
212# CHECK: FAIL: shtest-shell :: diff-r-error-6.txt
213# CHECK: *** TEST 'shtest-shell :: diff-r-error-6.txt' FAILED ***
Dmitri Gribenko60e52f52019-02-28 10:58:13 +0000214# CHECK: $ "diff" "-r"
Max Moroz975eaca2018-01-09 18:23:34 +0000215# CHECK: # command output:
216# CHECK: File {{.*}}dir1{{.*}}extra_file is a regular empty file while file {{.*}}dir2{{.*}}extra_file is a directory
217# CHECK: error: command failed with exit status: 1
218
219# CHECK: PASS: shtest-shell :: diff-r.txt
220
Joel E. Denny26224192019-10-16 17:21:57 +0000221
222# CHECK: FAIL: shtest-shell :: diff-strip-trailing-cr.txt
223
224# CHECK: *** TEST 'shtest-shell :: diff-strip-trailing-cr.txt' FAILED ***
225
226# CHECK: $ "diff" "-u" "diff-in.dos" "diff-in.unix"
227# CHECK: # command output:
228# CHECK: @@
229# CHECK-NEXT: -In this file, the
230# CHECK-NEXT: -sequence "\r\n"
231# CHECK-NEXT: -terminates lines.
232# CHECK-NEXT: +In this file, the
233# CHECK-NEXT: +sequence "\n"
234# CHECK-NEXT: +terminates lines.
235# CHECK: error: command failed with exit status: 1
236# CHECK: $ "true"
237
238# CHECK: $ "diff" "-u" "diff-in.unix" "diff-in.dos"
239# CHECK: # command output:
240# CHECK: @@
241# CHECK-NEXT: -In this file, the
242# CHECK-NEXT: -sequence "\n"
243# CHECK-NEXT: -terminates lines.
244# CHECK-NEXT: +In this file, the
245# CHECK-NEXT: +sequence "\r\n"
246# CHECK-NEXT: +terminates lines.
247# CHECK: error: command failed with exit status: 1
248# CHECK: $ "true"
249
250# CHECK: $ "diff" "-u" "--strip-trailing-cr" "diff-in.dos" "diff-in.unix"
251# CHECK: # command output:
252# CHECK: @@
253# CHECK-NEXT: In this file, the
254# CHECK-NEXT: -sequence "\r\n"
255# CHECK-NEXT: +sequence "\n"
256# CHECK-NEXT: terminates lines.
257# CHECK: error: command failed with exit status: 1
258# CHECK: $ "true"
259
260# CHECK: $ "diff" "-u" "--strip-trailing-cr" "diff-in.unix" "diff-in.dos"
261# CHECK: # command output:
262# CHECK: @@
263# CHECK-NEXT: In this file, the
264# CHECK-NEXT: -sequence "\n"
265# CHECK-NEXT: +sequence "\r\n"
266# CHECK-NEXT: terminates lines.
267# CHECK: error: command failed with exit status: 1
268# CHECK: $ "true"
269
270# CHECK: $ "false"
271
272# CHECK: ***
273
274
Joel E. Denny7e385bd2019-10-14 19:59:30 +0000275# CHECK: FAIL: shtest-shell :: diff-unified.txt
276
277# CHECK: *** TEST 'shtest-shell :: diff-unified.txt' FAILED ***
278
279# CHECK: $ "diff" "-u" "{{[^"]*}}.foo" "{{[^"]*}}.bar"
280# CHECK: # command output:
281# CHECK: @@ {{.*}} @@
282# CHECK-NEXT: 3
283# CHECK-NEXT: 4
284# CHECK-NEXT: 5
285# CHECK-NEXT: -6 foo
286# CHECK-NEXT: +6 bar
287# CHECK-NEXT: 7
288# CHECK-NEXT: 8
289# CHECK-NEXT: 9
290# CHECK-EMPTY:
291# CHECK-NEXT: error: command failed with exit status: 1
292# CHECK-NEXT: $ "true"
293
294# CHECK: $ "diff" "-U" "2" "{{[^"]*}}.foo" "{{[^"]*}}.bar"
295# CHECK: # command output:
296# CHECK: @@ {{.*}} @@
297# CHECK-NEXT: 4
298# CHECK-NEXT: 5
299# CHECK-NEXT: -6 foo
300# CHECK-NEXT: +6 bar
301# CHECK-NEXT: 7
302# CHECK-NEXT: 8
303# CHECK-EMPTY:
304# CHECK-NEXT: error: command failed with exit status: 1
305# CHECK-NEXT: $ "true"
306
307# CHECK: $ "diff" "-U4" "{{[^"]*}}.foo" "{{[^"]*}}.bar"
308# CHECK: # command output:
309# CHECK: @@ {{.*}} @@
310# CHECK-NEXT: 2
311# CHECK-NEXT: 3
312# CHECK-NEXT: 4
313# CHECK-NEXT: 5
314# CHECK-NEXT: -6 foo
315# CHECK-NEXT: +6 bar
316# CHECK-NEXT: 7
317# CHECK-NEXT: 8
318# CHECK-NEXT: 9
319# CHECK-NEXT: 10
320# CHECK-EMPTY:
321# CHECK-NEXT: error: command failed with exit status: 1
322# CHECK-NEXT: $ "true"
323
324# CHECK: $ "diff" "-U0" "{{[^"]*}}.foo" "{{[^"]*}}.bar"
325# CHECK: # command output:
326# CHECK: @@ {{.*}} @@
327# CHECK-NEXT: -6 foo
328# CHECK-NEXT: +6 bar
329# CHECK-EMPTY:
330# CHECK-NEXT: error: command failed with exit status: 1
331# CHECK-NEXT: $ "true"
332
Joel E. Dennyb1638062019-10-17 14:02:42 +0000333# CHECK: $ "diff" "-U" "30.1" "{{[^"]*}}" "{{[^"]*}}"
334# CHECK: # command stderr:
335# CHECK: Error: invalid '-U' argument: 30.1
336# CHECK: error: command failed with exit status: 1
337# CHECK: $ "true"
338
339# CHECK: $ "diff" "-U-1" "{{[^"]*}}" "{{[^"]*}}"
340# CHECK: # command stderr:
341# CHECK: Error: invalid '-U' argument: -1
342# CHECK: error: command failed with exit status: 1
343# CHECK: $ "true"
344
Joel E. Denny7e385bd2019-10-14 19:59:30 +0000345# CHECK: $ "false"
346
347# CHECK: ***
348
349
Daniel Dunbar38d37982013-01-31 22:15:20 +0000350# CHECK: FAIL: shtest-shell :: error-0.txt
351# CHECK: *** TEST 'shtest-shell :: error-0.txt' FAILED ***
Daniel Dunbar591838d2016-06-02 23:49:42 +0000352# CHECK: $ "not-a-real-command"
353# CHECK: # command stderr:
Daniel Dunbar38d37982013-01-31 22:15:20 +0000354# CHECK: 'not-a-real-command': command not found
Daniel Dunbar591838d2016-06-02 23:49:42 +0000355# CHECK: error: command failed with exit status: 127
Daniel Dunbar38d37982013-01-31 22:15:20 +0000356# CHECK: ***
357
358# FIXME: The output here sucks.
359#
360# CHECK: FAIL: shtest-shell :: error-1.txt
361# CHECK: *** TEST 'shtest-shell :: error-1.txt' FAILED ***
Joel E. Dennyfc01dd22018-05-31 03:40:37 +0000362# CHECK: shell parser error on: ': \'RUN: at line 3\'; echo "missing quote'
Daniel Dunbar38d37982013-01-31 22:15:20 +0000363# CHECK: ***
364
365# CHECK: FAIL: shtest-shell :: error-2.txt
366# CHECK: *** TEST 'shtest-shell :: error-2.txt' FAILED ***
367# CHECK: Unsupported redirect:
368# CHECK: ***
369
Ying Yicfb08e92017-12-01 09:54:27 +0000370# CHECK: FAIL: shtest-shell :: mkdir-error-0.txt
371# CHECK: *** TEST 'shtest-shell :: mkdir-error-0.txt' FAILED ***
372# CHECK: $ "mkdir" "-p" "temp"
373# CHECK: # command stderr:
374# CHECK: Unsupported: 'mkdir' cannot be part of a pipeline
375# CHECK: error: command failed with exit status: 127
376# CHECK: ***
377
378# CHECK: FAIL: shtest-shell :: mkdir-error-1.txt
379# CHECK: *** TEST 'shtest-shell :: mkdir-error-1.txt' FAILED ***
380# CHECK: $ "mkdir" "-p" "-m" "777" "temp"
381# CHECK: # command stderr:
382# CHECK: Unsupported: 'mkdir': option -m not recognized
383# CHECK: error: command failed with exit status: 127
384# CHECK: ***
385
386# CHECK: FAIL: shtest-shell :: mkdir-error-2.txt
387# CHECK: *** TEST 'shtest-shell :: mkdir-error-2.txt' FAILED ***
388# CHECK: $ "mkdir" "-p"
389# CHECK: # command stderr:
390# CHECK: Error: 'mkdir' is missing an operand
391# CHECK: error: command failed with exit status: 127
392# CHECK: ***
393
Daniel Dunbar38d37982013-01-31 22:15:20 +0000394# CHECK: PASS: shtest-shell :: redirects.txt
Ying Yicfb08e92017-12-01 09:54:27 +0000395
396# CHECK: FAIL: shtest-shell :: rm-error-0.txt
397# CHECK: *** TEST 'shtest-shell :: rm-error-0.txt' FAILED ***
398# CHECK: $ "rm" "-rf" "temp"
399# CHECK: # command stderr:
400# CHECK: Unsupported: 'rm' cannot be part of a pipeline
401# CHECK: error: command failed with exit status: 127
402# CHECK: ***
403
404# CHECK: FAIL: shtest-shell :: rm-error-1.txt
405# CHECK: *** TEST 'shtest-shell :: rm-error-1.txt' FAILED ***
406# CHECK: $ "rm" "-f" "-v" "temp"
407# CHECK: # command stderr:
408# CHECK: Unsupported: 'rm': option -v not recognized
409# CHECK: error: command failed with exit status: 127
410# CHECK: ***
411
412# CHECK: FAIL: shtest-shell :: rm-error-2.txt
413# CHECK: *** TEST 'shtest-shell :: rm-error-2.txt' FAILED ***
414# CHECK: $ "rm" "-r" "hello"
415# CHECK: # command stderr:
416# CHECK: Error: 'rm' command failed
417# CHECK: error: command failed with exit status: 1
418# CHECK: ***
419
420# CHECK: FAIL: shtest-shell :: rm-error-3.txt
421# CHECK: *** TEST 'shtest-shell :: rm-error-3.txt' FAILED ***
422# CHECK: Exit Code: 1
423# CHECK: ***
424
Serge Guelton54be9092019-02-28 19:16:17 +0000425# CHECK: PASS: shtest-shell :: rm-unicode-0.txt
Daniel Dunbar38d37982013-01-31 22:15:20 +0000426# CHECK: PASS: shtest-shell :: sequencing-0.txt
427# CHECK: XFAIL: shtest-shell :: sequencing-1.txt
Joel E. Denny27fdf8a2019-10-18 12:53:45 -0400428
429# CHECK: FAIL: shtest-shell :: stdout-encoding.txt
430# CHECK: *** TEST 'shtest-shell :: stdout-encoding.txt' FAILED ***
431# CHECK: $ "cat" "diff-in.bin"
432# CHECK: # command output:
433# CHECK-NEXT: {{^.f.o.o.$}}
434# CHECK-NEXT: {{^.b.a.r..}}
435# CHECK-NEXT: {{^.b.a.z.$}}
436# CHECK-NOT: error
437# CHECK: $ "false"
438# CHECK: ***
439
Ying Yicfb08e92017-12-01 09:54:27 +0000440# CHECK: PASS: shtest-shell :: valid-shell.txt
Joel E. Dennyb1638062019-10-17 14:02:42 +0000441# CHECK: Failing Tests (31)