>From 848256f2d7057836be33e3abf84d082122a44c74 Mon Sep 17 00:00:00 2001
Message-Id:
From: Stefano Lattarini
Date: Mon, 27 Feb 2012 09:28:47 +0100
Subject: [PATCH] coverage: --program-transform shouldn't transform too much
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Stemmed from a report by Vladimir 'Ï-coder/phcoder' Serbinenko:
* tests/transform3.test: New test, checking that --program-transform
does not transform too much stuff (in particular, pkglibexecdir,
pgklibdir and pkgdatadir).
* tests/list-of-tests.mk: Add it.
* THANKS: Update.
---
THANKS | 1 +
tests/list-of-tests.mk | 1 +
tests/transform3.test | 87 ++++++++++++++++++++++++++++++++++++++++++++++++
3 files changed, 89 insertions(+), 0 deletions(-)
create mode 100755 tests/transform3.test
diff --git a/THANKS b/THANKS
index 7b7c9df..1bc3a80 100644
--- a/THANKS
+++ b/THANKS
@@ -370,6 +370,7 @@ Ulrich Eckhardt address@hidden
Václav Haisman address@hidden
Vadim Zeitlin address@hidden
Vincent Lefevre address@hidden
+Vladimir Serbinenko address@hidden
Volker Boerchers address@hidden
Werner John address@hidden
Werner Koch address@hidden
diff --git a/tests/list-of-tests.mk b/tests/list-of-tests.mk
index 89cff2f..0e5ee29 100644
--- a/tests/list-of-tests.mk
+++ b/tests/list-of-tests.mk
@@ -1144,6 +1144,7 @@ txinfo33.test \
txinfo-unrecognized-extension.test \
transform.test \
transform2.test \
+transform3.test \
uninstall-fail.test \
uninstall-pr9578.test \
unused.test \
diff --git a/tests/transform3.test b/tests/transform3.test
new file mode 100755
index 0000000..0fcf9bd
--- /dev/null
+++ b/tests/transform3.test
@@ -0,0 +1,87 @@
+#! /bin/sh
+# Copyright (C) 2002-2012 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
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see .
+
+# Make sure that --program-transform does not transform too much
+# stuff (in particular, pgklibdir, pkgdatadir and pkglibexecdir).
+
+required=cc
+. ./defs || Exit 1
+
+cat > configure.ac <<'END'
+AC_INIT([foo], [1.0])
+AM_INIT_AUTOMAKE
+AC_CONFIG_FILES([Makefile])
+AC_PROG_CC
+AM_PROG_AR
+AC_PROG_RANLIB
+AC_OUTPUT
+END
+
+cat > Makefile.am <<'END'
+bin_SCRIPTS = foo
+pkgdata_DATA = bar.txt
+pkglib_LIBRARIES = libzap.a
+pkglibexec_SCRIPTS = mu
+END
+
+cat > libzap.c <<'END'
+int zap (void)
+{
+ return 0;
+}
+END
+
+echo 'To be or not to be ...' > bar.txt
+
+cat > foo <<'END'
+#!/bin/sh
+exit 0
+END
+cp foo mu
+chmod a+x foo mu
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE -a
+
+./configure --program-prefix=gnu- --prefix "`pwd`/inst"
+
+$MAKE install
+find inst # For debugging.
+test -f inst/bin/gnu-foo
+test -x inst/bin/gnu-foo
+test -f inst/share/foo/bar.txt
+test ! -d inst/share/gnu-foo
+test -f inst/lib/foo/libzap.a
+test ! -d inst/lib/gnu-foo
+test -f inst/libexec/foo/gnu-mu
+test -x inst/libexec/foo/gnu-mu
+test ! -d inst/libexec/gnu-foo
+
+$MAKE uninstall
+test `find inst -type f -print | wc -l` = 0
+
+# Opportunistically test for installdirs.
+rm -rf inst
+$MAKE installdirs
+test -d inst/share/foo
+test ! -d inst/share/gnu-foo
+test -d inst/lib/foo
+test ! -d inst/lib/gnu-foo
+test -d inst/libexec/foo
+test ! -d inst/libexec/gnu-foo
+
+:
--
1.7.9