tap-bailout-suppress-later-errors.sh 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  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. # - A "Bail out!" directive causes the driver to ignore any TAP
  18. # result or error in the rest of the following TAP stream.
  19. . test-init.sh
  20. . tap-setup.sh
  21. # Various errors that can all be squashed into a single test script.
  22. cat > foo.test << 'END'
  23. 1..5
  24. Bail out!
  25. # All possible test results.
  26. # Test out-of-order.
  27. ok 4
  28. # Extra TAP plan.
  29. 1..2
  30. # Another bailout directive.
  31. Bail out! Not seen.
  32. # Stop now, with too few tests run.
  33. END
  34. # Tests run after a "SKIP" plan.
  35. cat > bar.test << 'END'
  36. 1..0 # SKIP
  37. Bail out!
  38. ok 1
  39. END
  40. # Too many tests run.
  41. cat > baz.test << 'END'
  42. 1..1
  43. ok 1
  44. Bail out!
  45. ok 2
  46. ok 3
  47. END
  48. run_make -e FAIL -O TESTS='foo.test bar.test baz.test' check
  49. count_test_results total=5 pass=1 fail=0 xpass=0 xfail=0 skip=1 error=3
  50. grep '^ERROR: foo\.test - Bail out!$' stdout
  51. grep '^ERROR: bar\.test - Bail out!$' stdout
  52. grep '^SKIP: bar\.test' stdout
  53. grep '^ERROR: baz\.test - Bail out!$' stdout
  54. grep '^PASS: baz\.test 1$' stdout
  55. $FGREP 'Not seen' stdout && exit 1
  56. test $($FGREP -c ': foo.test' stdout) -eq 1
  57. test $($FGREP -c ': bar.test' stdout) -eq 2
  58. test $($FGREP -c ': baz.test' stdout) -eq 2
  59. :