preproc-errmsg.sh 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. #! /bin/sh
  2. # Copyright (C) 2013-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. # Tests error messages when '%reldir%' and '%canon_reldir%' substitutions
  17. # (and their shorthands '%D%' and '%C%') are involved.
  18. . test-init.sh
  19. cat >> configure.ac <<'END'
  20. AC_PROG_CC
  21. AC_PROG_RANLIB
  22. AM_PROG_AR
  23. END
  24. : > ar-lib
  25. mkdir sub sub/sub2
  26. cat > Makefile.am <<'END'
  27. %canon_reldir%_x1_SOURCES = bar.c
  28. include sub/local.mk
  29. END
  30. cat > sub/local.mk <<'END'
  31. AUTOMAKE_OPTIONS = -Wno-extra-portability
  32. include %D%/sub2/more.mk
  33. noinst_LIBRARIES = %reldir%-one.a %D%-two.a
  34. %C%_x2_SOURCES = foo.c
  35. END
  36. cat > sub/sub2/more.mk <<'END'
  37. %C%_UNDEFINED +=
  38. END
  39. $ACLOCAL
  40. AUTOMAKE_fails
  41. cat > expected << 'END'
  42. sub/sub2/more.mk:1: sub_sub2_UNDEFINED must be set with '=' before using '+='
  43. Makefile.am:2: 'sub/local.mk' included from here
  44. sub/local.mk:2: 'sub/sub2/more.mk' included from here
  45. sub/local.mk:3: 'sub-one.a' is not a standard library name
  46. sub/local.mk:3: did you mean 'libsub-one.a'?
  47. Makefile.am:2: 'sub/local.mk' included from here
  48. sub/local.mk:3: 'sub-two.a' is not a standard library name
  49. sub/local.mk:3: did you mean 'libsub-two.a'?
  50. Makefile.am:2: 'sub/local.mk' included from here
  51. sub/local.mk:4: variable 'sub_x2_SOURCES' is defined but no program or
  52. sub/local.mk:4: library has 'sub_x2' as canonical name (possible typo)
  53. Makefile.am:2: 'sub/local.mk' included from here
  54. Makefile.am:1: variable 'x1_SOURCES' is defined but no program or
  55. Makefile.am:1: library has 'x1' as canonical name (possible typo)
  56. END
  57. # We need to break these substitutions into multiple sed invocations
  58. # to avoid spuriously triggering the 'sc_tests_logs_duplicate_prefixes'
  59. # maintainer check.
  60. sed -e '/warnings are treated as errors/d' stderr > t1
  61. sed -e 's/: warning:/:/' t1 > t2
  62. sed -e 's/: error:/:/' t2 > t3
  63. sed -e 's/ */ /g' t3 > obtained
  64. diff expected obtained
  65. :