parallel-tests-harderror.sh 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  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: DISABLE_HARD_ERRORS
  17. . test-init.sh
  18. cat >> configure.ac << 'END'
  19. AC_CONFIG_FILES([sub/Makefile])
  20. AC_OUTPUT
  21. END
  22. mkdir sub
  23. cat > Makefile.am << 'END'
  24. SUBDIRS = . sub
  25. TESTS = foo.test
  26. XFAIL_TESTS = foo.test
  27. EXTRA_DIST = $(TESTS)
  28. END
  29. cat > sub/Makefile.am << 'END'
  30. TESTS = bar.test
  31. XFAIL_TESTS = $(TESTS)
  32. EXTRA_DIST = $(TESTS)
  33. END
  34. cat > foo.test <<'END'
  35. #! /bin/sh
  36. exit 99
  37. END
  38. chmod a+x foo.test
  39. cp foo.test sub/bar.test
  40. $ACLOCAL
  41. $AUTOCONF
  42. $AUTOMAKE -a
  43. ./configure
  44. # DISABLE_HARD_ERRORS is not defined as a make variable, so that it
  45. # should be possible to define either from the environment or from
  46. # command-line, also when recursive make invocations are involved,
  47. # and also without using the '-e' make flag; this should work also
  48. # for non-GNU make. Moreover, it shouldn't be necessary to define
  49. # DISABLE_HARD_ERRORS to "yes" to really disable hard errors: any
  50. # non-empty value should do.
  51. $MAKE check DISABLE_HARD_ERRORS=yes
  52. DISABLE_HARD_ERRORS=x $MAKE check
  53. # But an empty values for DISABLE_HARD_ERRORS means that hard errors
  54. # are not to be counted like normal failures.
  55. $MAKE check DISABLE_HARD_ERRORS= && exit 1
  56. cat test-suite.log
  57. grep '^ERROR: foo$' test-suite.log
  58. cd sub
  59. $MAKE check DISABLE_HARD_ERRORS= && exit 1
  60. cat test-suite.log
  61. grep '^ERROR: bar$' test-suite.log
  62. cd ..
  63. # Check the distributions.
  64. $MAKE DISABLE_HARD_ERRORS=y distcheck
  65. # Finally, DISABLE_HARD_ERRORS should work also when the developer
  66. # sets it directly in Makefile.am or Makefile. And its effects
  67. # should remain local to that specific Makefile, obviously.
  68. echo 'DISABLE_HARD_ERRORS = yes' >> Makefile.am
  69. $AUTOMAKE Makefile
  70. ./config.status Makefile
  71. VERBOSE=yes $MAKE check && exit 1
  72. grep '^FAIL' test-suite.log && exit 1
  73. grep '^ERROR: bar$' sub/test-suite.log
  74. echo 'DISABLE_HARD_ERRORS = zardoz' >> sub/Makefile
  75. VERBOSE=yes $MAKE check
  76. :