parallel-tests-html.sh 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  1. #! /bin/sh
  2. # Copyright (C) 2009-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. # Check parallel-tests features:
  17. # - check-html
  18. # - recheck-html
  19. . test-init.sh
  20. # Try the variants that are tried in check-html.am.
  21. while :; do
  22. for r2h in $RST2HTML rst2html rst2html.py; do
  23. echo "$me: running $r2h --version"
  24. $r2h --version && break 2
  25. : For shells with busted 'set -e'.
  26. done
  27. skip_all_ "no proper rst2html program found"
  28. done
  29. unset r2h
  30. cp "$am_top_srcdir"/contrib/check-html.am . \
  31. || fatal_ "cannot fetch 'check-html.am' from contrib"
  32. cat >> configure.ac << 'END'
  33. AC_OUTPUT
  34. END
  35. cat > Makefile.am << 'END'
  36. TEST_SUITE_LOG = mylog.log
  37. TESTS = foo.test bar.test baz.test
  38. check_SCRIPTS = bla
  39. bla:
  40. echo bla > $@
  41. CLEANFILES = bla
  42. include $(srcdir)/check-html.am
  43. END
  44. cat > foo.test <<'END'
  45. #! /bin/sh
  46. echo "this is $0"
  47. test -f bla || exit 1
  48. exit 0
  49. END
  50. cat > bar.test <<'END'
  51. #! /bin/sh
  52. echo "this is $0"
  53. exit 99
  54. END
  55. cat > baz.test <<'END'
  56. #! /bin/sh
  57. echo "this is $0"
  58. exit 1
  59. END
  60. chmod a+x foo.test bar.test baz.test
  61. $ACLOCAL
  62. $AUTOCONF
  63. $AUTOMAKE -a
  64. ./configure
  65. $MAKE check-html && exit 1
  66. test -f mylog.html
  67. # check-html should cause check_SCRIPTS to be created.
  68. test -f bla
  69. # "make clean" should remove HTML files.
  70. $MAKE clean
  71. test ! -e mylog.html
  72. test ! -e bla
  73. # Always create the HTML output, even if there were no failures.
  74. rm -f mylog.html
  75. run_make TESTS=foo.test check-html
  76. test -f mylog.html
  77. # Create summarizing HTML output also with recheck-html.
  78. rm -f mylog.html
  79. run_make TESTS=foo.test recheck-html
  80. test -f mylog.html
  81. # Create HTML output for an individual test.
  82. $MAKE foo.html
  83. grep 'this is .*foo\.test' foo.html
  84. test ! -e bar.html
  85. test ! -e baz.html
  86. # Create HTML output for individual tests. Since the pre-existing log
  87. # files are expected to be used for the HTML conversion, this should
  88. # go smoothly even for failed tests.
  89. $MAKE bar.html baz.html
  90. grep 'this is .*bar\.test' bar.html
  91. grep 'this is .*baz\.test' baz.html
  92. # HTML output removed by mostlyclean.
  93. $MAKE mostlyclean
  94. test ! -e foo.html
  95. test ! -e bar.html
  96. test ! -e baz.html
  97. test ! -e mylog.html
  98. # check-html and recheck-html should cause check_SCRIPTS to be created,
  99. # and recheck-html should rerun no tests if check has not been run.
  100. $MAKE clean
  101. test ! -e mylog.html
  102. run_make TEST_LOGS=foo.log check-html
  103. test -f bla
  104. test -f foo.log
  105. test ! -e bar.log
  106. test ! -e baz.log
  107. test -f mylog.html
  108. $MAKE clean
  109. run_make TESTS=foo.test recheck-html
  110. test -f bla
  111. test ! -e foo.log
  112. test -f mylog.html
  113. $MAKE clean
  114. $MAKE recheck-html
  115. test -f bla
  116. test ! -e foo.log
  117. test ! -e bar.log
  118. test ! -e baz.log
  119. test -f mylog.html
  120. :