test-driver-fail.sh 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  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. # Custom test drivers: what happens when a test driver fails? Well,
  17. # "make check" should at least fail too, and the test-suite.log
  18. # shouldn't be created. Unfortunately, we cannot truly control also
  19. # the (non-)creation of individual test logs, since those are expected
  20. # to be created by the drivers themselves, and an ill-behaved driver
  21. # (like our dummy one in this test) might leave around a test log even
  22. # in case of internal failures.
  23. . test-init.sh
  24. cat >> configure.ac <<'END'
  25. AC_OUTPUT
  26. END
  27. cat > Makefile.am <<'END'
  28. TEST_LOG_DRIVER = ./oops
  29. TESTS = foo.test
  30. END
  31. cat > foo.test <<'END'
  32. #! /bin/sh
  33. exit 0
  34. END
  35. $ACLOCAL
  36. $AUTOCONF
  37. $AUTOMAKE
  38. ./configure
  39. # The testsuite driver does not exist.
  40. $MAKE check && exit 1
  41. test ! -e test-suite.log
  42. # The testsuite driver exists and create the test log files, but fails.
  43. cat > oops <<'END'
  44. #!/bin/sh
  45. : > foo.log
  46. echo 'Oops, I fail!' >&2
  47. exit 1
  48. END
  49. chmod a+x oops
  50. $MAKE check && exit 1
  51. test ! -e test-suite.log
  52. :