tests: cosmetic changes in t/extra-sources.sh
[platform/upstream/automake.git] / t / distlinks.sh
1 #! /bin/sh
2 # Copyright (C) 2010-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 # Check that distributed symlinks in the source tree will be expanded
18 # as regular files in $(distdir).
19
20 . test-init.sh
21
22 echo text > file
23
24 ln -s file lnk || skip_ "cannot create symlinks to files"
25
26 mkdir A
27 mkdir B
28 echo aaa > A/aaa
29 cd B
30 ln -s ../A/aaa bbb
31 cd ..
32
33 echo FooBarBaz > foo
34
35 ln -s foo  bar1
36 ln -s bar1 bar2
37 ln -s bar2 bar3
38
39 ln -s "$(pwd)/foo" quux
40
41 cat >> configure.ac << 'END'
42 AC_OUTPUT
43 END
44
45 echo "me = $me" > Makefile.am # For better failure messages.
46 cat >> Makefile.am << 'END'
47 EXTRA_DIST = lnk B/bbb bar1 bar2 bar3 quux
48 .PHONY: test
49 test: distdir
50         ls -l $(distdir) $(distdir)/B
51         fail() { echo "$(me): $$*" >&2; e=1; }; \
52         e=0; \
53         set file lnk A/aaa B/bbb foo quux foo bar1 foo bar2 foo bar3; \
54         while test $$# -ge 2; do \
55           file=$$1; shift; link=$(distdir)/$$1; shift; \
56           test -f $$link || fail "$$link is not a regular file"; \
57           test ! -h $$link || fail "$$link is a symlink"; \
58           diff $$file $$link || fail "$$link differs from $$file"; \
59         done; \
60         exit $$e;
61 END
62
63 ls -l . A B
64
65 $ACLOCAL
66 $AUTOCONF
67 $AUTOMAKE
68
69 ./configure
70 $MAKE test
71
72 :