parallel-tests-log-override-recheck.sh 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  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 parallel-tests features: runtime redefinition of $(TEST_SUITE_LOG)
  17. # for the recheck target.
  18. . test-init.sh
  19. cat >> configure.ac <<'END'
  20. AC_OUTPUT
  21. END
  22. cat > Makefile.am <<'END'
  23. TESTS = foofoo.test barbar.test bazbaz.test
  24. END
  25. cat > foofoo.test <<'END'
  26. #! /bin/sh
  27. echo "this is $0"
  28. exit 0
  29. END
  30. cat > barbar.test <<'END'
  31. #! /bin/sh
  32. echo "this is $0"
  33. exit 99
  34. END
  35. cat > bazbaz.test <<'END'
  36. #! /bin/sh
  37. echo "this is $0"
  38. exit ${BAZ_EXIT_STATUS-1}
  39. END
  40. chmod a+x *.test
  41. unset BAZ_EXIT_STATUS
  42. $ACLOCAL
  43. $AUTOCONF
  44. $AUTOMAKE -a
  45. # Filter make output before grepping it, for make implementations that,
  46. # like Solaris' one, print the whole of the failed recipe on failure.
  47. filter_stdout ()
  48. {
  49. grep -v 'bases=.*;' stdout > t && mv -f t stdout
  50. }
  51. ./configure
  52. run_make -O -e FAIL check
  53. using_gmake || $sleep # Required by BSD make.
  54. chmod a-rw test-suite.log
  55. run_make -O -e FAIL TEST_SUITE_LOG=my.log recheck
  56. ls -l
  57. filter_stdout
  58. count_test_results total=2 pass=0 fail=1 skip=0 xfail=0 xpass=0 error=1
  59. for x in stdout my.log; do
  60. $FGREP foofoo $x && exit 1
  61. $FGREP barbar $x
  62. $FGREP bazbaz $x
  63. done
  64. using_gmake || $sleep # Required by BSD make.
  65. chmod a-rw my.log
  66. run_make -O -e FAIL BAZ_EXIT_STATUS=0 TEST_SUITE_LOG=my2.log recheck
  67. ls -l
  68. count_test_results total=2 pass=1 fail=0 skip=0 xfail=0 xpass=0 error=1
  69. filter_stdout
  70. $FGREP foofoo stdout && exit 1
  71. $FGREP barbar stdout
  72. $FGREP bazbaz stdout
  73. $FGREP foofoo my2.log && exit 1
  74. $FGREP barbar my2.log
  75. $FGREP bazbaz my2.log && exit 1
  76. chmod u+r test-suite.log my.log
  77. $FGREP bazbaz test-suite.log
  78. $FGREP bazbaz my.log
  79. :