parallel-tests-html-recursive.sh 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163
  1. #! /bin/sh
  2. # Copyright (C) 2012-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. # Recursive use of 'check-html'. See Automake bug#11287.
  17. . test-init.sh
  18. # Try the variants that are tried in check-html.am.
  19. while :; do
  20. for r2h in $RST2HTML rst2html rst2html.py; do
  21. echo "$me: running $r2h --version"
  22. $r2h --version && break 2
  23. : For shells with busted 'set -e'.
  24. done
  25. skip_all_ "no proper rst2html program found"
  26. done
  27. unset r2h
  28. cp "$am_top_srcdir"/contrib/check-html.am . \
  29. || fatal_ "cannot fetch 'check-html.am' from contrib"
  30. cat >> configure.ac << 'END'
  31. AM_EXTRA_RECURSIVE_TARGETS([check-html])
  32. AC_CONFIG_FILES([sub/Makefile sub/more/Makefile])
  33. AC_OUTPUT
  34. END
  35. cat > Makefile.am << 'END'
  36. SUBDIRS = sub
  37. EXTRA_DIST = $(TESTS)
  38. TEST_SUITE_LOG = mylog.log
  39. TESTS = foo.test bar.sh mu
  40. XFAIL_TESTS = bar.sh
  41. check_SCRIPTS = bla
  42. bla:
  43. echo '#!/bin/sh' > $@-t
  44. echo 'echo Blah Blah Blah' >> $@-t
  45. chmod a+x,a-w $@-t
  46. mv -f $@-t $@
  47. CLEANFILES = bla
  48. include $(srcdir)/check-html.am
  49. END
  50. mkdir sub
  51. echo SUBDIRS = more > sub/Makefile.am
  52. mkdir sub/more
  53. cat > sub/more/Makefile.am << 'END'
  54. include $(top_srcdir)/check-html.am
  55. TEST_EXTENSIONS = .test .sh
  56. TESTS = sh.sh test.test
  57. LOG_COMPILER = true
  58. test.log: sh.log
  59. nodist_check_DATA = x.txt
  60. $(nodist_check_DATA):
  61. echo $@ > $@
  62. CLEANFILES = $(nodist_check_DATA)
  63. EXTRA_DIST = $(TESTS)
  64. END
  65. cat > foo.test <<'END'
  66. #! /bin/sh
  67. ./bla
  68. exit 77
  69. END
  70. cat > bar.sh <<'END'
  71. #! /bin/sh
  72. echo "this is $0"
  73. exit 1
  74. END
  75. cat > mu <<'END'
  76. #! /bin/sh
  77. set -x
  78. test -f sub/more/test.log
  79. test -f sub/more/sh.log
  80. END
  81. cat > sub/more/test.test << 'END'
  82. #!/bin/sh
  83. echo "this is $0"
  84. set -x
  85. test -f sh.log
  86. test -f x.txt
  87. exit 77
  88. END
  89. cat > sub/more/sh.sh << 'END'
  90. #!/bin/sh
  91. set -x
  92. test ! -f test.log
  93. test -f x.txt
  94. END
  95. cat > sub/more/mu << 'END'
  96. #!/bin/sh
  97. exit 99
  98. END
  99. chmod a+x foo.test bar.sh mu sub/more/test.test sub/more/sh.sh
  100. $ACLOCAL
  101. $AUTOCONF
  102. $AUTOMAKE -a
  103. ./configure
  104. $MAKE check-html
  105. grep 'Blah Blah Blah' mylog.html
  106. grep 'this is .*bar\.sh' mylog.html
  107. grep 'this is .*test\.test' sub/more/test-suite.html
  108. # check-html should cause check_SCRIPTS and check_DATA to be created.
  109. test -f bla
  110. test -f sub/more/x.txt
  111. # "make clean" should remove HTML files.
  112. $MAKE clean
  113. test ! -e mylog.html
  114. test ! -e sub/more/test-suite.html
  115. test ! -e bla
  116. test ! -e sub/more/x.txt
  117. # Create HTML output for individual tests.
  118. $MAKE bla
  119. $MAKE foo.html bar.sh.html
  120. grep 'Blah Blah Blah' foo.html
  121. grep 'this is .*bar\.sh' bar.sh.html
  122. test ! -e mu.hml
  123. ocwd=$(pwd) || fatal_ "getting current workind directory"
  124. ( cd sub/more \
  125. && $MAKE sh.html \
  126. && test -f sh.html \
  127. && test ! -e test.html \
  128. && $MAKE test.html \
  129. && grep 'this is .*test\.test' test.html) || exit 1
  130. # HTML output removed by mostlyclean.
  131. $MAKE check-html
  132. test -f mylog.html
  133. test -f sub/more/test-suite.html
  134. $MAKE mostlyclean
  135. find . -name '*.html' | grep . && exit 1
  136. $MAKE distcheck
  137. :