tap-out-of-order.sh 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. #! /bin/sh
  2. # Copyright (C) 2011-2017 Free Software Foundation, Inc.
  3. #
  4. # This program is free software; you can redistribute it and/or modify
  5. # it under the terms of the GNU General Public License as published by
  6. # the Free Software Foundation; either version 2, or (at your option)
  7. # any later version.
  8. #
  9. # This program is distributed in the hope that it will be useful,
  10. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. # GNU General Public License for more details.
  13. #
  14. # You should have received a copy of the GNU General Public License
  15. # along with this program. If not, see <http://www.gnu.org/licenses/>.
  16. # TAP support:
  17. # - out-of-order test results
  18. . test-init.sh
  19. . tap-setup.sh
  20. cat > a.test <<END
  21. 1..3
  22. ok
  23. not ok 2 # TODO
  24. ok 71
  25. END
  26. cat > b.test <<END
  27. 1..5
  28. ok 1
  29. ok 2
  30. ok 4 foo # SKIP mu
  31. not ok 2 bar # TODO um
  32. ok 5
  33. END
  34. cat > c.test <<END
  35. 1..4
  36. ok 1
  37. ok foo
  38. ok 4 - zardoz
  39. not ok 3
  40. END
  41. # This is documented as an "test out of sequence" error in the
  42. # TAP::Parser documentation. Keep it in sync with the example
  43. # there.
  44. cat > d.test <<'END'
  45. 1..5
  46. ok 1
  47. ok 2
  48. ok 15
  49. ok 16
  50. ok 17
  51. END
  52. run_make -O -e FAIL TESTS='a.test b.test c.test d.test' check
  53. count_test_results total=17 pass=8 fail=0 xpass=0 xfail=1 skip=0 error=8
  54. test $($FGREP -c ': a.test' stdout) -eq 3
  55. test $($FGREP -c ': b.test' stdout) -eq 5
  56. test $($FGREP -c ': c.test' stdout) -eq 4
  57. test $($FGREP -c ': d.test' stdout) -eq 5
  58. grep '^ERROR: a\.test 71 # OUT-OF-ORDER (expecting 3)$' stdout
  59. grep '^ERROR: b\.test 4 foo # OUT-OF-ORDER (expecting 3)$' stdout
  60. grep '^ERROR: b\.test 2 bar # OUT-OF-ORDER (expecting 4)$' stdout
  61. grep '^ERROR: c\.test 4 - zardoz # OUT-OF-ORDER (expecting 3)$' stdout
  62. grep '^ERROR: c\.test 3 # OUT-OF-ORDER (expecting 4)$' stdout
  63. grep '^ERROR: d\.test 15 # OUT-OF-ORDER (expecting 3)$' stdout
  64. grep '^ERROR: d\.test 16 # OUT-OF-ORDER (expecting 4)$' stdout
  65. grep '^ERROR: d\.test 17 # OUT-OF-ORDER (expecting 5)$' stdout
  66. :