tap-todo-skip.sh 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  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. # - TODO and SKIP directives are case-insensitive
  18. # - TODO and SKIP directives can be followed optionally by a colon ":"
  19. # and by an optional explanation.
  20. # - our driver isn't fooled into recognizing TODO and SKIP directives
  21. # spuriously
  22. # - the reasons for TODO and SKIP, if present, are nicely printed in
  23. # the testsuite progress output
  24. . test-init.sh
  25. . tap-setup.sh
  26. # ----------------------------------------------------- #
  27. # Check all possible combinations of: #
  28. # - uppercase/lowercase #
  29. # - with/without colon character ":" #
  30. # - with/without explanatory message #
  31. # in TODO and SKIP directives. #
  32. # ----------------------------------------------------- #
  33. # There are 2 * 2^6 + 2 * 2^6 = 256 tests.
  34. echo 1..256 > all.test
  35. # These nested loops are clearer without indentation.
  36. for c1 in t T; do
  37. for c2 in o O; do
  38. for c3 in d D; do
  39. for c4 in o O; do
  40. for ex in '' ':' ' foo' ': foo'; do
  41. echo "not ok # $c1$c2$c3$c4$ex"
  42. echo "not ok# $c1$c2$c3$c4$ex"
  43. done; done; done; done; done >> all.test
  44. for c1 in s S; do
  45. for c2 in k K; do
  46. for c3 in i I; do
  47. for c4 in p P; do
  48. for ex in '' ':' ' foo' ': foo'; do
  49. echo "ok # $c1$c2$c3$c4$ex"
  50. echo "ok# $c1$c2$c3$c4$ex"
  51. done; done; done; done; done >> all.test
  52. cat all.test # For debugging.
  53. run_make -O check
  54. count_test_results total=256 pass=0 fail=0 xpass=0 xfail=128 skip=128 error=0
  55. # -------------------------------------------------------- #
  56. # TODO ans SKIP directives aren't recognized spuriously. #
  57. # -------------------------------------------------------- #
  58. cat > all.test <<'END'
  59. 1..9
  60. ok TODO
  61. ok - TODO
  62. ok 3 TODO
  63. ok 4 - TODO
  64. ok SKIP
  65. ok - SKIP
  66. ok 7 SKIP
  67. ok 8 - SKIP
  68. ok 9
  69. END
  70. run_make -O check
  71. count_test_results total=9 pass=9 fail=0 xpass=0 xfail=0 skip=0 error=0
  72. :