2
0

tap-planskip.sh 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  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. # Basic TAP test protocol support:
  17. # - special plan format to skip all the tests in a script
  18. . test-init.sh
  19. . tap-setup.sh
  20. weirdchars=\''"$!&()[]<>#;^?*/@%=,.:'
  21. cat > foo.test <<END
  22. 1..0
  23. END
  24. cat > bar.test <<END
  25. blah
  26. # blah
  27. 1..0$tab $tab
  28. END
  29. # It is undefined whether the comment after the plan below should
  30. # count as an explanation; still, the test should be skipped.
  31. cat > baz.test <<END
  32. 1..0 # WWW::Mechanize not installed
  33. other
  34. junk
  35. lines
  36. END
  37. cat > wget.test <<END
  38. 1..0 # SKIP wget(1) not installed
  39. # See also curl.test
  40. END
  41. cat > curl.test <<END
  42. 1..0 # SKIP: Can't connect to gnu.org!
  43. # See also wget.test
  44. END
  45. cat > mu.test <<END
  46. 1..0 # SKIP $weirdchars
  47. END
  48. run_make -O check \
  49. TESTS='foo.test bar.test baz.test wget.test curl.test mu.test'
  50. count_test_results total=6 pass=0 fail=0 xpass=0 xfail=0 skip=6 error=0
  51. # Look for a regression where the "1..0" wasn't being stripped from the
  52. # SKIP message.
  53. $FGREP '1..0' stdout && exit 1
  54. grep '^SKIP: foo\.test$' stdout
  55. grep '^SKIP: bar\.test$' stdout
  56. grep '^SKIP: baz\.test' stdout # Deliberately laxer, see above for why.
  57. grep '^SKIP: wget\.test .* wget(1) not installed$' stdout
  58. grep '^SKIP: curl\.test .* Can'\''t connect to gnu\.org!$' stdout
  59. grep '^SKIP: mu\.test' stdout | $FGREP "$weirdchars" stdout
  60. test $(grep -c ': .*\.test' stdout) -eq 6
  61. :