parallel-tests-recheck-pr11791.sh 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  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. # parallel-tests: "make recheck" and "make -k recheck" in the face of
  17. # build failures for the test cases. See automake bug#11791.
  18. required='cc native'
  19. . test-init.sh
  20. cat >> configure.ac << 'END'
  21. AC_PROG_CC
  22. AC_OUTPUT
  23. END
  24. cat > Makefile.am << 'END'
  25. TESTS = $(EXTRA_PROGRAMS)
  26. EXTRA_PROGRAMS = foo
  27. END
  28. echo 'int main (void) { return 1; }' > foo.c
  29. $ACLOCAL
  30. $AUTOCONF
  31. $AUTOMAKE -a
  32. ./configure
  33. run_make -O -e FAIL check
  34. count_test_results total=1 pass=0 fail=1 xpass=0 xfail=0 skip=0 error=0
  35. using_gmake || $sleep # Required by BSD make.
  36. run_make -O -e IGNORE -- -k recheck
  37. # Don't trust the exit status of "make -k" for non-GNU makes.
  38. ! using_gmake || test $am_make_rc -gt 0 || exit 1
  39. count_test_results total=1 pass=0 fail=1 xpass=0 xfail=0 skip=0 error=0
  40. # Introduce an error in foo.c, that should cause a compilation failure.
  41. $sleep
  42. echo choke me >> foo.c
  43. run_make -O -e FAIL recheck
  44. # We don't get a change to run the testsuite.
  45. $EGREP '(X?PASS|X?FAIL|SKIP|ERROR):' stdout && exit 1
  46. # These shouldn't be removed, otherwise the next make recheck will do
  47. # nothing.
  48. test -f foo.log
  49. test -f foo.trs
  50. using_gmake || $sleep # Required by BSD make.
  51. run_make -O -e IGNORE -- -k recheck
  52. # Don't trust the exit status of "make -k" for non-GNU makes.
  53. ! using_gmake || test $am_make_rc -gt 0 || exit 1
  54. # We don't get a change to run the testsuite.
  55. $EGREP '(X?PASS|X?FAIL|SKIP|ERROR):' stdout && exit 1
  56. test -f foo.log
  57. test -f foo.trs
  58. # "Repair" foo.c, and expect everything to work.
  59. $sleep
  60. echo 'int main (void) { return 0; }' > foo.c
  61. run_make -O recheck
  62. count_test_results total=1 pass=1 fail=0 xpass=0 xfail=0 skip=0 error=0
  63. test -f foo.log
  64. test -f foo.trs
  65. run_make -O recheck
  66. count_test_results total=0 pass=0 fail=0 xpass=0 xfail=0 skip=0 error=0
  67. test -f foo.log
  68. test -f foo.trs
  69. :