tests: avoid a spurious failure on MSYS
[platform/upstream/automake.git] / t / insthook.sh
old mode 100755 (executable)
new mode 100644 (file)
index 23bc4e0..d2558e2
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2003-2012 Free Software Foundation, Inc.
+# Copyright (C) 2003-2013 Free Software Foundation, Inc.
 #
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -16,7 +16,7 @@
 
 # Make sure the install-exec-hook example we give in the manual works.
 
-. ./defs || Exit 1
+. test-init.sh
 
 cat >>configure.ac <<'EOF'
 AC_PROG_LN_S
@@ -27,9 +27,9 @@ cat >Makefile.am <<'END'
 dist_bin_SCRIPTS = foo
 
 install-exec-hook:
-       cd "$(DESTDIR)$(bindir)" && \
-       mv -f foo foo-$(VERSION) && \
-       $(LN_S) foo-$(VERSION) foo
+       cd "$(DESTDIR)$(bindir)" \
+         && mv -f foo foo-$(VERSION) \
+         && $(LN_S) foo-$(VERSION) foo
 
 installcheck-local:
        test -f "$(bindir)/foo"
@@ -40,7 +40,7 @@ uninstall-hook:
        rm -f $(DESTDIR)$(bindir)/foo-$(VERSION)
 END
 
-echo 1 > foo
+echo a > foo
 
 $ACLOCAL
 $AUTOCONF
@@ -56,13 +56,13 @@ test -f ok
 # second version will overwrite 'foo'.  Hopefully 'install' and 'install-sh'
 # are smart enough to erase the 'foo' symlink before installing the new
 # version.)
-./configure "--bindir=`pwd`/bin"
+./configure "--bindir=$(pwd)/bin"
 $MAKE install
-echo 2 > foo
-VERSION=2.0 $MAKE -e install
-grep 1 bin/foo-1.0
-grep 2 bin/foo-2.0
-grep 2 bin/foo
+echo b > foo
+run_make VERSION=2.0 install
+test $(cat bin/foo-1.0) = a
+test $(cat bin/foo-2.0) = b
+test $(cat bin/foo)     = b
 
 # install-hook is an error.
 cat >>Makefile.am <<EOF