werror4.sh 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. #! /bin/sh
  2. # Copyright (C) 2010-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. # -Werror and local -Werror settings should be flagged for the user.
  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 >sub/Makefile.am <<\END
  24. AUTOMAKE_OPTIONS = -Werror
  25. SUB = foo
  26. SUB = bar
  27. END
  28. cat >Makefile.am <<\END
  29. AUTOMAKE_OPTIONS = -Werror
  30. VAR = foo
  31. VAR = bar
  32. END
  33. $ACLOCAL
  34. AUTOMAKE_fails -Wno-error
  35. grep 'VAR multiply defined' stderr
  36. grep 'SUB multiply defined' stderr
  37. test $(grep -c 'warnings are treated as errors' stderr) -eq 1
  38. sed '/AUTOMAKE_OPTIONS/d' sub/Makefile.am > t
  39. mv -f t sub/Makefile.am
  40. AUTOMAKE_fails -Wno-error
  41. grep 'VAR multiply defined' stderr
  42. grep 'SUB multiply defined' stderr
  43. test $(grep -c 'warnings are treated as errors' stderr) -eq 1
  44. sed '/AUTOMAKE_OPTIONS/d' Makefile.am > t
  45. mv -f t Makefile.am
  46. AUTOMAKE_fails -Werror
  47. grep 'VAR multiply defined' stderr
  48. grep 'SUB multiply defined' stderr
  49. test $(grep -c 'warnings are treated as errors' stderr) -eq 1
  50. AUTOMAKE_run -Wno-error
  51. grep 'VAR multiply defined' stderr
  52. grep 'SUB multiply defined' stderr
  53. grep 'warnings are treated as errors' stderr && exit 1
  54. :