tests: fix a timestamp-related spurious failures
[automake.git] / tests / aclocal-path-install-serial.test
blob511ccee31a0aa7af1506187a4eb400d69d1fb522
1 #! /bin/sh
2 # Copyright (C) 2011 Free Software Foundation, Inc.
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.
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.
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/>.
17 # ACLOCAL_PATH, acdir and `--install' interactions when serial number
18 # are involved.
20 am_create_testdir=empty
21 . ./defs || Exit 1
23 set -e
25 cat > configure.in << 'END'
26 AC_INIT
27 AM_FOO
28 END
30 set_serial ()
32 serial=$1 file=$2
33 sed '/^# serial/d' $file > t
34 case $serial in
35 none) mv -f t $file;;
36 *) (echo "# serial $serial" && cat t) > $file; rm -f t;;
37 esac
38 cat $file # For debugging.
41 win ()
43 case $1 in
44 sdir) ok=sdir ko=pdir;;
45 pdir) ok=pdir ko=sdir;;
46 *) fatal_ "win(): invalud argument \`$1'";;
47 esac
48 # This is required on fast machine, to avoid caching and timestamp
49 # issues with the autotools (already happened in practice).
50 rm -rf configure aclocal.m4 autom4te*.cache m4/*
51 $ACLOCAL -I m4 --install
52 test -f m4/foo.m4 # Sanity check.
53 $AUTOCONF
54 $FGREP "::$ok:" m4/foo.m4
55 $FGREP "::$ok::" configure
56 $FGREP "::$ko::" m4/foo.m4 configure && Exit 1
60 mkdir sdir pdir m4
62 ACLOCAL="$ACLOCAL --system-acdir=`pwd`/sdir"
63 ACLOCAL_PATH=./pdir; export ACLOCAL_PATH
65 cat > sdir/foo.m4 << 'END'
66 AC_DEFUN([AM_FOO], [::sdir::])
67 END
68 cat > pdir/foo.m4 << 'END'
69 AC_DEFUN([AM_FOO], [::pdir::])
70 END
72 set_serial 2 sdir/foo.m4
73 set_serial 1 pdir/foo.m4
74 win sdir
76 set_serial 3.3 sdir/foo.m4
77 set_serial 5.7 pdir/foo.m4
78 win pdir
80 set_serial 0 sdir/foo.m4
81 set_serial none pdir/foo.m4
82 win sdir
84 set_serial none sdir/foo.m4
85 set_serial 1.2.3 pdir/foo.m4
86 win pdir