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