automake-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] Test `$(var:suf=rpl)' expansion in special automake variables.


From: Stefano Lattarini
Subject: [PATCH] Test `$(var:suf=rpl)' expansion in special automake variables.
Date: Thu, 9 Dec 2010 13:46:48 +0100
User-agent: KMail/1.13.3 (Linux/2.6.30-2-686; KDE/4.4.4; i686; ; )

Another testsuite-enhancing patch, based off of maint and intended for
master.

Tested with Solaris 10 XPG4 make, Solaris 10 CCS make, Solaris 10 dmake,
Heirloom make, GNU make from 3.79 up to 3.82, with the Debian ports of
NetBSD make and FreeBSD make, with dash 0.5.2, bash 2.0, bash 4.1, pdksh,
Solaris 10 /bin/sh and Heirloom shell.

I'll wait the customary 72 hours (until sunday evening) before
pushing.

Regards,
   Stefano

-*-*-*-

Test `$(var:suf=rpl)' expansion in special automake variables.

* tests/posixsubst-data.test: New test.
* tests/posixsubst-extradist.test: Likewise.
* tests/posixsubst-ldadd.test: Likewise.
* tests/posixsubst-libraries.test: Likewise.
* tests/posixsubst-ltlibraries.test: Likewise.
* tests/posixsubst-programs.test: Likewise.
* tests/posixsubst-scripts.test: Likewise.
* tests/posixsubst-sources.test: Likewise.
* tests/posixsubst-tests.test: Likewise.
* tests/Makefile.am (TESTS): Update.
---
 ChangeLog                         |   14 ++++++
 tests/Makefile.am                 |    9 ++++
 tests/Makefile.in                 |   10 ++++
 tests/posixsubst-data.test        |   76 +++++++++++++++++++++++++++++++
 tests/posixsubst-extradist.test   |   56 +++++++++++++++++++++++
 tests/posixsubst-ldadd.test       |   78 ++++++++++++++++++++++++++++++++
 tests/posixsubst-libraries.test   |   65 +++++++++++++++++++++++++++
 tests/posixsubst-ltlibraries.test |   67 ++++++++++++++++++++++++++++
 tests/posixsubst-programs.test    |   64 ++++++++++++++++++++++++++
 tests/posixsubst-scripts.test     |   89 +++++++++++++++++++++++++++++++++++++
 tests/posixsubst-sources.test     |   82 ++++++++++++++++++++++++++++++++++
 tests/posixsubst-tests.test       |   70 +++++++++++++++++++++++++++++
 12 files changed, 680 insertions(+), 0 deletions(-)
 create mode 100755 tests/posixsubst-data.test
 create mode 100755 tests/posixsubst-extradist.test
 create mode 100755 tests/posixsubst-ldadd.test
 create mode 100755 tests/posixsubst-libraries.test
 create mode 100755 tests/posixsubst-ltlibraries.test
 create mode 100755 tests/posixsubst-programs.test
 create mode 100755 tests/posixsubst-scripts.test
 create mode 100755 tests/posixsubst-sources.test
 create mode 100755 tests/posixsubst-tests.test
From 9e44e6449112c79a4fe097854207ba52dd17d391 Mon Sep 17 00:00:00 2001
From: Stefano Lattarini <address@hidden>
Date: Tue, 30 Nov 2010 12:22:25 +0100
Subject: [PATCH] Test `$(var:suf=rpl)' expansion in special automake variables.

