tap-no-spurious.sh 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  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. # - don't spuriously recognize lines that are "almost" TAP lines as
  18. # real TAP lines
  19. . test-init.sh
  20. . tap-setup.sh
  21. echo 1..5 > all.test
  22. # The only recognized directives are "TODO" and "SKIP".
  23. # So the following should count as passed tests.
  24. cat >> all.test <<END
  25. ok 1 # XFAIL
  26. ok 2 # SKIPPED
  27. ok 3 # TO DO
  28. ok 4 # TODOALL
  29. ok 5 # FIXME
  30. END
  31. # According to documentation of Test::Harness::TAP(3):
  32. #
  33. # Lines written to standard output matching /^(not )?ok\b/
  34. # must be interpreted as test lines. All other lines must
  35. # not be considered test output.
  36. cat >> all.test <<END
  37. ok
  38. ok 1
  39. ${tab}ok
  40. ${tab}ok 1
  41. not ok
  42. not ok 1
  43. ${tab}not ok
  44. ${tab}not ok 1
  45. notok
  46. notok 1
  47. not${tab}ok
  48. not${tab}ok 1
  49. not ok
  50. not ok 1
  51. no ok
  52. no ok 1
  53. # ok
  54. # not ok
  55. # ok 1
  56. # not ok 1
  57. #ok
  58. #not ok
  59. #ok 1
  60. #not ok 1
  61. END
  62. set +x # Don't pollute logs too much.
  63. for r in 'ok' 'not ok'; do
  64. for s1 in \
  65. a b c d e f g h i j k l m n o p q r s t u v w x y z \
  66. A B C D E F G H I J K L M N O P Q R S T U V W X Y Z \
  67. 0 1 2 3 4 5 6 7 8 9 _ ab 0a 23 a1B2c _o _x_y_
  68. do
  69. for s2 in '' @ % + - = / . : \; \* \? \& \! \# \$ \< \> \\; do
  70. printf '%s\n' "$r$s1$s2"
  71. done
  72. done
  73. done >> all.test
  74. set -x # Reset shell xtraces.
  75. # The prove(1) utility doesn't bail out on these, so our driver
  76. # shouldn't either.
  77. # See comments in 'tap-bailout-leading-space.sh' for an explanation
  78. # of why we don't have a whitespace-prepended "Bail out!" line here.
  79. cat >> all.test <<'END'
  80. bailout
  81. bailout!
  82. bail out
  83. bail out!
  84. Bailout
  85. Bailout!
  86. Bail out
  87. Bail out
  88. #Bail out!
  89. # Bail out!
  90. END
  91. # Debugging info and minor sanity check.
  92. cat all.test \
  93. && test $(grep -c '^ok1$' all.test) -eq 1 \
  94. && test $(grep -c '^not ok1$' all.test) -eq 1 \
  95. || framework_failure_ "creating all.test"
  96. run_make -O check
  97. count_test_results total=5 pass=5 fail=0 xpass=0 xfail=0 skip=0 error=0
  98. :