+2011-07-16 Stefano Lattarini <stefano.lattarini@gmail.com>
+
+ tests: tweak, improve and extend tests on lisp support
+ * tests/lisp2.test: Prettify, and improve debugging output. Make
+ grepping of automake stderr stricter.
+ * tests/lisp7.test: Ensure verbose printing of captured make
+ output. Add trailing `:' command.
+ * tests/lisp8.test: Likewise.
+ * tests/lisp3.test: Likewise. Also, check that `.el' files and
+ compiled `.elc' files get installed by "make install", and
+ uninstalled by "make uninstall".
+ * tests/lisp4.test: Ensure installed `.el' files gets removed by
+ "make uninstall". Related changes. Add trailing `:' command.
+ * tests/lisp5.test: Likewise.
+ * tests/lisp6.test: Use proper m4 quoting in configure.in. Fix
+ use of blank lines, to improve clarity and symmetry. Fix typo in
+ comment. Add trailing `:' command.
+
2011-07-16 Stefano Lattarini <stefano.lattarini@gmail.com>
tests: drop useless requirement in 'license.test'
. ./defs || Exit 1
-echo 1
+
+: TRY 1 -- We lack both EMACS and lispdir.
cat > Makefile.am << 'END'
lisp_LISP = foo.el
$ACLOCAL
AUTOMAKE_fails
grep AM_PATH_LISPDIR stderr
+grep '[Ll]isp source.*EMACS.* undefined' stderr
+grep '[Ll]isp source.*lispdir.* undefined' stderr
+grep ' add .*AM_PATH_LISPDIR' stderr
-echo 2
-# Setting lispdir should not be enough.
+: TRY 2 -- Setting lispdir should not be enough.
cat > Makefile.am << 'END'
lispdir = /usr/share/emacs/site-lisp
$ACLOCAL
AUTOMAKE_fails
-grep AM_PATH_LISPDIR stderr
+grep 'lispdir.*undefined' stderr && Exit 1
+grep '[Ll]isp source.*EMACS.* undefined' stderr
+grep 'define .*EMACS.* add .*AM_PATH_LISPDIR' stderr
+
-echo 3
-# Setting EMACS should not be enough.
+: TRY 3 -- Setting EMACS should not be enough.
cat > Makefile.am << 'END'
EMACS = emacs
$ACLOCAL
AUTOMAKE_fails
-grep AM_PATH_LISPDIR stderr
+grep 'EMACS.*undefined' stderr && Exit 1
+grep '[Ll]isp source.*lispdir.* undefined' stderr
+grep 'define .*lispdir.* add .*AM_PATH_LISPDIR' stderr
-echo 4
-# Setting both is OK.
+: TRY 4 -- Setting both EMACS and lispdir is OK.
cat > Makefile.am << 'END'
lispdir = /usr/share/emacs/site-lisp
$ACLOCAL
$AUTOMAKE -a
+
+:
echo "(require 'am-three) (provide 'am-two)" > am-two.el
# am-three.el is a built source
-
$ACLOCAL
$AUTOCONF
$AUTOMAKE --add-missing
-./configure
+
+./configure --prefix="`pwd`/_inst"
$MAKE
$MAKE
test -f am-one.elc
+# Test installation/deinstallation.
+
+$MAKE install
+
+find _inst # For debugging.
+
+# Keep thin in sync with m4/lispdir.m4.
+for dir in lib/emacs lib/xemacs share/emacs share/xemacs :; do
+ if test $dir = :; then
+ Exit 1
+ elif test -d _inst/$dir/site-lisp; then
+ break
+ fi
+done
+
+test -f _inst/$dir/site-lisp/am-one.el
+test -f _inst/$dir/site-lisp/am-one.elc
+test -f _inst/$dir/site-lisp/am-two.el
+test -f _inst/$dir/site-lisp/am-two.elc
+test -f _inst/$dir/site-lisp/am-three.el
+test -f _inst/$dir/site-lisp/am-three.elc
+
+$MAKE uninstall
+find _inst | $EGREP '\.elc?$' && Exit 1
+
# Make sure we build all files when any of them change.
# (We grep a message to make sure the compilation happens.)
unique=0a3346e2af8a689b85002b53df09142a
$sleep
echo "(message \"$unique\")(provide 'am-three)" > am-three.el
-$MAKE >output 2>&1
+$MAKE >output 2>&1 || { cat output; Exit 1; }
cat output
grep $unique output
# It should also work for VPATH-builds.
$MAKE distcheck
+
+:
test ! -f "$(lispdir)/am-two.elc"
test ! -f "$(lispdir)/am-three.elc"
-install-test2: install
- test ! -f "$(lispdir)/am-one.el"
- test ! -f "$(lispdir)/am-two.el"
- test ! -f "$(lispdir)/am-three.el"
- test ! -f "$(lispdir)/am-one.elc"
- test ! -f "$(lispdir)/am-two.elc"
- test ! -f "$(lispdir)/am-three.elc"
+not-installed:
+ find "$(lispdir)" | grep '\.el$$' && exit 1; :
+ find "$(lispdir)" | grep '\.elc$$' && exit 1; :
EOF
cat >> configure.in << 'EOF'
$MAKE test
$MAKE install-test
$MAKE uninstall
+$MAKE not-installed
# Fake the absence of emacs.
-# *.el files should not be installed.
+# *.el files should not be installed, but "make install" and
+# "make uninstall" should continue to work.
./configure EMACS=no --prefix "`pwd`"
$MAKE
$MAKE test
-$MAKE install-test2
+$MAKE install
+$MAKE not-installed
+$MAKE uninstall
+
+:
test ! -f "$(lispdir)/am-one.elc"
test ! -f "$(lispdir)/am-two.elc"
test ! -f "$(lispdir)/am-three.elc"
+
+not-installed:
+ find "$(lispdir)" | grep '\.el$$' && exit 1; :
+ find "$(lispdir)" | grep '\.elc$$' && exit 1; :
EOF
cat >> configure.in << 'EOF'
$MAKE test
$MAKE install-test
$MAKE uninstall
+$MAKE not-installed
# Fake the absence of emacs.
-# *.el files SHOULD be installed.
+# *.el files SHOULD be installed by "make install" (and uninstalled
+# by "make uninstall").
./configure EMACS=no --prefix "`pwd`"
$MAKE
$MAKE test
$MAKE install-test
+$MAKE uninstall
+$MAKE not-installed
+
+:
EOF
cat >> configure.in << 'EOF'
-AM_CONDITIONAL([WANT_TWO], test -n "$want_two")
+AM_CONDITIONAL([WANT_TWO], [test -n "$want_two"])
AM_PATH_LISPDIR
AC_OUTPUT
EOF
$ACLOCAL
$AUTOCONF
$AUTOMAKE --add-missing
+
./configure "--with-lispdir=`pwd`/lisp"
$MAKE
test ! -f am-three.elc
test ! -f elc-stamp
-
./configure "--with-lispdir=`pwd`/lisp" want_two=1
+
$MAKE
test -f am-one.elc
test -f am-two.elc
test -f am-three.elc
test -f elc-stamp
-# Let's mutilate the source tree, the check the recover rule.
+# Let's mutilate the source tree, to check the recover rule.
rm -f am-*.elc
$MAKE
test -f am-one.elc
test ! -f am-two.elc
test ! -f am-three.elc
test ! -f elc-stamp
+
+:
$AUTOMAKE --add-missing
./configure
-$MAKE >stdout
-
+$MAKE >stdout || { cat stdout; Exit 1; }
cat stdout
test 1 -eq `grep 'Warnings can be ignored' stdout | wc -l`
test -f elc-stamp
$MAKE distcheck
+
+:
rm -f am-*.elc
: >stdout
-$MAKE -j >>stdout
+$MAKE -j >>stdout || { cat stdout; Exit 1; }
cat stdout
test 1 -eq `grep 'Warnings can be ignored' stdout | wc -l`
test -f am-two.elc
test -f am-three.elc
test -f elc-stamp
+
+: