2 # mdemo-dryrun.test - check whether the --dry-run mode works properly
4 # Copyright (C) 2003, 2004 Free Software Foundation, Inc.
5 # Written by Gary V. Vaughan, 2003
7 # This file is part of GNU Libtool.
9 # GNU Libtool is free software; you can redistribute it and/or
10 # modify it under the terms of the GNU General Public License as
11 # published by the Free Software Foundation; either version 2 of
12 # the License, or (at your option) any later version.
14 # GNU Libtool is distributed in the hope that it will be useful,
15 # but WITHOUT ANY WARRANTY; without even the implied warranty of
16 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 # GNU General Public License for more details.
19 # You should have received a copy of the GNU General Public License
20 # along with GNU Libtool; see the file COPYING. If not, a copy
21 # can be downloaded from http://www.gnu.org/licenses/gpl.html,
22 # or obtained by writing to the Free Software Foundation, Inc.,
23 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
26 . tests/defs || exit 1
28 func_require "mdemo-conf" "tests/mdemo/Makefile"
34 # create `before' and `after' in a directory deep within objdir,
35 # so that their creation and removal does not modify even a timestamp
36 # in the output of `ls -l . $objdir'
37 func_mkdir_p "$objdir/temp/temp"
38 before=$objdir/temp/temp/before
39 after=$objdir/temp/temp/after
41 # Create a new libtool script that will enter dry run if the environment
42 # variable force_dry_run is set
43 rm -f $objdir/libtool.new
44 sed 's/^opt_dry_run=.*$/opt_dry_run=${force_dry_run-false}/' < libtool > $objdir/libtool.new
45 chmod +x $objdir/libtool.new
46 mv libtool $objdir/libtool
47 mv $objdir/libtool.new libtool
49 # main.o is not compiled with libtool, but it depends on it, so make
50 # sure it is up-to-date. libfoo2.la is linked with libsub.la, so make
51 # sure it exists, otherwise libtool will complain.
52 func_make main.$objext
54 func_msg "Making object files in mdemo (dry run)"
55 # ls -l in MSYS sometimes shows year, not time, for really fresh files.
57 ls -l . $objdir | grep -v total > $before
58 force_dry_run=: $MAKE foo1.lo foo2.lo sub.lo || exit $?
59 ls -l . $objdir | grep -v total > $after
60 cmp $before $after > /dev/null || exit 1
61 # Now really make them
62 func_make foo1.lo foo2.lo libsub.la
64 func_msg "Making libraries in mdemo (dry run)"
65 # ls -l in MSYS sometimes shows year, not time, for really fresh files.
67 ls -l . $objdir | grep -v total > $before
68 force_dry_run=: $MAKE foo1.la libfoo2.la || exit $?
69 ls -l . $objdir | grep -v total > $after
70 cmp $before $after > /dev/null || exit 1
71 # Now really make them
72 func_make foo1.la libfoo2.la
74 func_msg "Making programs in ../mdemo (dry run)"
75 # ls -l in MSYS sometimes shows year, not time, for really fresh files.
77 ls -l . $objdir | grep -v total > $before
78 force_dry_run=: $MAKE mdemo$EXEEXT mdemo_static$EXEEXT 1>&2 || exit $?
79 ls -l . $objdir | grep -v total > $after
80 cmp $before $after > /dev/null || exit 1
81 # Now really make them
82 func_make mdemo$EXEEXT mdemo_static$EXEEXT
84 func_msg "Running $MAKE install in ../mdemo (dry run)"
85 # Libtool does not create these directories
86 func_mkdir_p "$prefix/bin"
87 func_mkdir_p "$prefix/lib"
88 # ls -l in MSYS sometimes shows year, not time, for really fresh files.
90 ls -l . $objdir | grep -v total > $before
91 ls -lR $prefix | grep -v total >> $before
92 force_dry_run=: $MAKE install 1>&2 || exit 1
93 ls -l . $objdir | grep -v total > $after
94 ls -lR $prefix | grep -v total >> $after
95 cmp $before $after > /dev/null || exit 1
99 func_msg "Running $MAKE uninstall in ../mdemo (dry run)"
100 # Libtool does not uninstall the programs, remove them first
101 rm -f "$prefix/bin/mdemo$EXEEXT" "$prefix/bin/mdemo_static$EXEEXT"
102 # ls -l in MSYS sometimes shows year, not time, for really fresh files.
104 ls -l . $objdir | grep -v total > $before
105 ls -lR $prefix | grep -v total >> $before
106 force_dry_run=: $MAKE uninstall 1>&2 || exit $?
107 ls -l . $objdir | grep -v total > $after
108 ls -lR $prefix | grep -v total >> $after
109 cmp $before $after > /dev/null || exit 1
113 rm -f $before $after libtool
114 mv $objdir/libtool libtool