1 # Check the internal shell handling component of the ShTest format.
3 # RUN: not %{lit} -j 1 -v %{inputs}/shtest-shell > %t.out
4 # FIXME: Temporarily dump test output so we can debug failing tests on
7 # RUN: FileCheck --input-file %t.out %s
13 # 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
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
29 # CHECK: FAIL: shtest-shell :: colon-error.txt
30 # CHECK: *** TEST 'shtest-shell :: colon-error.txt' FAILED ***
32 # CHECK: # command stderr:
33 # CHECK: Unsupported: ':' cannot be part of a pipeline
34 # CHECK: error: command failed with exit status: 127
37 # CHECK: PASS: shtest-shell :: dev-null.txt
39 # CHECK: FAIL: shtest-shell :: diff-b.txt
40 # CHECK: *** TEST 'shtest-shell :: diff-b.txt' FAILED ***
41 # CHECK: $ "diff" "-b" "{{[^"]*}}.0" "{{[^"]*}}.1"
42 # CHECK: # command output:
44 # CHECK-NEXT: {{^ }}f o o
47 # CHECK-NEXT: {{^ }}f o o
50 # CHECK: error: command failed with exit status: 1
54 # CHECK: FAIL: shtest-shell :: diff-encodings.txt
55 # CHECK: *** TEST 'shtest-shell :: diff-encodings.txt' FAILED ***
57 # CHECK: $ "diff" "-u" "diff-in.bin" "diff-in.bin"
60 # CHECK: $ "diff" "-u" "diff-in.utf16" "diff-in.bin"
61 # CHECK: # command output:
65 # CHECK-NEXT: {{^ .f.o.o.$}}
66 # CHECK-NEXT: {{^-.b.a.r.$}}
67 # CHECK-NEXT: {{^\+.b.a.r..}}
68 # CHECK-NEXT: {{^ .b.a.z.$}}
69 # CHECK: error: command failed with exit status: 1
72 # CHECK: $ "diff" "-u" "diff-in.utf8" "diff-in.bin"
73 # CHECK: # command output:
80 # CHECK-NEXT: {{^\+.f.o.o.$}}
81 # CHECK-NEXT: {{^\+.b.a.r..}}
82 # CHECK-NEXT: {{^\+.b.a.z.$}}
83 # CHECK: error: command failed with exit status: 1
86 # CHECK: $ "diff" "-u" "diff-in.bin" "diff-in.utf8"
87 # CHECK: # command output:
91 # CHECK-NEXT: {{^\-.f.o.o.$}}
92 # CHECK-NEXT: {{^\-.b.a.r..}}
93 # CHECK-NEXT: {{^\-.b.a.z.$}}
97 # CHECK: error: command failed with exit status: 1
100 # CHECK: $ "cat" "diff-in.bin"
102 # CHECK: $ "diff" "-u" "-" "diff-in.bin"
105 # CHECK: $ "cat" "diff-in.bin"
107 # CHECK: $ "diff" "-u" "diff-in.bin" "-"
110 # CHECK: $ "cat" "diff-in.bin"
112 # CHECK: $ "diff" "-u" "diff-in.utf16" "-"
113 # CHECK: # command output:
117 # CHECK-NEXT: {{^ .f.o.o.$}}
118 # CHECK-NEXT: {{^-.b.a.r.$}}
119 # CHECK-NEXT: {{^\+.b.a.r..}}
120 # CHECK-NEXT: {{^ .b.a.z.$}}
121 # CHECK: error: command failed with exit status: 1
124 # CHECK: $ "cat" "diff-in.bin"
126 # CHECK: $ "diff" "-u" "diff-in.utf8" "-"
127 # CHECK: # command output:
134 # CHECK-NEXT: {{^\+.f.o.o.$}}
135 # CHECK-NEXT: {{^\+.b.a.r..}}
136 # CHECK-NEXT: {{^\+.b.a.z.$}}
137 # CHECK: error: command failed with exit status: 1
140 # CHECK: $ "diff" "-u" "-" "diff-in.utf8"
141 # CHECK: # command output:
145 # CHECK-NEXT: {{^\-.f.o.o.$}}
146 # CHECK-NEXT: {{^\-.b.a.r..}}
147 # CHECK-NEXT: {{^\-.b.a.z.$}}
151 # CHECK: error: command failed with exit status: 1
159 # CHECK: FAIL: shtest-shell :: diff-error-1.txt
160 # CHECK: *** TEST 'shtest-shell :: diff-error-1.txt' FAILED ***
161 # CHECK: $ "diff" "-B" "temp1.txt" "temp2.txt"
162 # CHECK: # command stderr:
163 # CHECK: Unsupported: 'diff': option -B not recognized
164 # CHECK: error: command failed with exit status: 1
167 # CHECK: FAIL: shtest-shell :: diff-error-2.txt
168 # CHECK: *** TEST 'shtest-shell :: diff-error-2.txt' FAILED ***
169 # CHECK: $ "diff" "temp.txt"
170 # CHECK: # command stderr:
171 # CHECK: Error: missing or extra operand
172 # CHECK: error: command failed with exit status: 1
175 # CHECK: FAIL: shtest-shell :: diff-error-3.txt
176 # CHECK: *** TEST 'shtest-shell :: diff-error-3.txt' FAILED ***
177 # CHECK: $ "diff" "temp.txt" "temp1.txt"
178 # CHECK: # command stderr:
179 # CHECK: Error: 'diff' command failed
180 # CHECK: error: command failed with exit status: 1
183 # CHECK: FAIL: shtest-shell :: diff-error-4.txt
184 # CHECK: *** TEST 'shtest-shell :: diff-error-4.txt' FAILED ***
185 # CHECK: Exit Code: 1
186 # CHECK: # command output:
187 # CHECK: diff-error-4.txt.tmp
188 # CHECK: diff-error-4.txt.tmp1
190 # CHECK: ! hello-first
192 # CHECK: ! hello-second
195 # CHECK: FAIL: shtest-shell :: diff-error-5.txt
196 # CHECK: *** TEST 'shtest-shell :: diff-error-5.txt' FAILED ***
198 # CHECK: # command stderr:
199 # CHECK: Error: missing or extra operand
200 # CHECK: error: command failed with exit status: 1
203 # CHECK: FAIL: shtest-shell :: diff-error-6.txt
204 # CHECK: *** TEST 'shtest-shell :: diff-error-6.txt' FAILED ***
206 # CHECK: # command stderr:
207 # CHECK: Error: missing or extra operand
208 # CHECK: error: command failed with exit status: 1
212 # CHECK: FAIL: shtest-shell :: diff-pipes.txt
214 # CHECK: *** TEST 'shtest-shell :: diff-pipes.txt' FAILED ***
216 # CHECK: $ "diff" "{{[^"]*}}.foo" "{{[^"]*}}.foo"
219 # CHECK: $ "FileCheck"
223 # CHECK: $ "diff" "-u" "{{[^"]*}}.foo" "{{[^"]*}}.bar"
224 # CHECK: note: command had no output on stdout or stderr
225 # CHECK: error: command failed with exit status: 1
226 # CHECK: $ "FileCheck"
231 # CHECK: $ "cat" "{{[^"]*}}.foo"
232 # CHECK: $ "diff" "-u" "-" "{{[^"]*}}.foo"
236 # CHECK: $ "cat" "{{[^"]*}}.foo"
237 # CHECK: $ "diff" "-u" "{{[^"]*}}.foo" "-"
241 # CHECK: $ "cat" "{{[^"]*}}.bar"
242 # CHECK: $ "diff" "-u" "{{[^"]*}}.foo" "-"
243 # CHECK: # command output:
247 # CHECK: error: command failed with exit status: 1
250 # CHECK: $ "cat" "{{[^"]*}}.bar"
251 # CHECK: $ "diff" "-u" "-" "{{[^"]*}}.foo"
252 # CHECK: # command output:
256 # CHECK: error: command failed with exit status: 1
259 # CHECK: $ "cat" "{{[^"]*}}.foo"
260 # CHECK: $ "diff" "-" "{{[^"]*}}.foo"
263 # CHECK: $ "FileCheck"
267 # CHECK: $ "cat" "{{[^"]*}}.bar"
268 # CHECK: $ "diff" "-u" "{{[^"]*}}.foo" "-"
269 # CHECK: note: command had no output on stdout or stderr
270 # CHECK: error: command failed with exit status: 1
271 # CHECK: $ "FileCheck"
281 # CHECK: FAIL: shtest-shell :: diff-r-error-0.txt
282 # CHECK: *** TEST 'shtest-shell :: diff-r-error-0.txt' FAILED ***
283 # CHECK: $ "diff" "-r"
284 # CHECK: # command output:
285 # CHECK: Only in {{.*}}dir1: dir1unique
286 # CHECK: Only in {{.*}}dir2: dir2unique
287 # CHECK: error: command failed with exit status: 1
289 # CHECK: FAIL: shtest-shell :: diff-r-error-1.txt
290 # CHECK: *** TEST 'shtest-shell :: diff-r-error-1.txt' FAILED ***
291 # CHECK: $ "diff" "-r"
292 # CHECK: # command output:
293 # CHECK: *** {{.*}}dir1{{.*}}subdir{{.*}}f01
294 # CHECK: --- {{.*}}dir2{{.*}}subdir{{.*}}f01
297 # CHECK: error: command failed with exit status: 1
299 # CHECK: FAIL: shtest-shell :: diff-r-error-2.txt
300 # CHECK: *** TEST 'shtest-shell :: diff-r-error-2.txt' FAILED ***
301 # CHECK: $ "diff" "-r"
302 # CHECK: # command output:
303 # CHECK: Only in {{.*}}dir2: extrafile
304 # CHECK: error: command failed with exit status: 1
306 # CHECK: FAIL: shtest-shell :: diff-r-error-3.txt
307 # CHECK: *** TEST 'shtest-shell :: diff-r-error-3.txt' FAILED ***
308 # CHECK: $ "diff" "-r"
309 # CHECK: # command output:
310 # CHECK: Only in {{.*}}dir1: extra_subdir
311 # CHECK: error: command failed with exit status: 1
313 # CHECK: FAIL: shtest-shell :: diff-r-error-4.txt
314 # CHECK: *** TEST 'shtest-shell :: diff-r-error-4.txt' FAILED ***
315 # CHECK: $ "diff" "-r"
316 # CHECK: # command output:
317 # CHECK: File {{.*}}dir1{{.*}}extra_subdir is a directory while file {{.*}}dir2{{.*}}extra_subdir is a regular file
318 # CHECK: error: command failed with exit status: 1
320 # CHECK: FAIL: shtest-shell :: diff-r-error-5.txt
321 # CHECK: *** TEST 'shtest-shell :: diff-r-error-5.txt' FAILED ***
322 # CHECK: $ "diff" "-r"
323 # CHECK: # command output:
324 # CHECK: Only in {{.*}}dir1: extra_subdir
325 # CHECK: error: command failed with exit status: 1
327 # CHECK: FAIL: shtest-shell :: diff-r-error-6.txt
328 # CHECK: *** TEST 'shtest-shell :: diff-r-error-6.txt' FAILED ***
329 # CHECK: $ "diff" "-r"
330 # CHECK: # command output:
331 # CHECK: File {{.*}}dir1{{.*}}extra_file is a regular empty file while file {{.*}}dir2{{.*}}extra_file is a directory
332 # CHECK: error: command failed with exit status: 1
334 # CHECK: FAIL: shtest-shell :: diff-r-error-7.txt
335 # CHECK: *** TEST 'shtest-shell :: diff-r-error-7.txt' FAILED ***
336 # CHECK: $ "diff" "-r" "-" "{{[^"]*}}"
337 # CHECK: # command stderr:
338 # CHECK: Error: cannot recursively compare '-'
339 # CHECK: error: command failed with exit status: 1
341 # CHECK: FAIL: shtest-shell :: diff-r-error-8.txt
342 # CHECK: *** TEST 'shtest-shell :: diff-r-error-8.txt' FAILED ***
343 # CHECK: $ "diff" "-r" "{{[^"]*}}" "-"
344 # CHECK: # command stderr:
345 # CHECK: Error: cannot recursively compare '-'
346 # CHECK: error: command failed with exit status: 1
348 # CHECK: PASS: shtest-shell :: diff-r.txt
351 # CHECK: FAIL: shtest-shell :: diff-strip-trailing-cr.txt
353 # CHECK: *** TEST 'shtest-shell :: diff-strip-trailing-cr.txt' FAILED ***
355 # CHECK: $ "diff" "-u" "diff-in.dos" "diff-in.unix"
356 # CHECK: # command output:
358 # CHECK-NEXT: -In this file, the
359 # CHECK-NEXT: -sequence "\r\n"
360 # CHECK-NEXT: -terminates lines.
361 # CHECK-NEXT: +In this file, the
362 # CHECK-NEXT: +sequence "\n"
363 # CHECK-NEXT: +terminates lines.
364 # CHECK: error: command failed with exit status: 1
367 # CHECK: $ "diff" "-u" "diff-in.unix" "diff-in.dos"
368 # CHECK: # command output:
370 # CHECK-NEXT: -In this file, the
371 # CHECK-NEXT: -sequence "\n"
372 # CHECK-NEXT: -terminates lines.
373 # CHECK-NEXT: +In this file, the
374 # CHECK-NEXT: +sequence "\r\n"
375 # CHECK-NEXT: +terminates lines.
376 # CHECK: error: command failed with exit status: 1
379 # CHECK: $ "diff" "-u" "--strip-trailing-cr" "diff-in.dos" "diff-in.unix"
380 # CHECK: # command output:
382 # CHECK-NEXT: In this file, the
383 # CHECK-NEXT: -sequence "\r\n"
384 # CHECK-NEXT: +sequence "\n"
385 # CHECK-NEXT: terminates lines.
386 # CHECK: error: command failed with exit status: 1
389 # CHECK: $ "diff" "-u" "--strip-trailing-cr" "diff-in.unix" "diff-in.dos"
390 # CHECK: # command output:
392 # CHECK-NEXT: In this file, the
393 # CHECK-NEXT: -sequence "\n"
394 # CHECK-NEXT: +sequence "\r\n"
395 # CHECK-NEXT: terminates lines.
396 # CHECK: error: command failed with exit status: 1
404 # CHECK: FAIL: shtest-shell :: diff-unified.txt
406 # CHECK: *** TEST 'shtest-shell :: diff-unified.txt' FAILED ***
408 # CHECK: $ "diff" "-u" "{{[^"]*}}.foo" "{{[^"]*}}.bar"
409 # CHECK: # command output:
410 # CHECK: @@ {{.*}} @@
420 # CHECK-NEXT: error: command failed with exit status: 1
421 # CHECK-NEXT: $ "true"
423 # CHECK: $ "diff" "-U" "2" "{{[^"]*}}.foo" "{{[^"]*}}.bar"
424 # CHECK: # command output:
425 # CHECK: @@ {{.*}} @@
433 # CHECK-NEXT: error: command failed with exit status: 1
434 # CHECK-NEXT: $ "true"
436 # CHECK: $ "diff" "-U4" "{{[^"]*}}.foo" "{{[^"]*}}.bar"
437 # CHECK: # command output:
438 # CHECK: @@ {{.*}} @@
450 # CHECK-NEXT: error: command failed with exit status: 1
451 # CHECK-NEXT: $ "true"
453 # CHECK: $ "diff" "-U0" "{{[^"]*}}.foo" "{{[^"]*}}.bar"
454 # CHECK: # command output:
455 # CHECK: @@ {{.*}} @@
459 # CHECK-NEXT: error: command failed with exit status: 1
460 # CHECK-NEXT: $ "true"
462 # CHECK: $ "diff" "-U" "30.1" "{{[^"]*}}" "{{[^"]*}}"
463 # CHECK: # command stderr:
464 # CHECK: Error: invalid '-U' argument: 30.1
465 # CHECK: error: command failed with exit status: 1
468 # CHECK: $ "diff" "-U-1" "{{[^"]*}}" "{{[^"]*}}"
469 # CHECK: # command stderr:
470 # CHECK: Error: invalid '-U' argument: -1
471 # CHECK: error: command failed with exit status: 1
479 # CHECK: FAIL: shtest-shell :: diff-w.txt
480 # CHECK: *** TEST 'shtest-shell :: diff-w.txt' FAILED ***
481 # CHECK: $ "diff" "-w" "{{[^"]*}}.0" "{{[^"]*}}.1"
482 # CHECK: # command output:
484 # CHECK-NEXT: {{^ }}foo
485 # CHECK-NEXT: {{^ }}bar
488 # CHECK-NEXT: {{^ }}foo
489 # CHECK-NEXT: {{^ }}bar
492 # CHECK: error: command failed with exit status: 1
495 # CHECK: FAIL: shtest-shell :: error-0.txt
496 # CHECK: *** TEST 'shtest-shell :: error-0.txt' FAILED ***
497 # CHECK: $ "not-a-real-command"
498 # CHECK: # command stderr:
499 # CHECK: 'not-a-real-command': command not found
500 # CHECK: error: command failed with exit status: 127
503 # FIXME: The output here sucks.
505 # CHECK: FAIL: shtest-shell :: error-1.txt
506 # CHECK: *** TEST 'shtest-shell :: error-1.txt' FAILED ***
507 # CHECK: shell parser error on: ': \'RUN: at line 3\'; echo "missing quote'
510 # CHECK: FAIL: shtest-shell :: error-2.txt
511 # CHECK: *** TEST 'shtest-shell :: error-2.txt' FAILED ***
512 # CHECK: Unsupported redirect:
515 # CHECK: FAIL: shtest-shell :: mkdir-error-0.txt
516 # CHECK: *** TEST 'shtest-shell :: mkdir-error-0.txt' FAILED ***
517 # CHECK: $ "mkdir" "-p" "temp"
518 # CHECK: # command stderr:
519 # CHECK: Unsupported: 'mkdir' cannot be part of a pipeline
520 # CHECK: error: command failed with exit status: 127
523 # CHECK: FAIL: shtest-shell :: mkdir-error-1.txt
524 # CHECK: *** TEST 'shtest-shell :: mkdir-error-1.txt' FAILED ***
525 # CHECK: $ "mkdir" "-p" "-m" "777" "temp"
526 # CHECK: # command stderr:
527 # CHECK: Unsupported: 'mkdir': option -m not recognized
528 # CHECK: error: command failed with exit status: 127
531 # CHECK: FAIL: shtest-shell :: mkdir-error-2.txt
532 # CHECK: *** TEST 'shtest-shell :: mkdir-error-2.txt' FAILED ***
533 # CHECK: $ "mkdir" "-p"
534 # CHECK: # command stderr:
535 # CHECK: Error: 'mkdir' is missing an operand
536 # CHECK: error: command failed with exit status: 127
539 # CHECK: PASS: shtest-shell :: redirects.txt
541 # CHECK: FAIL: shtest-shell :: rm-error-0.txt
542 # CHECK: *** TEST 'shtest-shell :: rm-error-0.txt' FAILED ***
543 # CHECK: $ "rm" "-rf" "temp"
544 # CHECK: # command stderr:
545 # CHECK: Unsupported: 'rm' cannot be part of a pipeline
546 # CHECK: error: command failed with exit status: 127
549 # CHECK: FAIL: shtest-shell :: rm-error-1.txt
550 # CHECK: *** TEST 'shtest-shell :: rm-error-1.txt' FAILED ***
551 # CHECK: $ "rm" "-f" "-v" "temp"
552 # CHECK: # command stderr:
553 # CHECK: Unsupported: 'rm': option -v not recognized
554 # CHECK: error: command failed with exit status: 127
557 # CHECK: FAIL: shtest-shell :: rm-error-2.txt
558 # CHECK: *** TEST 'shtest-shell :: rm-error-2.txt' FAILED ***
559 # CHECK: $ "rm" "-r" "hello"
560 # CHECK: # command stderr:
561 # CHECK: Error: 'rm' command failed
562 # CHECK: error: command failed with exit status: 1
565 # CHECK: FAIL: shtest-shell :: rm-error-3.txt
566 # CHECK: *** TEST 'shtest-shell :: rm-error-3.txt' FAILED ***
567 # CHECK: Exit Code: 1
570 # CHECK: PASS: shtest-shell :: rm-unicode-0.txt
571 # CHECK: PASS: shtest-shell :: sequencing-0.txt
572 # CHECK: XFAIL: shtest-shell :: sequencing-1.txt
574 # CHECK: FAIL: shtest-shell :: stdout-encoding.txt
575 # CHECK: *** TEST 'shtest-shell :: stdout-encoding.txt' FAILED ***
576 # CHECK: $ "cat" "diff-in.bin"
577 # CHECK: # command output:
578 # CHECK-NEXT: {{^.f.o.o.$}}
579 # CHECK-NEXT: {{^.b.a.r..}}
580 # CHECK-NEXT: {{^.b.a.z.$}}
585 # CHECK: PASS: shtest-shell :: valid-shell.txt
586 # CHECK: Failing Tests (35)