Merge branch 'elisp-work'
[platform/upstream/automake.git] / t / ax / tap-setup.sh
1 #! /bin/sh
2 # Copyright (C) 2011-2012 Free Software Foundation, Inc.
3 #
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.
8 #
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.
13 #
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/>.
16
17 # Auxiliary shell script that copies the common data and files used by
18 # many tests on TAP support into the current directory.  It should be
19 # sourced by client test scripts, and assumes the auxiliary test
20 # 'tap-common-setup.test' has been run beforehand (it will error out
21 # if this is not the case).
22
23 # Check that we are running from a proper directory: last thing we want
24 # is to overwrite some random user files.
25 test -f ../../automake && test -f ../../defs && test -d ../../t \
26   || fatal_ "running from a wrong directory"
27
28 test ! -f Makefile.am || mv Makefile.am Makefile.am~ \
29   || fatal_ "failed to save Makefile.am"
30
31 test -d ../tap-common-setup.dir && cp -fpR ../tap-common-setup.dir/* . \
32   || fatal_ "couldn't get precomputed data files"
33
34 fetch_tap_driver
35
36 if test -f Makefile.am~; then
37   mv -f Makefile.am~ Makefile.am \
38     || fatal_ "failed to restore Makefile.am"
39   echo 'TEST_LOG_DRIVER = $(PERL) $(srcdir)/tap-driver' >> Makefile.am \
40     || fatal_ "failed to update Makefile.am"
41   $AUTOMAKE Makefile \
42     || fatal_ "failed to remake Makefile.in"
43   ./config.status Makefile \
44     || fatal_ "failed to remake Makefile"
45 fi
46
47 :