xfstests: Automatic build dependency calculations
[xfstests-dev.git] / remake
1 #! /bin/sh
2 #
3 # Copyright (c) 2000-2001 Silicon Graphics, Inc.  All Rights Reserved.
4 #
5 # This program is free software; you can redistribute it and/or
6 # modify it under the terms of the GNU General Public License as
7 # published by the Free Software Foundation.
8 #
9 # This program is distributed in the hope that it would 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, write the Free Software Foundation,
16 # Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
17 #
18 #
19 # Rebuild NNN.out files
20 #
21 # $Header: /build2/depot/linux/pcp/dev/qa/RCS/remake,v 2.11 1999/09/20 03:42:19 kenmcd Exp $
22 #
23
24 tmp=/tmp/$$
25 trap "rm -f NO-PREVIOUS-OUTPUT $tmp.*; exit" 0 1 2 3 15
26
27 # generic initialization
28 iam=remake
29 . ./common.rc
30
31 . ./common
32
33 [ -f check.time ] || touch check.time
34
35 for seq in $list
36 do
37     if [ ! -f $seq ]
38     then
39         echo "Remake: cannot find \"$seq\""
40     else
41         echo -n "$seq"
42         lasttime=`sed -n -e "/^$seq /s/.* //p" <check.time`
43         [ "X$lasttime" != X ] && echo -n " ${lasttime}s"
44         rm -f $seq.bak $seq.full.bak
45         if sh $seq >$seq.new 2>&1
46         then
47             if [ -f $seq.out ]
48             then
49                 $diff $seq.out $seq.new
50                 rm -f $seq.out.bad
51             else
52                 touch NO-PREVIOUS-OUTPUT
53                 $diff NO-PREVIOUS-OUTPUT $seq.new
54                 rm -f NO-PREVIOUS-OUTPUT
55             fi
56             echo ""
57             [ -f $seq.out ] && mv $seq.out $seq.bak
58             if [ -f $seq.full ]
59             then
60                 [ -f $seq.full.ok ] && mv $seq.full.ok $seq.full.bak
61                 mv $seq.full $seq.full.ok
62             fi
63             mv $seq.new $seq.out
64         else
65             echo " - failed (exit status $?)"
66             sed 's/^/   /' $seq.new
67             exit 1
68         fi
69     fi
70 done
71
72 exit 0