shtest-shell.py 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230
  1. # Check the internal shell handling component of the ShTest format.
  2. #
  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
  5. # buildbots.
  6. # RUN: cat %t.out
  7. # RUN: FileCheck --input-file %t.out %s
  8. #
  9. # END.
  10. # CHECK: -- Testing:
  11. # CHECK: FAIL: shtest-shell :: cat-error-0.txt
  12. # CHECK: *** TEST 'shtest-shell :: cat-error-0.txt' FAILED ***
  13. # CHECK: $ "cat" "-b" "temp1.txt"
  14. # CHECK: # command stderr:
  15. # CHECK: Unsupported: 'cat': option -b not recognized
  16. # CHECK: error: command failed with exit status: 1
  17. # CHECK: ***
  18. # CHECK: FAIL: shtest-shell :: cat-error-1.txt
  19. # CHECK: *** TEST 'shtest-shell :: cat-error-1.txt' FAILED ***
  20. # CHECK: $ "cat" "temp1.txt"
  21. # CHECK: # command stderr:
  22. # CHECK: [Errno 2] No such file or directory: 'temp1.txt'
  23. # CHECK: error: command failed with exit status: 1
  24. # CHECK: ***
  25. # CHECK: FAIL: shtest-shell :: colon-error.txt
  26. # CHECK: *** TEST 'shtest-shell :: colon-error.txt' FAILED ***
  27. # CHECK: $ ":"
  28. # CHECK: # command stderr:
  29. # CHECK: Unsupported: ':' cannot be part of a pipeline
  30. # CHECK: error: command failed with exit status: 127
  31. # CHECK: ***
  32. # CHECK: FAIL: shtest-shell :: diff-error-0.txt
  33. # CHECK: *** TEST 'shtest-shell :: diff-error-0.txt' FAILED ***
  34. # CHECK: $ "diff" "diff-error-0.txt" "diff-error-0.txt"
  35. # CHECK: # command stderr:
  36. # CHECK: Unsupported: 'diff' cannot be part of a pipeline
  37. # CHECK: error: command failed with exit status: 127
  38. # CHECK: ***
  39. # CHECK: FAIL: shtest-shell :: diff-error-1.txt
  40. # CHECK: *** TEST 'shtest-shell :: diff-error-1.txt' FAILED ***
  41. # CHECK: $ "diff" "-B" "temp1.txt" "temp2.txt"
  42. # CHECK: # command stderr:
  43. # CHECK: Unsupported: 'diff': option -B not recognized
  44. # CHECK: error: command failed with exit status: 127
  45. # CHECK: ***
  46. # CHECK: FAIL: shtest-shell :: diff-error-2.txt
  47. # CHECK: *** TEST 'shtest-shell :: diff-error-2.txt' FAILED ***
  48. # CHECK: $ "diff" "temp.txt"
  49. # CHECK: # command stderr:
  50. # CHECK: Error: missing or extra operand
  51. # CHECK: error: command failed with exit status: 127
  52. # CHECK: ***
  53. # CHECK: FAIL: shtest-shell :: diff-error-3.txt
  54. # CHECK: *** TEST 'shtest-shell :: diff-error-3.txt' FAILED ***
  55. # CHECK: $ "diff" "temp.txt" "temp1.txt"
  56. # CHECK: # command stderr:
  57. # CHECK: Error: 'diff' command failed
  58. # CHECK: error: command failed with exit status: 1
  59. # CHECK: ***
  60. # CHECK: FAIL: shtest-shell :: diff-error-4.txt
  61. # CHECK: *** TEST 'shtest-shell :: diff-error-4.txt' FAILED ***
  62. # CHECK: Exit Code: 1
  63. # CHECK: # command output:
  64. # CHECK: diff-error-4.txt.tmp
  65. # CHECK: diff-error-4.txt.tmp1
  66. # CHECK: *** 1 ****
  67. # CHECK: ! hello-first
  68. # CHECK: --- 1 ----
  69. # CHECK: ! hello-second
  70. # CHECK: ***
  71. # CHECK: FAIL: shtest-shell :: diff-error-5.txt
  72. # CHECK: *** TEST 'shtest-shell :: diff-error-5.txt' FAILED ***
  73. # CHECK: $ "diff"
  74. # CHECK: # command stderr:
  75. # CHECK: Error: missing or extra operand
  76. # CHECK: error: command failed with exit status: 127
  77. # CHECK: ***
  78. # CHECK: FAIL: shtest-shell :: diff-error-6.txt
  79. # CHECK: *** TEST 'shtest-shell :: diff-error-6.txt' FAILED ***
  80. # CHECK: $ "diff"
  81. # CHECK: # command stderr:
  82. # CHECK: Error: missing or extra operand
  83. # CHECK: error: command failed with exit status: 127
  84. # CHECK: ***
  85. # CHECK: FAIL: shtest-shell :: diff-r-error-0.txt
  86. # CHECK: *** TEST 'shtest-shell :: diff-r-error-0.txt' FAILED ***
  87. # CEHCK: $ "diff" "-r"
  88. # CHECK: # command output:
  89. # CHECK: Only in {{.*}}dir1: dir1unique
  90. # CHECK: Only in {{.*}}dir2: dir2unique
  91. # CHECK: error: command failed with exit status: 1
  92. # CHECK: FAIL: shtest-shell :: diff-r-error-1.txt
  93. # CHECK: *** TEST 'shtest-shell :: diff-r-error-1.txt' FAILED ***
  94. # CEHCK: $ "diff" "-r"
  95. # CHECK: # command output:
  96. # CHECK: *** {{.*}}dir1{{.*}}subdir{{.*}}f01
  97. # CHECK: --- {{.*}}dir2{{.*}}subdir{{.*}}f01
  98. # CHECK: 12345
  99. # CHECK: 00000
  100. # CHECK: error: command failed with exit status: 1
  101. # CHECK: FAIL: shtest-shell :: diff-r-error-2.txt
  102. # CHECK: *** TEST 'shtest-shell :: diff-r-error-2.txt' FAILED ***
  103. # CEHCK: $ "diff" "-r"
  104. # CHECK: # command output:
  105. # CHECK: Only in {{.*}}dir2: extrafile
  106. # CHECK: error: command failed with exit status: 1
  107. # CHECK: FAIL: shtest-shell :: diff-r-error-3.txt
  108. # CHECK: *** TEST 'shtest-shell :: diff-r-error-3.txt' FAILED ***
  109. # CEHCK: $ "diff" "-r"
  110. # CHECK: # command output:
  111. # CHECK: Only in {{.*}}dir1: extra_subdir
  112. # CHECK: error: command failed with exit status: 1
  113. # CHECK: FAIL: shtest-shell :: diff-r-error-4.txt
  114. # CHECK: *** TEST 'shtest-shell :: diff-r-error-4.txt' FAILED ***
  115. # CEHCK: $ "diff" "-r"
  116. # CHECK: # command output:
  117. # CHECK: File {{.*}}dir1{{.*}}extra_subdir is a directory while file {{.*}}dir2{{.*}}extra_subdir is a regular file
  118. # CHECK: error: command failed with exit status: 1
  119. # CHECK: FAIL: shtest-shell :: diff-r-error-5.txt
  120. # CHECK: *** TEST 'shtest-shell :: diff-r-error-5.txt' FAILED ***
  121. # CEHCK: $ "diff" "-r"
  122. # CHECK: # command output:
  123. # CHECK: Only in {{.*}}dir1: extra_subdir
  124. # CHECK: error: command failed with exit status: 1
  125. # CHECK: FAIL: shtest-shell :: diff-r-error-6.txt
  126. # CHECK: *** TEST 'shtest-shell :: diff-r-error-6.txt' FAILED ***
  127. # CEHCK: $ "diff" "-r"
  128. # CHECK: # command output:
  129. # CHECK: File {{.*}}dir1{{.*}}extra_file is a regular empty file while file {{.*}}dir2{{.*}}extra_file is a directory
  130. # CHECK: error: command failed with exit status: 1
  131. # CHECK: PASS: shtest-shell :: diff-r.txt
  132. # CHECK: FAIL: shtest-shell :: error-0.txt
  133. # CHECK: *** TEST 'shtest-shell :: error-0.txt' FAILED ***
  134. # CHECK: $ "not-a-real-command"
  135. # CHECK: # command stderr:
  136. # CHECK: 'not-a-real-command': command not found
  137. # CHECK: error: command failed with exit status: 127
  138. # CHECK: ***
  139. # FIXME: The output here sucks.
  140. #
  141. # CHECK: FAIL: shtest-shell :: error-1.txt
  142. # CHECK: *** TEST 'shtest-shell :: error-1.txt' FAILED ***
  143. # CHECK: shell parser error on: ': \'RUN: at line 3\'; echo "missing quote'
  144. # CHECK: ***
  145. # CHECK: FAIL: shtest-shell :: error-2.txt
  146. # CHECK: *** TEST 'shtest-shell :: error-2.txt' FAILED ***
  147. # CHECK: Unsupported redirect:
  148. # CHECK: ***
  149. # CHECK: FAIL: shtest-shell :: mkdir-error-0.txt
  150. # CHECK: *** TEST 'shtest-shell :: mkdir-error-0.txt' FAILED ***
  151. # CHECK: $ "mkdir" "-p" "temp"
  152. # CHECK: # command stderr:
  153. # CHECK: Unsupported: 'mkdir' cannot be part of a pipeline
  154. # CHECK: error: command failed with exit status: 127
  155. # CHECK: ***
  156. # CHECK: FAIL: shtest-shell :: mkdir-error-1.txt
  157. # CHECK: *** TEST 'shtest-shell :: mkdir-error-1.txt' FAILED ***
  158. # CHECK: $ "mkdir" "-p" "-m" "777" "temp"
  159. # CHECK: # command stderr:
  160. # CHECK: Unsupported: 'mkdir': option -m not recognized
  161. # CHECK: error: command failed with exit status: 127
  162. # CHECK: ***
  163. # CHECK: FAIL: shtest-shell :: mkdir-error-2.txt
  164. # CHECK: *** TEST 'shtest-shell :: mkdir-error-2.txt' FAILED ***
  165. # CHECK: $ "mkdir" "-p"
  166. # CHECK: # command stderr:
  167. # CHECK: Error: 'mkdir' is missing an operand
  168. # CHECK: error: command failed with exit status: 127
  169. # CHECK: ***
  170. # CHECK: PASS: shtest-shell :: redirects.txt
  171. # CHECK: FAIL: shtest-shell :: rm-error-0.txt
  172. # CHECK: *** TEST 'shtest-shell :: rm-error-0.txt' FAILED ***
  173. # CHECK: $ "rm" "-rf" "temp"
  174. # CHECK: # command stderr:
  175. # CHECK: Unsupported: 'rm' cannot be part of a pipeline
  176. # CHECK: error: command failed with exit status: 127
  177. # CHECK: ***
  178. # CHECK: FAIL: shtest-shell :: rm-error-1.txt
  179. # CHECK: *** TEST 'shtest-shell :: rm-error-1.txt' FAILED ***
  180. # CHECK: $ "rm" "-f" "-v" "temp"
  181. # CHECK: # command stderr:
  182. # CHECK: Unsupported: 'rm': option -v not recognized
  183. # CHECK: error: command failed with exit status: 127
  184. # CHECK: ***
  185. # CHECK: FAIL: shtest-shell :: rm-error-2.txt
  186. # CHECK: *** TEST 'shtest-shell :: rm-error-2.txt' FAILED ***
  187. # CHECK: $ "rm" "-r" "hello"
  188. # CHECK: # command stderr:
  189. # CHECK: Error: 'rm' command failed
  190. # CHECK: error: command failed with exit status: 1
  191. # CHECK: ***
  192. # CHECK: FAIL: shtest-shell :: rm-error-3.txt
  193. # CHECK: *** TEST 'shtest-shell :: rm-error-3.txt' FAILED ***
  194. # CHECK: Exit Code: 1
  195. # CHECK: ***
  196. # CHECK: PASS: shtest-shell :: sequencing-0.txt
  197. # CHECK: XFAIL: shtest-shell :: sequencing-1.txt
  198. # CHECK: PASS: shtest-shell :: valid-shell.txt
  199. # CHECK: Failing Tests (27)