* tests/aclocal7.test: Add `$sleep's between file touching
[automake/plouj.git] / tests / aclocal7.test
blobf6d5e315b18f53b45a4f62c59f537988f9343482
1 #! /bin/sh
2 # Copyright (C) 2003, 2006 Free Software Foundation, Inc.
4 # This file is part of GNU Automake.
6 # GNU Automake is free software; you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation; either version 2, or (at your option)
9 # any later version.
11 # GNU Automake is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU General Public License for more details.
16 # You should have received a copy of the GNU General Public License
17 # along with Automake; see the file COPYING. If not, write to
18 # the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19 # Boston, MA 02110-1301, USA.
21 # Make sure aclocal does not overwrite aclocal.m4 needlessly.
22 # Also make sure automake --no-force does not overwrite Makefile.in needlessly.
24 . ./defs || exit 1
26 set -e
28 cat >> configure.in << 'END'
29 SOME_DEFS
30 AC_CONFIG_FILES([sub/Makefile])
31 END
33 mkdir sub
34 : > sub/Makefile.am
36 cat >> Makefile.am << 'END'
37 SUBDIRS = sub
38 include fragment.inc
39 END
41 : > fragment.inc
43 mkdir m4
44 echo 'AC_DEFUN([SOME_DEFS], [])' > m4/somedefs.m4
46 $sleep
48 $ACLOCAL -I m4
50 # Automake will take aclocal.m4 to be newer if it has the same timestamp
51 # as Makefile.in. Avoid the confusing by sleeping.
52 $sleep
54 $AUTOMAKE --no-force
56 $sleep
58 touch foo
59 $ACLOCAL -I m4
60 $AUTOMAKE --no-force
62 # aclocal.m4 and Makefile.in should not have been updated, so `foo'
63 # should be younger
64 test `ls -1t aclocal.m4 Makefile.in sub/Makefile.in foo | sed 1q` = foo
66 $sleep
67 $ACLOCAL -I m4 --force
68 test `ls -1t aclocal.m4 foo | sed 1q` = aclocal.m4
69 # We still use --no-force for automake, but since aclocal.m4 has
70 # changed all Makefile.ins should be updated.
71 $sleep
72 $AUTOMAKE --no-force
73 test `ls -1t Makefile.in foo | sed 1q` = Makefile.in
74 test `ls -1t sub/Makefile.in foo | sed 1q` = sub/Makefile.in
76 touch m4/somedefs.m4
77 $sleep
78 touch foo
79 $sleep
80 $ACLOCAL -I m4
81 $sleep
82 $AUTOMAKE --no-force
84 # aclocal.m4 should have been updated, although its contents haven't changed.
85 test `ls -1t aclocal.m4 foo | sed 1q` = aclocal.m4
86 test `ls -1t Makefile.in foo | sed 1q` = Makefile.in
87 test `ls -1t sub/Makefile.in foo | sed 1q` = sub/Makefile.in
89 touch fragment.inc
90 $sleep
91 touch foo
92 $sleep
93 $ACLOCAL -I m4
94 $AUTOMAKE --no-force
95 # Only ./Makefile.in should change.
96 test `ls -1t aclocal.m4 foo | sed 1q` = foo
97 test `ls -1t Makefile.in foo | sed 1q` = Makefile.in
98 test `ls -1t sub/Makefile.in foo | sed 1q` = foo
100 grep README Makefile.in && exit 1
102 : > README
103 $sleep
104 touch foo
105 $sleep
106 $AUTOMAKE --no-force
107 # Even if no dependency change, the content changed.
108 test `ls -1t Makefile.in foo | sed 1q` = Makefile.in
109 test `ls -1t sub/Makefile.in foo | sed 1q` = foo
111 grep README Makefile.in
113 : > sub/Makefile.in
114 $sleep
115 touch foo
116 $sleep
117 $ACLOCAL -I m4
118 $AUTOMAKE --no-force
119 # Only sub/Makefile.in should change.
120 test `ls -1t aclocal.m4 foo | sed 1q` = foo
121 test `ls -1t Makefile.in foo | sed 1q` = foo
122 test `ls -1t sub/Makefile.in foo | sed 1q` = sub/Makefile.in