tap-no-spurious-numbers.sh 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  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. # - we shouldn't spuriously recognize as TAP result numbers what it
  18. # not, even if it seems pretty close
  19. . test-init.sh
  20. . tap-setup.sh
  21. cat > prefixes <<'END'
  22. A
  23. a
  24. _
  25. +
  26. -
  27. =
  28. /
  29. *
  30. .
  31. :
  32. ,
  33. ;
  34. $
  35. @
  36. %
  37. &
  38. #
  39. ?
  40. !
  41. |
  42. \
  43. "
  44. `
  45. '
  46. (
  47. )
  48. [
  49. ]
  50. {
  51. }
  52. <
  53. >
  54. END
  55. n=$(wc -l <prefixes)
  56. # See the loop below to understand this initialization.
  57. pass=$(($n * 3))
  58. fail=$pass
  59. skip=$(($pass - 3))
  60. xfail=$skip
  61. xpass=$xfail
  62. error=0
  63. total=$(($pass + $fail + $skip + $xfail + $xpass))
  64. echo 1..$total > all.test
  65. highno=1000
  66. for result in 'ok' 'not ok'; do
  67. for spacing in "" " " "$tab"; do
  68. subst="$result &$spacing$higno"
  69. sed -e "s|.*|$subst|" prefixes
  70. for directive in TODO SKIP; do
  71. test "$result $directive" != "not ok SKIP" || continue
  72. sed -e '/^#$/d' -e "s|.*|$subst # $directive|" prefixes
  73. done
  74. done
  75. done >> all.test
  76. cat all.test # For debugging.
  77. # Sanity checks.
  78. grep '#.*#' all.test \
  79. && framework_failure_ "creating all.test"
  80. test $(wc -l <all.test) -lt $highno \
  81. || framework_failure_ "creating all.test"
  82. run_make -O -e IGNORE check
  83. count_test_results total=$total pass=$pass fail=$fail skip=$skip \
  84. xpass=$xpass xfail=$xfail error=$error
  85. :