* tests/posixsubst-data.test: New test.
* tests/posixsubst-extradist.test: Likewise.
* tests/posixsubst-ldadd.test: Likewise.
* tests/posixsubst-libraries.test: Likewise.
* tests/posixsubst-ltlibraries.test: Likewise.
* tests/posixsubst-programs.test: Likewise.
* tests/posixsubst-scripts.test: Likewise.
* tests/posixsubst-sources.test: Likewise.
* tests/posixsubst-tests.test: Likewise.
* tests/Makefile.am (TESTS): Update.
---
 ChangeLog                         |   14 ++++++
 tests/Makefile.am                 |    9 ++++
 tests/Makefile.in                 |   10 ++++
 tests/posixsubst-data.test        |   76 +++++++++++++++++++++++++++++++
 tests/posixsubst-extradist.test   |   56 +++++++++++++++++++++++
 tests/posixsubst-ldadd.test       |   78 ++++++++++++++++++++++++++++++++
 tests/posixsubst-libraries.test   |   65 +++++++++++++++++++++++++++
 tests/posixsubst-ltlibraries.test |   67 ++++++++++++++++++++++++++++
 tests/posixsubst-programs.test    |   64 ++++++++++++++++++++++++++
 tests/posixsubst-scripts.test     |   89 +++++++++++++++++++++++++++++++++++++
 tests/posixsubst-sources.test     |   82 ++++++++++++++++++++++++++++++++++
 tests/posixsubst-tests.test       |   70 +++++++++++++++++++++++++++++
 12 files changed, 680 insertions(+), 0 deletions(-)
 create mode 100755 tests/posixsubst-data.test
 create mode 100755 tests/posixsubst-extradist.test
 create mode 100755 tests/posixsubst-ldadd.test
 create mode 100755 tests/posixsubst-libraries.test
 create mode 100755 tests/posixsubst-ltlibraries.test
 create mode 100755 tests/posixsubst-programs.test
 create mode 100755 tests/posixsubst-scripts.test
 create mode 100755 tests/posixsubst-sources.test
 create mode 100755 tests/posixsubst-tests.test

diff --git a/ChangeLog b/ChangeLog
index e8864f1..3088682 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,17 @@
+2010-12-08  Stefano Lattarini  <address@hidden>
+
+       Test `$(var:suf=rpl)' expansion in special automake variables.
+       * tests/posixsubst-data.test: New test.
+       * tests/posixsubst-extradist.test: Likewise.
+       * tests/posixsubst-ldadd.test: Likewise.
+       * tests/posixsubst-libraries.test: Likewise.
+       * tests/posixsubst-ltlibraries.test: Likewise.
+       * tests/posixsubst-programs.test: Likewise.
+       * tests/posixsubst-scripts.test: Likewise.
+       * tests/posixsubst-sources.test: Likewise.
+       * tests/posixsubst-tests.test: Likewise.
+       * tests/Makefile.am (TESTS): Update.
+
 2010-11-25  Stefano Lattarini  <address@hidden>
 
        Fix spurious failures in `silent*.test' for $CC != gcc
diff --git a/tests/Makefile.am b/tests/Makefile.am
index dab04e3..7dc893d 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -571,6 +571,15 @@ pluseq8.test \
 pluseq9.test \
 pluseq10.test \
 pluseq11.test \
+posixsubst-data.test \
+posixsubst-extradist.test \
+posixsubst-ldadd.test \
+posixsubst-libraries.test \
+posixsubst-ltlibraries.test \
+posixsubst-programs.test \
+posixsubst-scripts.test \
+posixsubst-sources.test \
+posixsubst-tests.test \
 postproc.test \
 ppf77.test \
 pr2.test \
diff --git a/tests/Makefile.in b/tests/Makefile.in
index de21f43..beed1a1 100644
--- a/tests/Makefile.in
+++ b/tests/Makefile.in
@@ -298,6 +298,7 @@ dejagnu-p.test \
 exeext4-p.test \
 maken3-p.test \
 maken4-p.test \
+posixsubst-tests-p.test \
 pr401-p.test \
 pr401b-p.test \
 pr401c-p.test
@@ -838,6 +839,15 @@ pluseq8.test \
 pluseq9.test \
 pluseq10.test \
 pluseq11.test \
+posixsubst-data.test \
+posixsubst-extradist.test \
+posixsubst-ldadd.test \
+posixsubst-libraries.test \
+posixsubst-ltlibraries.test \
+posixsubst-programs.test \
+posixsubst-scripts.test \
+posixsubst-sources.test \
+posixsubst-tests.test \
 postproc.test \
 ppf77.test \
 pr2.test \
