aclocal-install-fail.sh 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  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. # Check that "aclocal --install" fails when it should.
  17. # FIXME: this is a good candidate for a conversion to TAP.
  18. am_create_testdir=empty
  19. required=ro-dir
  20. . test-init.sh
  21. cat > configure.ac <<END
  22. AC_INIT([$me], [1.0])
  23. MY_MACRO
  24. END
  25. mkdir sys-acdir
  26. cat > sys-acdir/my-defs.m4 <<END
  27. AC_DEFUN([MY_MACRO], [:])
  28. END
  29. ACLOCAL="$ACLOCAL -Wnone --system-acdir=sys-acdir"
  30. : > a-regular-file
  31. mkdir unwritable-dir
  32. chmod a-w unwritable-dir
  33. $ACLOCAL -I a-regular-file --install 2>stderr \
  34. && { cat stderr >&2; exit 1; }
  35. cat stderr >&2
  36. $EGREP '(mkdir:|directory ).*a-regular-file' stderr
  37. test ! -e aclocal.m4
  38. $ACLOCAL --install -I unwritable-dir/sub 2>stderr \
  39. && { cat stderr >&2; exit 1; }
  40. cat stderr >&2
  41. $EGREP '(mkdir:|directory ).*unwritable-dir/sub' stderr
  42. test ! -e aclocal.m4
  43. $ACLOCAL -I unwritable-dir --install 2>stderr \
  44. && { cat stderr >&2; exit 1; }
  45. cat stderr >&2
  46. $EGREP '(cp:|copy ).*unwritable-dir' stderr
  47. test ! -e aclocal.m4
  48. # Sanity check.
  49. mkdir m4
  50. $ACLOCAL -I m4 --install && test -f aclocal.m4 \
  51. || fatal_ "aclocal failed also when expected to succeed"
  52. :