parallel-tests-recheck.sh 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  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. # - recheck
  18. . test-init.sh
  19. cat >> configure.ac << 'END'
  20. AC_OUTPUT
  21. END
  22. cat > Makefile.am << 'END'
  23. TEST_SUITE_LOG = mylog.log
  24. TESTS = foo.test bar.test baz.test
  25. check_SCRIPTS = bla
  26. CLEANFILES = bla
  27. bla:
  28. echo bla > $@
  29. END
  30. cat > foo.test <<'END'
  31. #! /bin/sh
  32. echo "this is $0"
  33. test -f bla || exit 1
  34. exit 0
  35. END
  36. cat > bar.test <<'END'
  37. #! /bin/sh
  38. echo "this is $0"
  39. exit 99
  40. END
  41. cat > baz.test <<'END'
  42. #! /bin/sh
  43. echo "this is $0"
  44. exit 1
  45. END
  46. chmod a+x foo.test bar.test baz.test
  47. $ACLOCAL
  48. $AUTOCONF
  49. $AUTOMAKE -a
  50. ./configure
  51. run_make -O -e FAIL check
  52. count_test_results total=3 pass=1 fail=1 skip=0 xfail=0 xpass=0 error=1
  53. # Running this two times in a row should produce the same results the
  54. # second time.
  55. for i in 1 2; do
  56. using_gmake || $sleep # Required by BSD make.
  57. run_make -O -e FAIL recheck
  58. count_test_results total=2 pass=0 fail=1 skip=0 xfail=0 xpass=0 error=1
  59. grep 'foo\.test' stdout && exit 1
  60. grep '^ERROR: bar\.test$' stdout
  61. grep '^FAIL: baz\.test$' stdout
  62. done
  63. # Ensure that recheck builds check_SCRIPTS, and that
  64. # recheck reruns nothing if check has not been run.
  65. $MAKE clean
  66. $MAKE recheck
  67. test -f bla
  68. test ! -e foo.log
  69. test ! -e bar.log
  70. test ! -e baz.log
  71. test -f mylog.log
  72. :