test harness: improve catching of usage errors in script 'test-driver'
[platform/upstream/automake.git] / t / lisp2.sh
1 #! /bin/sh
2 # Copyright (C) 2002-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 # Make sure that Automake suggest using AM_PATH_LISPDIR to define lispdir.
18
19 . test-init.sh
20
21
22 : TRY 1 -- We lack both EMACS and lispdir.
23
24 cat > Makefile.am << 'END'
25 lisp_LISP = foo.el
26 END
27
28 $ACLOCAL
29 AUTOMAKE_fails
30 grep AM_PATH_LISPDIR stderr
31 grep '[Ll]isp source.*EMACS.* undefined' stderr
32 grep '[Ll]isp source.*lispdir.* undefined' stderr
33 grep ' add .*AM_PATH_LISPDIR' stderr
34
35
36 : TRY 2 -- Setting lispdir should not be enough.
37
38 cat > Makefile.am << 'END'
39 lispdir = /usr/share/emacs/site-lisp
40 lisp_LISP = foo.el
41 END
42
43 $ACLOCAL
44 AUTOMAKE_fails
45 grep 'lispdir.*undefined' stderr && exit 1
46 grep '[Ll]isp source.*EMACS.* undefined' stderr
47 grep 'define .*EMACS.* add .*AM_PATH_LISPDIR' stderr
48
49
50 : TRY 3 -- Setting EMACS should not be enough.
51
52 cat > Makefile.am << 'END'
53 EMACS = emacs
54 lisp_LISP = foo.el
55 END
56
57 $ACLOCAL
58 AUTOMAKE_fails
59 grep 'EMACS.*undefined' stderr && exit 1
60 grep '[Ll]isp source.*lispdir.* undefined' stderr
61 grep 'define .*lispdir.* add .*AM_PATH_LISPDIR' stderr
62
63
64 : TRY 4 -- Setting both EMACS and lispdir is OK.
65
66 cat > Makefile.am << 'END'
67 lispdir = /usr/share/emacs/site-lisp
68 EMACS = emacs
69 lisp_LISP = foo.el
70 END
71
72 $ACLOCAL
73 $AUTOMAKE -a
74
75 :