shtest-shell.py 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152
  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 :: diff-error-0.txt
  12. # CHECK: *** TEST 'shtest-shell :: diff-error-0.txt' FAILED ***
  13. # CHECK: $ "diff" "diff-error-0.txt" "diff-error-0.txt"
  14. # CHECK: # command stderr:
  15. # CHECK: Unsupported: 'diff' cannot be part of a pipeline
  16. # CHECK: error: command failed with exit status: 127
  17. # CHECK: ***
  18. # CHECK: FAIL: shtest-shell :: diff-error-1.txt
  19. # CHECK: *** TEST 'shtest-shell :: diff-error-1.txt' FAILED ***
  20. # CHECK: $ "diff" "-B" "temp1.txt" "temp2.txt"
  21. # CHECK: # command stderr:
  22. # CHECK: Unsupported: 'diff': option -B not recognized
  23. # CHECK: error: command failed with exit status: 127
  24. # CHECK: ***
  25. # CHECK: FAIL: shtest-shell :: diff-error-2.txt
  26. # CHECK: *** TEST 'shtest-shell :: diff-error-2.txt' FAILED ***
  27. # CHECK: $ "diff" "temp.txt"
  28. # CHECK: # command stderr:
  29. # CHECK: Error: missing or extra operand
  30. # CHECK: error: command failed with exit status: 127
  31. # CHECK: ***
  32. # CHECK: FAIL: shtest-shell :: diff-error-3.txt
  33. # CHECK: *** TEST 'shtest-shell :: diff-error-3.txt' FAILED ***
  34. # CHECK: $ "diff" "temp.txt" "temp1.txt"
  35. # CHECK: # command stderr:
  36. # CHECK: Error: 'diff' command failed
  37. # CHECK: error: command failed with exit status: 1
  38. # CHECK: ***
  39. # CHECK: FAIL: shtest-shell :: diff-error-4.txt
  40. # CHECK: *** TEST 'shtest-shell :: diff-error-4.txt' FAILED ***
  41. # CHECK: Exit Code: 1
  42. # CHECK: # command output:
  43. # CHECK: diff-error-4.txt.tmp
  44. # CHECK: diff-error-4.txt.tmp1
  45. # CHECK: *** 1 ****
  46. # CHECK: ! hello-first
  47. # CHECK: --- 1 ----
  48. # CHECK: ! hello-second
  49. # CHECK: ***
  50. # CHECK: FAIL: shtest-shell :: diff-error-5.txt
  51. # CHECK: *** TEST 'shtest-shell :: diff-error-5.txt' FAILED ***
  52. # CHECK: $ "diff"
  53. # CHECK: # command stderr:
  54. # CHECK: Error: missing or extra operand
  55. # CHECK: error: command failed with exit status: 127
  56. # CHECK: ***
  57. # CHECK: FAIL: shtest-shell :: diff-error-6.txt
  58. # CHECK: *** TEST 'shtest-shell :: diff-error-6.txt' FAILED ***
  59. # CHECK: $ "diff"
  60. # CHECK: # command stderr:
  61. # CHECK: Error: missing or extra operand
  62. # CHECK: error: command failed with exit status: 127
  63. # CHECK: ***
  64. # CHECK: FAIL: shtest-shell :: error-0.txt
  65. # CHECK: *** TEST 'shtest-shell :: error-0.txt' FAILED ***
  66. # CHECK: $ "not-a-real-command"
  67. # CHECK: # command stderr:
  68. # CHECK: 'not-a-real-command': command not found
  69. # CHECK: error: command failed with exit status: 127
  70. # CHECK: ***
  71. # FIXME: The output here sucks.
  72. #
  73. # CHECK: FAIL: shtest-shell :: error-1.txt
  74. # CHECK: *** TEST 'shtest-shell :: error-1.txt' FAILED ***
  75. # CHECK: shell parser error on: 'echo "missing quote'
  76. # CHECK: ***
  77. # CHECK: FAIL: shtest-shell :: error-2.txt
  78. # CHECK: *** TEST 'shtest-shell :: error-2.txt' FAILED ***
  79. # CHECK: Unsupported redirect:
  80. # CHECK: ***
  81. # CHECK: FAIL: shtest-shell :: mkdir-error-0.txt
  82. # CHECK: *** TEST 'shtest-shell :: mkdir-error-0.txt' FAILED ***
  83. # CHECK: $ "mkdir" "-p" "temp"
  84. # CHECK: # command stderr:
  85. # CHECK: Unsupported: 'mkdir' cannot be part of a pipeline
  86. # CHECK: error: command failed with exit status: 127
  87. # CHECK: ***
  88. # CHECK: FAIL: shtest-shell :: mkdir-error-1.txt
  89. # CHECK: *** TEST 'shtest-shell :: mkdir-error-1.txt' FAILED ***
  90. # CHECK: $ "mkdir" "-p" "-m" "777" "temp"
  91. # CHECK: # command stderr:
  92. # CHECK: Unsupported: 'mkdir': option -m not recognized
  93. # CHECK: error: command failed with exit status: 127
  94. # CHECK: ***
  95. # CHECK: FAIL: shtest-shell :: mkdir-error-2.txt
  96. # CHECK: *** TEST 'shtest-shell :: mkdir-error-2.txt' FAILED ***
  97. # CHECK: $ "mkdir" "-p"
  98. # CHECK: # command stderr:
  99. # CHECK: Error: 'mkdir' is missing an operand
  100. # CHECK: error: command failed with exit status: 127
  101. # CHECK: ***
  102. # CHECK: PASS: shtest-shell :: redirects.txt
  103. # CHECK: FAIL: shtest-shell :: rm-error-0.txt
  104. # CHECK: *** TEST 'shtest-shell :: rm-error-0.txt' FAILED ***
  105. # CHECK: $ "rm" "-rf" "temp"
  106. # CHECK: # command stderr:
  107. # CHECK: Unsupported: 'rm' cannot be part of a pipeline
  108. # CHECK: error: command failed with exit status: 127
  109. # CHECK: ***
  110. # CHECK: FAIL: shtest-shell :: rm-error-1.txt
  111. # CHECK: *** TEST 'shtest-shell :: rm-error-1.txt' FAILED ***
  112. # CHECK: $ "rm" "-f" "-v" "temp"
  113. # CHECK: # command stderr:
  114. # CHECK: Unsupported: 'rm': option -v not recognized
  115. # CHECK: error: command failed with exit status: 127
  116. # CHECK: ***
  117. # CHECK: FAIL: shtest-shell :: rm-error-2.txt
  118. # CHECK: *** TEST 'shtest-shell :: rm-error-2.txt' FAILED ***
  119. # CHECK: $ "rm" "-r" "hello"
  120. # CHECK: # command stderr:
  121. # CHECK: Error: 'rm' command failed
  122. # CHECK: error: command failed with exit status: 1
  123. # CHECK: ***
  124. # CHECK: FAIL: shtest-shell :: rm-error-3.txt
  125. # CHECK: *** TEST 'shtest-shell :: rm-error-3.txt' FAILED ***
  126. # CHECK: Exit Code: 1
  127. # CHECK: ***
  128. # CHECK: PASS: shtest-shell :: sequencing-0.txt
  129. # CHECK: XFAIL: shtest-shell :: sequencing-1.txt
  130. # CHECK: PASS: shtest-shell :: valid-shell.txt
  131. # CHECK: Failing Tests (17)