diff --git a/tests/posixsubst-data.test b/tests/posixsubst-data.test
new file mode 100755
index 0000000..13d05b6
--- /dev/null
+++ b/tests/posixsubst-data.test
@@ -0,0 +1,76 @@
+#! /bin/sh
+# Copyright (C) 2010 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 <http://www.gnu.org/licenses/>.
+
+# Test that POSIX variable expansion `$(var:str=rpl)' works
+# in when used with the DATA primary.
+
+. ./defs || Exit 1
+
+set -e
+
+cat >> configure.in << 'END'
+AC_OUTPUT
+END
+
+cat > Makefile.am << 'END'
+foodir = $(prefix)
+
+t1 = foo1 foo2
+t2 = barx
+t3 = baz.y
+
+bar.data bazzardoz:
+       : > $@
+CLEANFILES = bar.data bazzardoz
+
+# Try also with `:=', to ensure the parser is not unduly confused
+# into thinking that it's an unportable assignement operator.
+dist_foo_DATA = $(t1:=.txt)
+foo_DATA = $(t2:x=.data)
+nodist_foo_DATA = $(t3:.y=zardoz)
+
+check-local: test
+.PHONY: test
+test: distdir
+       ls -l $(distdir)
+       test ! -r $(distdir)/foo.data
+       test ! -r $(distdir)/bazzardoz
+
+installcheck-local:
+       ls -l $(prefix)
+       test -f $(prefix)/foo1.txt
+       test -f $(prefix)/foo2.txt
+       test -f $(prefix)/bar.data
+       test -f $(prefix)/bazzardoz
+END
+
+: > foo1.txt
+: > foo2.txt
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE
+
+cwd=`pwd` || Exit 1
+./configure --prefix="$cwd/_inst"
+$MAKE install
+test -f bar.data
+test -f bazzardoz
+$MAKE test
+$MAKE installcheck
+$MAKE distcheck
+
+:
diff --git a/tests/posixsubst-extradist.test b/tests/posixsubst-extradist.test
new file mode 100755
index 0000000..3509575
--- /dev/null
+++ b/tests/posixsubst-extradist.test
@@ -0,0 +1,56 @@
+#! /bin/sh
+# Copyright (C) 2010 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 <http://www.gnu.org/licenses/>.
+
+# Test that POSIX variable expansion `$(var:str=rpl)' works when used
+# in EXTRA_DIST.
+
+. ./defs || Exit 1
+
+set -e
+
+cat >> configure.in << 'END'
+AC_OUTPUT
+END
+
+cat > Makefile.am << 'END'
+t1 = foo1 foo2
+t2 = bar.x
+t3 = baz-y
+# Try also with `:=', to ensure the parser is not unduly confused
+# into thinking that it's an unportable assignement operator.
+EXTRA_DIST = $(t1:=.c) $(t2:.x=.f) $(t3:-y=ar)
+bazar bar.f:
+       : > $@
+.PHONY: test
+test: distdir
+       ls -l $(distdir)
+       test -f $(distdir)/foo1.c
+       test -f $(distdir)/foo2.c
+       test -f $(distdir)/bar.f
+       test -f $(distdir)/bazar
+END
+
+: > foo1.c
+: > foo2.c
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE
+
+./configure
+$MAKE test
+
+:
diff --git a/tests/posixsubst-ldadd.test b/tests/posixsubst-ldadd.test
new file mode 100755
index 0000000..d4c5a7e
--- /dev/null
+++ b/tests/posixsubst-ldadd.test
@@ -0,0 +1,78 @@
+#! /bin/sh
+# Copyright (C) 2010 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 <http://www.gnu.org/licenses/>.
+
+# Test that POSIX variable expansion `$(var:str=rpl)' works
+# in when used in LDADD.
+
+. ./defs || Exit 1
+
+set -e
+
+cat >> configure.in << 'END'
+AC_PROG_CC
+AC_PROG_RANLIB
+AC_OUTPUT
+END
+
+cat > Makefile.am << 'END'
+u = libquux1.lib libquux2.lib
+v = libquux1
+w = none
+
+zardozdir = $(prefix)/zardoz
+zardoz_PROGRAMS = foo bar
+
+noinst_LIBRARIES = libquux1.a libquux2.a libquux3.a
+
+# Try also with `:=', to ensure the parser is not unduly confused
+# into thinking that it's an unportable assignement operator.
+LDADD = $(u:.lib=.a)
+bar_LDADD = $(v:=.a) libquux2.a $(w:none=libquux3.a)
+
+libquux1.c:
+       echo 'int quux1(void) { return 0; }' > $@
+CLEANFILES = libquux1.c # for FreeBSD make
+END
+
+cat > foo.c <<'END'
+int main(void)
+{
+  int quux1(void), quux2(void);
+  return quux1() + quux2();
+}
+END
+
+cat > bar.c <<'END'
+int main(void)
+{
+  int quux1(void), quux2(void), quux3(void);
+  return quux1() + quux2() + quux3();
+}
+END
+
+echo 'int quux2(void) { return 0; }' > libquux2.c
+echo 'int quux3(void) { return 0; }' > libquux3.c
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE
+
+./configure
+$MAKE
+test -f libquux1.c
+$MAKE distcheck
+
+:
diff --git a/tests/posixsubst-libraries.test b/tests/posixsubst-libraries.test
new file mode 100755
index 0000000..23e7e78
--- /dev/null
+++ b/tests/posixsubst-libraries.test
@@ -0,0 +1,65 @@
+#! /bin/sh
+# Copyright (C) 2010 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 <http://www.gnu.org/licenses/>.
+
+# Test that POSIX variable expansion `$(var:str=rpl)' works when used
+# with the LIBRARIES primary in a "simple" way.
+# Keep this in sync with sister test `posixsubst-ltlibraries.test'.
+
+. ./defs || Exit 1
+
+set -e
+
+cat >> configure.in << 'END'
+AC_PROG_CC
+AC_PROG_RANLIB
+AC_OUTPUT
+END
+
+cat > Makefile.am << 'END'
+foolibs = libfoo1 libfoo2
+barlibs = libbaz
+
+# Try also with `:=', to ensure the parser is not unduly confused
+# into thinking that it's an unportable assignement operator.
+lib_LIBRARIES = $(foolibs:=.a) $(barlibs:z=r.a)
+
+libbar.c:
+       echo 'int bar(void) { return 0; }' > $@
+CLEANFILES = libbar.c # for FreeBSD make
+
+installcheck-local:
+       ls -l $(prefix)/lib
+       test -f $(prefix)/lib/libfoo1.a
+       test -f $(prefix)/lib/libfoo2.a
+       test -f $(prefix)/lib/libbar.a
+END
+
+echo 'int bar1(void) { return 0; }' > libfoo1.c
+echo 'int bar2(void) { return 0; }' > libfoo2.c
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE
+
+cwd=`pwd` || Exit 1
+./configure --prefix="$cwd/_inst"
+$MAKE
+test -f libfoo2.c
+$MAKE install
+$MAKE installcheck
+$MAKE distcheck
+
+:
diff --git a/tests/posixsubst-ltlibraries.test 
b/tests/posixsubst-ltlibraries.test
new file mode 100755
index 0000000..7af1d93
--- /dev/null
+++ b/tests/posixsubst-ltlibraries.test
@@ -0,0 +1,67 @@
+#! /bin/sh
+# Copyright (C) 2010 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 <http://www.gnu.org/licenses/>.
+
+# Test that POSIX variable expansion `$(var:str=rpl)' works when used
+# with the LTLIBRARIES primary in a "simple" way.
+# Keep this in sync with sister test `posixsubst-libraries.test'.
+
+required='libtool libtoolize'
+. ./defs || Exit 1
+
+set -e
+
+cat >> configure.in << 'END'
+AC_PROG_CC
+AC_PROG_LIBTOOL
+AC_OUTPUT
+END
+
+cat > Makefile.am << 'END'
+foolibs = libfoo1 libfoo2
+barlibs = libbaz
+
+# Try also with `:=', to ensure the parser is not unduly confused
+# into thinking that it's an unportable assignement operator.
+lib_LTLIBRARIES = $(foolibs:=.la) $(barlibs:z=r.la)
+
+libbar.c:
+       echo 'int bar(void) { return 0; }' > $@
+CLEANFILES = libbar.c # for FreeBSD make
+
+installcheck-local:
+       ls -l $(prefix)/lib
+       test -f $(prefix)/lib/libfoo1.la
+       test -f $(prefix)/lib/libfoo2.la
+       test -f $(prefix)/lib/libbar.la
+END
+
+echo 'int bar1(void) { return 0; }' > libfoo1.c
+echo 'int bar2(void) { return 0; }' > libfoo2.c
+
+libtoolize
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE -a
+
+cwd=`pwd` || Exit 1
+./configure --prefix="$cwd/_inst"
+$MAKE
+test -f libfoo2.c
+$MAKE install
+$MAKE installcheck
+$MAKE distcheck
+
+:
diff --git a/tests/posixsubst-programs.test b/tests/posixsubst-programs.test
new file mode 100755
index 0000000..73e5479
--- /dev/null
+++ b/tests/posixsubst-programs.test
@@ -0,0 +1,64 @@
+#! /bin/sh
+# Copyright (C) 2010 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 <http://www.gnu.org/licenses/>.
+
+# Test that POSIX variable expansion `$(var:str=rpl)' works when used
+# with the PROGRAMS primary.
+
+. ./defs || Exit 1
+
+set -e
+
+cat >> configure.in << 'END'
+AC_PROG_CC
+AC_OUTPUT
+END
+
+cat > Makefile.am << 'END'
+t1 = foo1 foo2
+t2 = barx bar2
+
+# Try also with `:=', to ensure the parser is not unduly confused
+# into thinking that it's an unportable assignement operator.
+bin_PROGRAMS = $(t1:=-p) $(t2:2=y)
+
+installcheck-local:
+       ls -l $(prefix)/bin
+       test -f $(prefix)/bin/foo1-p$(EXEEXT)
+       test -x $(prefix)/bin/foo1-p$(EXEEXT)
+       test -f $(prefix)/bin/foo2-p$(EXEEXT)
+       test -x $(prefix)/bin/foo2-p$(EXEEXT)
+       test -f $(prefix)/bin/barx$(EXEEXT)
+       test -x $(prefix)/bin/barx$(EXEEXT)
+       test -f $(prefix)/bin/bary$(EXEEXT)
+       test -x $(prefix)/bin/bary$(EXEEXT)
+END
+
+for f in foo1-p.c foo2-p.c barx.c bary.c; do
+  echo 'int main(void) { return 0; }' > $f
+done
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE
+
+cwd=`pwd` || Exit 1
+./configure --prefix="$cwd/_inst"
+$MAKE
+$MAKE install
+$MAKE installcheck
+$MAKE distcheck
+
+:
diff --git a/tests/posixsubst-scripts.test b/tests/posixsubst-scripts.test
new file mode 100755
index 0000000..94b51af
--- /dev/null
+++ b/tests/posixsubst-scripts.test
@@ -0,0 +1,89 @@
+#! /bin/sh
+# Copyright (C) 2010 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 <http://www.gnu.org/licenses/>.
+
+# Test that POSIX variable expansion `$(var:str=rpl)' works when used
+# with the SCRIPTS primary.
+
+. ./defs || Exit 1
+
+set -e
+
+cat >> configure.in << 'END'
+AC_OUTPUT
+END
+
+cat > Makefile.am << 'END'
+t1 = foo1 foo2
+t2 = bar1x bar2
+t3 = quu-baz
+
+bar1 bar2 quux.pl:
+       : > $@
+CLEANFILES = bar1 bar2 quux.pl
+
+# Try also with `:=', to ensure the parser is not unduly confused
+# into thinking that it's an unportable assignement operator.
+dist_sbin_SCRIPTS = $(t1:=.sh)
+libexec_SCRIPTS = $(t2:x=)
+nodist_bin_SCRIPTS = $(t3:-baz=x.pl)
+
+check-local: test1 test2
+.PHONY: test1 test2
+test1:
+       ls -l
+       test -f bar1
+       test -f bar2
+       test -f quux.pl
+test2: distdir
+       ls -l $(distdir)
+       ## the scripts foo1.sh and foo2.sh should be distributed
+       test -f $(distdir)/foo1.sh
+       test -f $(distdir)/foo2.sh
+       ## the scripts bar1, bar2 and quux.pl shouldn't be distributed
+       test ! -r $(distdir)/bar1
+       test ! -r $(distdir)/bar2
+       test ! -r $(distdir)/quux.pl
+
+installcheck-local:
+       ls -l $(prefix)/libexec $(prefix)/bin $(prefix)/sbin
+       test -f $(prefix)/sbin/foo1.sh
+       test -x $(prefix)/sbin/foo1.sh
+       test -f $(prefix)/sbin/foo2.sh
+       test -x $(prefix)/sbin/foo2.sh
+       test -f $(prefix)/libexec/bar1
+       test -x $(prefix)/libexec/bar1
+       test -f $(prefix)/libexec/bar2
+       test -x $(prefix)/libexec/bar2
+       test -f $(prefix)/bin/quux.pl
+       test -x $(prefix)/bin/quux.pl
+END
+
+: > foo1.sh
+: > foo2.sh
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE
+
+cwd=`pwd` || Exit 1
+./configure --prefix="$cwd/_inst"
+$MAKE
+$MAKE test1 test2
+$MAKE install
+$MAKE installcheck
+$MAKE distcheck
+
+:
diff --git a/tests/posixsubst-sources.test b/tests/posixsubst-sources.test
new file mode 100755
index 0000000..bde7b6a
--- /dev/null
+++ b/tests/posixsubst-sources.test
@@ -0,0 +1,82 @@
+#! /bin/sh
+# Copyright (C) 2010 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 <http://www.gnu.org/licenses/>.
+
+# Test that POSIX variable expansion `$(var:str=rpl)' works when used
+# with the SOURCES primary.
+
+. ./defs || Exit 1
+
+set -e
+
+cat >> configure.in << 'END'
+AC_PROG_CC
+AC_OUTPUT
+END
+
+cat > Makefile.am << 'END'
+bin_PROGRAMS = foo
+
+FOO = foo.cxx
+BAR = bar__
+BAZ = baz.
+
+# Try also with `:=', to ensure the parser is not unduly confused
+# into thinking that it's an unportable assignement operator.
+foo_SOURCES = main.c $(FOO:.cxx=.c)
+dist_foo_SOURCES = $(BAR:__=.c)
+nodist_foo_SOURCES = $(BAZ:=c)
+
+bar.c baz.c:
+       echo 'int $@ (void) { return 0; }' | sed 's/\.c //' > $@
+CLEANFILES = baz.c
+CLEANFILES += bar.c # for FreeBSD make
+
+.PHONY: test test2
+check-local: test1 test2
+test1:
+       ls -l . $(srcdir)
+       test -f $(srcdir)/bar.c
+       test -f baz.c
+test2: distdir
+       ls -l $(distdir)
+       ## these sources should be distributed ...
+       test -f $(distdir)/bar.c
+       test -f $(distdir)/foo.c
+       test -f $(distdir)/main.c
+       ## ... and this shouldn't
+       test ! -r $(distdir)/baz.c
+END
+
+cat > main.c <<'END'
+int main(void)
+{
+  int foo(void), bar(void), baz(void);
+  return foo() + bar() + baz();
+}
+END
+
+echo 'int foo(void) { return 0; }' > foo.c
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE
+
+./configure
+$MAKE
+$MAKE test1 test2
+$MAKE distcheck
+
+:
diff --git a/tests/posixsubst-tests.test b/tests/posixsubst-tests.test
new file mode 100755
index 0000000..158d0ad
--- /dev/null
+++ b/tests/posixsubst-tests.test
@@ -0,0 +1,70 @@
+#! /bin/sh
+# Copyright (C) 2010 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 <http://www.gnu.org/licenses/>.
+
+# Test that POSIX variable expansion `$(var:str=rpl)' works when used
+# with the TESTS special variable.
+
+. ./defs || Exit 1
+
+set -e
+
+cat >> configure.in << 'END'
+AC_OUTPUT
+END
+
+cat > Makefile.am << 'END'
+t1 = foo1 foo2
+t2 = barx
+t3 = bar2
+
+foo2.test barz:
+       (echo '#!/bin/sh' && echo 'exit 0') > $@ && chmod a+x $@
+CLEANFILES = foo2.test barz # for FreeBSD make
+
+# Try also with `:=', to ensure the parser is not unduly confused
+# into thinking that it's an unportable assignement operator.
+TESTS = $(t1:=.test) $(t2:x=y) $(t3:2=z)
+
+EXTRA_DIST = $(TESTS)
+MOSTLYCLEANFILES = *.out
+END
+
+cat > foo1.test <<'END'
+#!/bin/sh
+touch foo1.out
+test x"${TESTSUITE_OK-no}" = x"yes"
+END
+sed 's/foo1/bary/g' foo1.test > bary
+chmod +x foo1.test bary
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE
+
+./configure
+$MAKE check >out 2>&1 && { cat out; Exit 1; }
+cat out
+ls -l
+grep '^FAIL: foo1\.test *$' out
+grep '^PASS: foo2\.test *$' out
+grep '^FAIL: bary *$' out
+grep '^PASS: barz *$' out
+test -f foo1.out
+test -f bary.out
+
+TESTSUITE_OK=yes $MAKE distcheck
+
+:
-- 
1.7.1


reply via email to

[Prev in Thread] Current Thread [Next in Thread]