shtest-format.py 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170
  1. # Check the various features of the ShTest format.
  2. #
  3. # RUN: rm -f %t.xml
  4. # RUN: not %{lit} -j 1 -v %{inputs}/shtest-format --xunit-xml-output %t.xml > %t.out
  5. # RUN: FileCheck < %t.out %s
  6. # RUN: FileCheck --check-prefix=XUNIT < %t.xml %s
  7. # END.
  8. # CHECK: -- Testing:
  9. # CHECK: PASS: shtest-format :: argv0.txt
  10. # CHECK: FAIL: shtest-format :: external_shell/fail.txt
  11. # CHECK-NEXT: *** TEST 'shtest-format :: external_shell/fail.txt' FAILED ***
  12. # CHECK: Command Output (stdout):
  13. # CHECK-NEXT: --
  14. # CHECK-NEXT: line 1: failed test output on stdout
  15. # CHECK-NEXT: line 2: failed test output on stdout
  16. # CHECK: Command Output (stderr):
  17. # CHECK-NEXT: --
  18. # CHECK-NEXT: cat{{(\.exe)?}}: {{cannot open does-not-exist|does-not-exist: No such file or directory}}
  19. # CHECK: --
  20. # CHECK: FAIL: shtest-format :: external_shell/fail_with_bad_encoding.txt
  21. # CHECK-NEXT: *** TEST 'shtest-format :: external_shell/fail_with_bad_encoding.txt' FAILED ***
  22. # CHECK: Command Output (stdout):
  23. # CHECK-NEXT: --
  24. # CHECK-NEXT: a line with bad encoding:
  25. # CHECK: --
  26. # CHECK: PASS: shtest-format :: external_shell/pass.txt
  27. # CHECK: FAIL: shtest-format :: fail.txt
  28. # CHECK-NEXT: *** TEST 'shtest-format :: fail.txt' FAILED ***
  29. # CHECK-NEXT: Script:
  30. # CHECK-NEXT: --
  31. # CHECK-NEXT: printf "line 1
  32. # CHECK-NEXT: false
  33. # CHECK-NEXT: --
  34. # CHECK-NEXT: Exit Code: 1
  35. #
  36. # CHECK: Command Output (stdout):
  37. # CHECK-NEXT: --
  38. # CHECK-NEXT: $ ":" "RUN: at line 1"
  39. # CHECK-NEXT: $ "printf"
  40. # CHECK-NEXT: # command output:
  41. # CHECK-NEXT: line 1: failed test output on stdout
  42. # CHECK-NEXT: line 2: failed test output on stdout
  43. # CHECK: UNRESOLVED: shtest-format :: no-test-line.txt
  44. # CHECK: PASS: shtest-format :: pass.txt
  45. # CHECK: UNSUPPORTED: shtest-format :: requires-any-missing.txt
  46. # CHECK: PASS: shtest-format :: requires-any-present.txt
  47. # CHECK: UNSUPPORTED: shtest-format :: requires-missing.txt
  48. # CHECK: PASS: shtest-format :: requires-present.txt
  49. # CHECK: UNRESOLVED: shtest-format :: requires-star.txt
  50. # CHECK: UNSUPPORTED: shtest-format :: requires-triple.txt
  51. # CHECK: PASS: shtest-format :: unsupported-expr-false.txt
  52. # CHECK: UNSUPPORTED: shtest-format :: unsupported-expr-true.txt
  53. # CHECK: UNRESOLVED: shtest-format :: unsupported-star.txt
  54. # CHECK: UNSUPPORTED: shtest-format :: unsupported_dir/some-test.txt
  55. # CHECK: PASS: shtest-format :: xfail-expr-false.txt
  56. # CHECK: XFAIL: shtest-format :: xfail-expr-true.txt
  57. # CHECK: XFAIL: shtest-format :: xfail-feature.txt
  58. # CHECK: XFAIL: shtest-format :: xfail-target.txt
  59. # CHECK: XFAIL: shtest-format :: xfail.txt
  60. # CHECK: XPASS: shtest-format :: xpass.txt
  61. # CHECK-NEXT: *** TEST 'shtest-format :: xpass.txt' FAILED ***
  62. # CHECK-NEXT: Script
  63. # CHECK-NEXT: --
  64. # CHECK-NEXT: true
  65. # CHECK-NEXT: --
  66. # CHECK: Testing Time
  67. # CHECK: Unexpected Passing Tests (1)
  68. # CHECK: shtest-format :: xpass.txt
  69. # CHECK: Failing Tests (3)
  70. # CHECK: shtest-format :: external_shell/fail.txt
  71. # CHECK: shtest-format :: external_shell/fail_with_bad_encoding.txt
  72. # CHECK: shtest-format :: fail.txt
  73. # CHECK: Expected Passes : 8
  74. # CHECK: Expected Failures : 4
  75. # CHECK: Unsupported Tests : 5
  76. # CHECK: Unresolved Tests : 3
  77. # CHECK: Unexpected Passes : 1
  78. # CHECK: Unexpected Failures: 3
  79. # XUNIT: <?xml version="1.0" encoding="UTF-8" ?>
  80. # XUNIT-NEXT: <testsuites>
  81. # XUNIT-NEXT: <testsuite name="shtest-format" tests="24" failures="7" skipped="5">
  82. # XUNIT: <testcase classname="shtest-format.shtest-format" name="argv0.txt" time="{{[0-9]+\.[0-9]+}}"/>
  83. # XUNIT: <testcase classname="shtest-format.external_shell" name="fail.txt" time="{{[0-9]+\.[0-9]+}}">
  84. # XUNIT-NEXT: <failure{{[ ]*}}>
  85. # XUNIT: </failure>
  86. # XUNIT-NEXT: </testcase>
  87. # XUNIT: <testcase classname="shtest-format.external_shell" name="fail_with_bad_encoding.txt" time="{{[0-9]+\.[0-9]+}}">
  88. # XUNIT-NEXT: <failure{{[ ]*}}>
  89. # XUNIT: </failure>
  90. # XUNIT-NEXT: </testcase>
  91. # XUNIT: <testcase classname="shtest-format.external_shell" name="pass.txt" time="{{[0-9]+\.[0-9]+}}"/>
  92. # XUNIT: <testcase classname="shtest-format.shtest-format" name="fail.txt" time="{{[0-9]+\.[0-9]+}}">
  93. # XUNIT-NEXT: <failure{{[ ]*}}>
  94. # XUNIT: </failure>
  95. # XUNIT-NEXT: </testcase>
  96. # XUNIT: <testcase classname="shtest-format.shtest-format" name="no-test-line.txt" time="{{[0-9]+\.[0-9]+}}">
  97. # XUNIT-NEXT: <failure{{[ ]*}}>
  98. # XUNIT: </failure>
  99. # XUNIT-NEXT: </testcase>
  100. # XUNIT: <testcase classname="shtest-format.shtest-format" name="pass.txt" time="{{[0-9]+\.[0-9]+}}"/>
  101. # XUNIT: <testcase classname="shtest-format.shtest-format" name="requires-any-missing.txt" time="{{[0-9]+\.[0-9]+}}">
  102. # XUNIT-NEXT:<skipped message="Skipping because of: a-missing-feature || a-missing-feature-2" />
  103. # XUNIT: <testcase classname="shtest-format.shtest-format" name="requires-any-present.txt" time="{{[0-9]+\.[0-9]+}}"/>
  104. # XUNIT: <testcase classname="shtest-format.shtest-format" name="requires-missing.txt" time="{{[0-9]+\.[0-9]+}}">
  105. # XUNIT-NEXT:<skipped message="Skipping because of: a-missing-feature" />
  106. # XUNIT: <testcase classname="shtest-format.shtest-format" name="requires-present.txt" time="{{[0-9]+\.[0-9]+}}"/>
  107. # XUNIT: <testcase classname="shtest-format.shtest-format" name="requires-star.txt" time="{{[0-9]+\.[0-9]+}}">
  108. # XUNIT-NEXT: <failure{{[ ]*}}>
  109. # XUNIT: </failure>
  110. # XUNIT-NEXT: </testcase>
  111. # XUNIT: <testcase classname="shtest-format.shtest-format" name="requires-triple.txt" time="{{[0-9]+\.[0-9]+}}">
  112. # XUNIT-NEXT:<skipped message="Skipping because of: x86_64" />
  113. # XUNIT: <testcase classname="shtest-format.shtest-format" name="unsupported-expr-false.txt" time="{{[0-9]+\.[0-9]+}}"/>
  114. # XUNIT: <testcase classname="shtest-format.shtest-format" name="unsupported-expr-true.txt" time="{{[0-9]+\.[0-9]+}}">
  115. # XUNIT-NEXT:<skipped message="Skipping because of configuration." />
  116. # XUNIT: <testcase classname="shtest-format.shtest-format" name="unsupported-star.txt" time="{{[0-9]+\.[0-9]+}}">
  117. # XUNIT-NEXT: <failure{{[ ]*}}>
  118. # XUNIT: </failure>
  119. # XUNIT-NEXT: </testcase>
  120. # XUNIT: <testcase classname="shtest-format.unsupported_dir" name="some-test.txt" time="{{[0-9]+\.[0-9]+}}">
  121. # XUNIT-NEXT:<skipped message="Skipping because of configuration." />
  122. # XUNIT: <testcase classname="shtest-format.shtest-format" name="xfail-expr-false.txt" time="{{[0-9]+\.[0-9]+}}"/>
  123. # XUNIT: <testcase classname="shtest-format.shtest-format" name="xfail-expr-true.txt" time="{{[0-9]+\.[0-9]+}}"/>
  124. # XUNIT: <testcase classname="shtest-format.shtest-format" name="xfail-feature.txt" time="{{[0-9]+\.[0-9]+}}"/>
  125. # XUNIT: <testcase classname="shtest-format.shtest-format" name="xfail-target.txt" time="{{[0-9]+\.[0-9]+}}"/>
  126. # XUNIT: <testcase classname="shtest-format.shtest-format" name="xfail.txt" time="{{[0-9]+\.[0-9]+}}"/>
  127. # XUNIT: <testcase classname="shtest-format.shtest-format" name="xpass.txt" time="{{[0-9]+\.[0-9]+}}">
  128. # XUNIT-NEXT: <failure{{[ ]*}}>
  129. # XUNIT: </failure>
  130. # XUNIT-NEXT: </testcase>
  131. # XUNIT: </testsuite>
  132. # XUNIT-NEXT: </testsuites>