+2010-07-21 Stefano Lattarini <stefano.lattarini@gmail.com>
+
+ Modernize and improve test scripts `dist*.test'.
+ * tests/distcleancheck.test: Do not add useless `-e' option to
+ a $MAKE call. Extend test by grepping stderr of make.
+ * tests/distcom2.test: Do not run the same test script on the
+ Makefile.in twice, but save its output in an intermediate file
+ instead. Make grepping of DIST_COMMON definition stricter.
+ Display the content of more files, to ease debugging. Add a
+ trailing `:' command. Improved heading comments w.r.t. sister
+ test(s).
+ * tests/distcom6.test: Likewise, and avoid to uselessly run
+ autoconf.
+ * tests/distcom3.test: Ensure verbose printing of captured stdout
+ and stderr. Make grepping of captured stderr stricter. Also,
+ add trailing `:' command.
+ * tests/distcom4.test: Declare the target `test' in the generated
+ Makefile.am as `.PHONY'. Display content of more files, to ease
+ debugging. Add trailing `:' command.
+ * tests/distcom5.test: Likewise. Also, factor out common sed
+ script in subroutine `extract_distcommon'.
+ * tests/distcom7.test: Prefer cat + here-doc over echo to write
+ test Makefile.am files. Add a trailing `:' command.
+ * tests/distname.test: Prefer `gzip -d' over `gunzip'. Move the
+ call to `set -e' earlier. Be stricter and more verbose in the
+ checking of the generated tarball.
+ (configure.in): Use the stub provided by ./defs, instead of
+ writing it from scratch. Avoid obsoleted constructs. Remove
+ useless call to `AM_PROG_CC_C_O'.
+ * tests/distdir.test: Various minor improvements/normalizations.
+ * tests/distlinks.test: Likewise.
+
2010-07-18 Stefano Lattarini <stefano.lattarini@gmail.com>
Improve and extend test cond5.test.
#! /bin/sh
-# Copyright (C) 2008, 2009 Free Software Foundation, Inc.
+# Copyright (C) 2008, 2009, 2010 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
$AUTOMAKE
./configure
$MAKE
-$MAKE -e distcheck && Exit 1
+$MAKE distcheck 2>stderr && { cat srderr >&2; Exit 1; }
+cat stderr >&2
+
+grep 'ERROR:.*files left in build directory after distclean' stderr
+grep '^\./foo\.1$' stderr
:
# Test to make sure that depcomp and compile are added to DIST_COMMON
# From Pavel Roskin.
+# Please keep this in sync with sister test 'distcom6.test'.
. ./defs || Exit 1
t loop
p
n
- }' -e '/^DIST_COMMON =/ p' Makefile.in | grep compile
+ }' -e 's/$/ /' -e '/^DIST_COMMON =/p' Makefile.in > dc.txt
-sed -n -e '/^DIST_COMMON =.*\\$/ {
- :loop
- p
- n
- t clear
- :clear
- s/\\$/\\/
- t loop
- p
- n
- }' -e '/^DIST_COMMON =/ p' Makefile.in | grep depcomp
+cat dc.txt # might be useful for debugging
+
+$FGREP ' compile ' dc.txt
+$FGREP ' depcomp ' dc.txt
+
+:
#! /bin/sh
-# Copyright (C) 2001, 2002, 2003, 2004, 2006 Free Software Foundation, Inc.
+# Copyright (C) 2001, 2002, 2003, 2004, 2006, 2010 Free Software
+# Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
$ACLOCAL
# Should not warn about missing README, since it is a target.
-$AUTOMAKE --add-missing --gnu >stdout 2>&1
-cat stdout
-grep README stdout && Exit 1
+$AUTOMAKE --add-missing --gnu >output 2>&1 || { cat output; Exit 1; }
+cat output
+grep README output && Exit 1
sed -n -e '/^DIST_COMMON =.*\\$/ {
:loop
# Should warn about missing README.
: > Makefile.am
AUTOMAKE_fails --add-missing --gnu
-grep README stderr
+grep 'required file.*README.*not found' stderr
+
+:
#! /bin/sh
-# Copyright (C) 2003, 2006 Free Software Foundation, Inc.
+# Copyright (C) 2003, 2006, 2010 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
: > README
: > tests/wrapper.in
cat > Makefile.am << 'END'
+.PHONY: test
test: distdir
test -f $(distdir)/tests/wrapper.in
END
n
}' -e '/^DIST_COMMON =/ p' Makefile.in > dc.txt
+cat dc.txt # might be useful for debugging
+
test 1 = `grep tests dc.txt | wc -l`
grep configure dc.txt
# README must come first.
grep 'DIST_COMMON = README' Makefile.in
+
+:
#! /bin/sh
-# Copyright (C) 2003, 2006 Free Software Foundation, Inc.
+# Copyright (C) 2003, 2006, 2010 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
set -e
+extract_distcommon ()
+{
+ sed -n -e '/^DIST_COMMON =.*\\$/ {
+ :loop
+ p
+ n
+ t clear
+ :clear
+ s/\\$/\\/
+ t loop
+ p
+ n
+ }' -e '/^DIST_COMMON =/ p' ${1+"$@"}
+}
+
cat >> configure.in << 'END'
AC_CONFIG_FILES([tests/autoconf:tests/wrapper.in],
[chmod +x tests/autoconf])
: > tests/Makefile.am
cat > Makefile.am << 'END'
SUBDIRS = tests
+.PHONY: test
test: distdir
test -f $(distdir)/tests/wrapper.in
END
./configure
$MAKE test
-sed -n -e '/^DIST_COMMON =.*\\$/ {
- :loop
- p
- n
- t clear
- :clear
- s/\\$/\\/
- t loop
- p
- n
- }' -e '/^DIST_COMMON =/ p' Makefile.in > top.txt
+extract_distcommon Makefile.in > top.txt
+extract_distcommon tests/Makefile.in > inner.txt
-sed -n -e '/^DIST_COMMON =.*\\$/ {
- :loop
- p
- n
- t clear
- :clear
- s/\\$/\\/
- t loop
- p
- n
- }' -e '/^DIST_COMMON =/ p' tests/Makefile.in > inner.txt
+# might be useful for debugging
+cat top.txt
+cat inner.txt
test 0 = `grep tests top.txt | wc -l`
test 1 = `grep wrapper inner.txt | wc -l`
+
+:
#! /bin/sh
-# Copyright (C) 2003, 2004, 2006 Free Software Foundation, Inc.
+# Copyright (C) 2003, 2004, 2006, 2010 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# are added to the top-level DIST_COMMON even with --no-force.
# This is similar to distcom2.test, but with --no-force added.
# Report from Scott James Remnant (Debian #206299).
+# Please keep this in sync with sister test 'distcom2.test'.
. ./defs || Exit 1
rm -f compile depcomp
$ACLOCAL
-$AUTOCONF
$AUTOMAKE --add-missing --no-force
test -f compile
t loop
p
n
- }' -e '/^DIST_COMMON =/ p' Makefile.in | grep compile
+ }' -e 's/$/ /' -e '/^DIST_COMMON =/p' Makefile.in > dc.txt
-sed -n -e '/^DIST_COMMON =.*\\$/ {
- :loop
- p
- n
- t clear
- :clear
- s/\\$/\\/
- t loop
- p
- n
- }' -e '/^DIST_COMMON =/ p' Makefile.in | grep depcomp
+cat dc.txt # might be useful for debugging
+
+$FGREP ' compile ' dc.txt
+$FGREP ' depcomp ' dc.txt
+
+:
rm -f depcomp
mkdir subdir
-echo bin_PROGRAMS = foo > subdir/Makefile.am
+cat > subdir/Makefile.am << 'END'
+bin_PROGRAMS = foo
+END
+
: > subdir/foo.c
$ACLOCAL
AUTOMAKE_fails --add-missing subdir/Makefile
grep 'full run' stderr
+
+:
#! /bin/sh
-# Copyright (C) 1996, 2001, 2002, 2003, 2006, 2007, 2009 Free Software
-# Foundation, Inc.
+# Copyright (C) 1996, 2001, 2002, 2003, 2006, 2007, 2009, 2010 Free
+# Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
set -e
-echo AC_OUTPUT >>configure.in
+cat >> configure.in << 'END'
+AC_OUTPUT
+END
cat > Makefile.am << 'END'
include_HEADERS = some/file another/sub/subsub/file2 yet/another/file3
# Check to make sure `foo' isn't made in build directory.
test -d foo && Exit 1
-rm -rf distdir-1.0
+rm -rf $me-1.0
# Remove the dot from VERSION for the next grep.
-VERSION=10 MKDIR_P='echo MKDIR_P' $MAKE -e distdir >make.log || :
+VERSION=10 MKDIR_P='echo MKDIR_P' $MAKE -e distdir >stdout || :
+cat stdout
# Make sure no `./' appear in the directory names. srcdir is `..', so
# this also checks that no directory is created in the source tree.
-grep 'MKDIR_P.*\.' make.log && Exit 1
+grep 'MKDIR_P.*\.' stdout && Exit 1
cd ..
./configure --prefix "`pwd`"
$MAKE distcheck
-Exit 0
+:
ln -s "`pwd`/foo" quux
-echo AC_OUTPUT >>configure.in
+cat >> configure.in << 'END'
+AC_OUTPUT
+END
echo "me = $me" > Makefile.am # for better failure messages
cat >> Makefile.am << 'END'
./configure
$MAKE test
+
+:
#! /bin/sh
-# Copyright (C) 2001, 2002, 2004 Free Software Foundation, Inc.
+# Copyright (C) 2001, 2002, 2004, 2010 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
. ./defs || Exit 1
-cat > configure.in << 'END'
-AC_INIT(a.c)
-AM_INIT_AUTOMAKE(nonesuch, 0.23)
+set -e
+
+cat >> configure.in << 'END'
+AC_CONFIG_SRCDIR([a.c])
AC_PROG_CC
-AM_PROG_CC_C_O
-AC_OUTPUT(Makefile)
+AC_OUTPUT
END
cat > Makefile.am << 'END'
: > a.c
-set -e
-
$ACLOCAL
$AUTOCONF
$AUTOMAKE --include-deps --copy --add-missing
./configure
$MAKE dist
-gunzip nonesuch-0.23.tar.gz
-(tar tf nonesuch-0.23.tar | $FGREP './nonesuch-0.23/a.c') && Exit 1
-Exit 0
+gzip -d $me-1.0.tar.gz
+tar tf $me-1.0.tar > stdout || { cat stdout; Exit 1; }
+cat stdout
+$FGREP ./$me-1.0/a.c stdout && Exit 1
+
+: