test harness: improve catching of usage errors in script 'test-driver'
[platform/upstream/automake.git] / t / lisp-subdir.sh
1 #! /bin/sh
2 # Copyright (C) 2012-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 # Emacs lisp files in subdirectories.
18
19 required=emacs
20 . test-init.sh
21
22 cat >> configure.ac << 'END'
23 AM_PATH_LISPDIR
24 AC_OUTPUT
25 END
26
27 cat > Makefile.am << 'END'
28 nobase_lisp_LISP = sub/am-one.el sub/am-two.el sub/am-three.el
29 nobase_dist_lisp_LISP = sub/am-three.el
30 dist_noinst_LISP = sub/am-four.el
31 EXTRA_DIST = sub/am-one.el sub/am-two.el
32 END
33
34 mkdir sub
35 echo "(require 'am-two) (provide 'am-one)"      > sub/am-one.el
36 echo "(require 'am-three) (provide 'am-two)"    > sub/am-two.el
37 echo "(provide 'am-three)"                      > sub/am-three.el
38 echo "(require 'am-one) (require 'am-two)"      > sub/am-four.el
39
40 $ACLOCAL
41 $AUTOCONF
42 $AUTOMAKE --add-missing
43
44 ./configure --prefix="$(pwd)/inst" \
45             --with-lispdir="$(pwd)/inst/elisp" \
46
47 $MAKE
48 # No byte-compiled elisp files in the top-level directory.
49 test "$(echo *.elc)" = '*.elc'
50 test -f sub/am-one.elc
51 test -f sub/am-two.elc
52 test -f sub/am-three.elc
53 test -f sub/am-four.elc
54 $MAKE clean
55 test ! -e sub/am-one.elc
56 test ! -e sub/am-two.elc
57 test ! -e sub/am-three.elc
58 test ! -e sub/am-four.elc
59
60 # Check installation.
61
62 sort > exp << 'END'
63 inst/elisp/sub/am-one.elc
64 inst/elisp/sub/am-two.elc
65 inst/elisp/sub/am-three.elc
66 END
67
68 $MAKE install
69 find inst # For debugging.
70 find inst -name '*.elc' > lst || { cat lst; exit 1; }
71 sort lst > got
72
73 cat exp
74 cat got
75 diff exp got
76
77 # Also check VPATH builds and uninstall completeness.
78 $MAKE distcheck
79
80 :