testsuite-summary-checks.sh 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  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. # Check the testsuite summary with the parallel test harness. This
  17. # script is meant to be sourced by other test script, so that it can
  18. # be used to check different scenarios (colorized and non-colorized
  19. # testsuite output, packages with and without bug-report addresses,
  20. # testsuites in subdirectories, ...)
  21. . test-init.sh
  22. case $use_colors in
  23. yes)
  24. AM_COLOR_TESTS=always; export AM_COLOR_TESTS
  25. # Forced colorization should take place also with non-ANSI
  26. # terminals; hence this setting.
  27. TERM=dumb; export TERM
  28. ;;
  29. no)
  30. ;;
  31. *)
  32. fatal_ "invalid use_colors='$use_colors'";;
  33. esac
  34. cat > configure.ac <<END
  35. AC_INIT([GNU AutoFoo], [7.1], [bug-automake@gnu.org])
  36. AM_INIT_AUTOMAKE
  37. AC_CONFIG_FILES([Makefile])
  38. AC_OUTPUT
  39. END
  40. cat > Makefile.am <<'END'
  41. TEST_EXTENSIONS = .t
  42. T_LOG_COMPILER = $(SHELL) $(srcdir)/log-compiler
  43. ## Will be defined at runtime.
  44. TESTS =
  45. $(TESTS):
  46. END
  47. cat > log-compiler <<'END'
  48. #!/bin/sh
  49. case "$1" in
  50. pass*|*/pass*|xpass*|*/xpass*) exit 0;;
  51. fail*|*/fail*|xfail*|*/xfail*) exit 1;;
  52. skip*|*/skip*) exit 77;;
  53. error*|/error*) exit 99;;
  54. copy*|*/copy*) cat "$1";;
  55. *) exit 99;;
  56. esac
  57. END
  58. # Quite complexish, but allow the tests in client scripts to be written
  59. # in a "data-driven fashion".
  60. do_check ()
  61. {
  62. cat > summary.exp
  63. expect_failure=false
  64. xfail_tests=''
  65. tests="$*"
  66. for t in $*; do
  67. case $t in fail*|xpass*|error*) expect_failure=:;; esac
  68. case $t in xfail*|xpass*) xfail_tests="$xfail_tests $t";; esac
  69. done
  70. run_make -O -e IGNORE check TESTS="$tests" XFAIL_TESTS="$xfail_tests"
  71. if $expect_failure; then
  72. test $am_make_rc -gt 0 || exit 1
  73. else
  74. test $am_make_rc -eq 0 || exit 1
  75. fi
  76. $PERL "$am_testaux_srcdir"/extract-testsuite-summary.pl stdout >summary.got \
  77. || fatal_ "cannot extract testsuite summary"
  78. cat summary.exp
  79. cat summary.got
  80. if test $use_colors = yes; then
  81. # Use cmp, not diff, because the files might contain binary data.
  82. compare=cmp
  83. else
  84. compare=diff
  85. fi
  86. $compare summary.exp summary.got || exit 1
  87. }
  88. br='============================================================================'
  89. $ACLOCAL
  90. $AUTOCONF
  91. $AUTOMAKE --add-missing
  92. :