tests: cater to systems installing libs in /lib64
authorStefano Lattarini <stefano.lattarini@gmail.com>
Mon, 23 Apr 2012 13:51:25 +0000 (15:51 +0200)
committerStefano Lattarini <stefano.lattarini@gmail.com>
Mon, 23 Apr 2012 13:51:25 +0000 (15:51 +0200)
See automake bug#11302.

On at least OpenSUSE 12.1, "make install" will install libraries in
the '${prefix}/lib64'  directory by default.  This is due to the
$CONFIG_SITE set by /etc/profile.d/site.sh, which sets a libdir
that ends in '/lib64' rather than '/lib' if it finds that the compiler
is generating 64-bit code.  This behaviour was causing some spurious
failures in our testsuite.  Fix them.

* t/posixsubst-libraries.sh: Assume the libraries are installed in
'$(libdir)' rather than in '$(prefix)/lib'.
* t/posixsubst-ltlibraries.sh: Likewise.
* t/posixsubst-scripts.sh: Similarly, don't assume that '$(bindir)',
'$(sbindir)' and '$(libexedir)' always defaults to respectively
'$(prefix)/bin', '$(prefix)/sbin' and '$(prefix)/libexec'.
* t/transform3.test: Likewise.

Signed-off-by: Stefano Lattarini <stefano.lattarini@gmail.com>
t/posixsubst-libraries.sh
t/posixsubst-ltlibraries.sh
t/posixsubst-scripts.sh
t/transform3.sh

index 8e6b265..f437571 100755 (executable)
@@ -41,10 +41,10 @@ libbar.c:
 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
+       ls -l $(libdir)
+       test -f $(libdir)/libfoo1.a
+       test -f $(libdir)/libfoo2.a
+       test -f $(libdir)/libbar.a
 END
 
 echo 'int bar1(void) { return 0; }' > libfoo1.c
index 6a4cbd5..b4b2a92 100755 (executable)
@@ -41,10 +41,10 @@ libbar.c:
 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
+       ls -l $(libdir)
+       test -f $(libdir)/libfoo1.la
+       test -f $(libdir)/libfoo2.la
+       test -f $(libdir)/libbar.la
 END
 
 echo 'int bar1(void) { return 0; }' > libfoo1.c
index 934b82e..cda515f 100755 (executable)
@@ -65,17 +65,17 @@ test2: distdir
        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
+       ls -l $(libexecdir) $(bindir) $(sbindir)
+       test -f $(sbindir)/foo1.sh
+       test -x $(sbindir)/foo1.sh
+       test -f $(sbindir)/foo2.sh
+       test -x $(sbindir)/foo2.sh
+       test -f $(libexecdir)/bar1
+       test -x $(libexecdir)/bar1
+       test -f $(libexecdir)/bar2
+       test -x $(libexecdir)/bar2
+       test -f $(bindir)/quux.pl
+       test -x $(bindir)/quux.pl
 END
 
 cat > foo1.sh <<'END'
index aaa69cb..6f1b811 100755 (executable)
@@ -35,6 +35,27 @@ bin_SCRIPTS = foo
 pkgdata_DATA = bar.txt
 pkglib_LIBRARIES = libzap.a
 pkglibexec_SCRIPTS = mu
+
+test-install: install
+       find $(prefix) ;: For debugging.
+       test   -f $(bindir)/gnu-foo
+       test   -x $(bindir)/gnu-foo
+       test   -f $(datadir)/foo/bar.txt
+       test ! -d $(datadir)/gnu-foo
+       test   -f $(libdir)/foo/libzap.a
+       test ! -d $(libdir)/gnu-foo
+       test   -f $(libexecdir)/foo/gnu-mu
+       test   -x $(libexecdir)/foo/gnu-mu
+       test ! -d $(libexecdir)/gnu-foo
+
+test-installdirs: installdirs
+       find $(prefix) ;: For debugging.
+       test   -d $(datadir)/foo
+       test ! -d $(datadir)/gnu-foo
+       test   -d $(libdir)/foo
+       test ! -d $(libdir)/gnu-foo
+       test   -d $(libexecdir)/foo
+       test ! -d $(libexecdir)/gnu-foo
 END
 
 cat > libzap.c <<'END'
@@ -59,29 +80,13 @@ $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 test-install
 
 $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
+$MAKE test-installdirs
 
 :