[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
test convenience archives; testsuite update
From: |
Ralf Wildenhues |
Subject: |
test convenience archives; testsuite update |
Date: |
Mon, 18 Apr 2005 19:08:13 +0200 |
User-agent: |
Mutt/1.4.1i |
We need a test for convenience archives: multiple archives, objects not
pulled in through dependencies. This has hit us more than once now.
--> convenience.at (below)
What's even worse: it shows that Libtool HEAD is buggy w.r.t this on
Solaris (solaris2.8, cc, /usr/ccs/bin/ld). Now I need to find out if
this translates to branch-1-5 as well. :(
Furthermore, stresstest has several deficiencies. Most of them are
fixed below (use of CFLAGS,LDFLAGS, set -no-undefined on windows hosts,
ignore compiler/linker warnings in output). Incidentally, the bug
Robert reported for it on cygwin is not fixed by this, as it's a genuine
bug in ltmain (my patch a few weeks ago was only half a fix).
I have created a macro for executing binaries so we don't stumble over
cross-compilation issues frequently. Also, host, build, exeext and
EGREP are defined by default through the setup section.
(En passant, this also fixes a shell syntax error.)
OK to apply to HEAD (and backport convenience.at)?
Before applying, I will actually test this on cygwin and a
GNU/Linux -> mingw cross setup, but I'd like people to have a look
nonetheless.
Regards,
Ralf
* tests/convenience.at: New. Test convenience archives.
* Makefile.am, tests/testsuite.at: Adjust.
* tests/testsuite.at (PREPARE_TESTS): Define EGREP, host, build, exeext.
(LT_AT_EXEC_CHECK): New.
* tests/am-subdir.at, tests/duplicate_members.at,
tests/link-order.at, tests/stresstest.at, tests/template.at: Use.
Index: Makefile.am
===================================================================
RCS file: /cvsroot/libtool/libtool/Makefile.am,v
retrieving revision 1.148
diff -u -r1.148 Makefile.am
--- Makefile.am 17 Apr 2005 14:30:33 -0000 1.148
+++ Makefile.am 18 Apr 2005 14:58:09 -0000
@@ -306,6 +306,7 @@
tests/libtoolize.at \
tests/stresstest.at \
tests/link-order.at \
+ tests/convenience.at \
tests/template.at
EXTRA_DIST += $(TESTSUITE) $(TESTSUITE_AT) tests/package.m4
Index: tests/am-subdir.at
===================================================================
RCS file: /cvsroot/libtool/libtool/tests/am-subdir.at,v
retrieving revision 1.3
diff -u -r1.3 am-subdir.at
--- tests/am-subdir.at 3 Jan 2005 14:06:12 -0000 1.3
+++ tests/am-subdir.at 18 Apr 2005 14:58:09 -0000
@@ -74,7 +74,7 @@
LT_AT_BOOTSTRAP
"${MAKE-make}"
-AT_CHECK([subdir/subdemo], 0, expout)
+LT_AT_EXEC_CHECK([subdir/subdemo], 0, expout)
AT_CLEANUP
@@ -157,6 +157,6 @@
LT_AT_BOOTSTRAP
"${MAKE-make}"
-AT_CHECK([subdir/subdemo], 0, expout)
+LT_AT_EXEC_CHECK([subdir/subdemo], 0, expout)
AT_CLEANUP
Index: tests/duplicate_members.at
===================================================================
RCS file: /cvsroot/libtool/libtool/tests/duplicate_members.at,v
retrieving revision 1.1
diff -u -r1.1 duplicate_members.at
--- tests/duplicate_members.at 17 Apr 2005 14:30:34 -0000 1.1
+++ tests/duplicate_members.at 18 Apr 2005 14:58:09 -0000
@@ -28,9 +28,6 @@
chmod +x ./libtool
LIBTOOL=./libtool
-eval `$LIBTOOL --config | grep ^EGREP=`
-eval `$LIBTOOL --config | $EGREP '(host|build)='`
-
AT_DATA(bar.c,
[[int bar() {
int result=foo1() +foo2() +foo3() +foo4() +foo5() +foo6();
@@ -68,8 +65,6 @@
$LIBTOOL --mode=compile --tag=CC $CC -c $CFLAGS -o main.lo main.c
$LIBTOOL --mode=link --tag=CC $CC $CFLAGS $LDFLAGS -o main main.lo ./libbar.la
-AT_CHECK([./main],[0],[ignore],[ignore],[AT_CHECK(if
- ((test "X$host" != "X$build") &&
- ( test -x ./main)); then exit 77; fi)])
+LT_AT_EXEC_CHECK([./main],[0],[ignore],[ignore])
AT_CLEANUP
Index: tests/link-order.at
===================================================================
RCS file: /cvsroot/libtool/libtool/tests/link-order.at,v
retrieving revision 1.1
diff -u -r1.1 link-order.at
--- tests/link-order.at 14 Apr 2005 11:59:10 -0000 1.1
+++ tests/link-order.at 18 Apr 2005 14:58:09 -0000
@@ -21,7 +21,6 @@
AT_BANNER([Libtool link order test.])
AT_SETUP([Link order test.])
: ${LIBTOOL=${abs_top_builddir}/libtool}
-: ${EGREP='grep -E'}
eval `$LIBTOOL --config | grep ECHO=`
prefix_old=`pwd`/old
@@ -69,7 +68,6 @@
else :;
fi], [0], [ignore], [ignore], [echo "wrong link order"])
-
for i in old new; do
AT_DATA(src/main_$i.c,
[[extern int a_$i();
@@ -80,9 +78,7 @@
$LIBTOOL --mode=compile $CC $CFLAGS -c src/main_$i.c -o src/main_$i.lo
AT_CHECK($LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o src/main_$i
src/main_$i.lo -L$prefix/lib -la,
[0], [ignore], [ignore])
-
- AT_CHECK(src/main_$i, [0],,,
- [AT_CHECK(if test "X$host" != "X$build"; then exit 77; fi)])
+ LT_AT_EXEC_CHECK([src/main_$i])
done
AT_CLEANUP
Index: tests/stresstest.at
===================================================================
RCS file: /cvsroot/libtool/libtool/tests/stresstest.at,v
retrieving revision 1.2
diff -u -r1.2 stresstest.at
--- tests/stresstest.at 8 Mar 2005 13:44:32 -0000 1.2
+++ tests/stresstest.at 18 Apr 2005 16:39:00 -0000
@@ -148,32 +152,37 @@
]])
-AT_CHECK([$LIBTOOL --mode=compile $CC -c a.c -o sub/a.lo],[0],[ignore],[])
-AT_CHECK([$LIBTOOL --mode=compile $CC -c b.c -o sub/b.o],[0],[ignore],[])
-AT_CHECK([$LIBTOOL --mode=compile $CC -c main.c],[0],[ignore],[])
-AT_CHECK([$LIBTOOL --mode=compile $CC -c dlself.c -o
sub3/dlself.lo],[0],[ignore],[])
+AT_CHECK([$LIBTOOL --mode=compile $CC $CFLAGS -c a.c -o
sub/a.lo],[0],[ignore],[ignore])
+AT_CHECK([$LIBTOOL --mode=compile $CC $CFLAGS -c b.c -o
sub/b.o],[0],[ignore],[ignore])
+AT_CHECK([$LIBTOOL --mode=compile $CC $CFLAGS -c main.c],[0],[ignore],[ignore])
+AT_CHECK([$LIBTOOL --mode=compile $CC $CFLAGS -c dlself.c -o
sub3/dlself.lo],[0],[ignore],[ignore])
+
+case $host in
+ cygwin* | mingw* | pw32*) undef_opts=-no-undefined ;;
+ *) undef_opts='"" -no-undefined' ;;
+esac
-for l1 in '' '-no-undefined'
+for l1 in $undef_opts
do
for l2 in '' '-export-symbols-regex v.*'
do
for l3 in '' '-rpath /nonexistent'
do
linkargs="$l1 $l2 $l3"
for rel in '' ./ `pwd`/
do
- AT_CHECK([$LIBTOOL --mode=link $CC -o "$rel"sub2/liba.la "$rel"sub/a.lo
$linkargs],
- [0],[ignore],[])
+ AT_CHECK([$LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o
"$rel"sub2/liba.la "$rel"sub/a.lo $linkargs],
+ [0],[ignore],[ignore])
for st in '' '-static'
do
- AT_CHECK([$LIBTOOL --mode=link $CC $st -o "$rel"main "$rel"main.lo
"$rel"sub2/liba.la],
- [0],[ignore],[])
- AT_CHECK([./main],[0])
+ AT_CHECK([$LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS $st -o "$rel"main
"$rel"main.lo "$rel"sub2/liba.la],
+ [0],[ignore],[ignore])
+ LT_AT_EXEC_CHECK([./main],[0])
for l10 in '' '-export-symbols dlselfsyms'
do
- AT_CHECK([$LIBTOOL --mode=link $CC $st -o "$rel"sub3/dlself
"$rel"sub3/dlself.lo "$rel"sub2/liba.la sub/b.o -dlopen self $l10],
- [0],[ignore],[])
- AT_CHECK([./sub3/dlself],[0])
+ AT_CHECK([$LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS $st -o
"$rel"sub3/dlself "$rel"sub3/dlself.lo "$rel"sub2/liba.la sub/b.o -dlopen self
$l10],
+ [0],[ignore],[ignore])
+ LT_AT_EXEC_CHECK([./sub3/dlself],[0])
done
done
done
Index: tests/template.at
===================================================================
RCS file: /cvsroot/libtool/libtool/tests/template.at,v
retrieving revision 1.1
diff -u -r1.1 template.at
--- tests/template.at 4 Apr 2005 17:09:29 -0000 1.1
+++ tests/template.at 18 Apr 2005 14:58:09 -0000
@@ -88,7 +88,7 @@
AT_CHECK($CXX -I. $CPPFLAGS $CXXFLAGS -c -o prog.o prog.cc, [0], [ignore],
[ignore])
AT_CHECK($LIBTOOL --tag=CXX --mode=link $CXX $CPPFLAGS $CXXFLAGS -o prog
prog.o libalib.la, [0], [ignore], [ignore])
-AT_CHECK([./prog$EXEEXT], [0], [a sample prog
+LT_AT_EXEC_CHECK([./prog], [0], [a sample prog
f(3) = 6
cf(3) = 9
], [ignore])
@@ -213,30 +213,30 @@
AT_CHECK($LIBTOOL --tag=CXX --mode=link $CXX $CXXFLAGS -o lib/liba.la
lib/a.lo, [0], [ignore], [ignore])
AT_CHECK($LIBTOOL --tag=CXX --mode=link $CXX $CXXFLAGS -o lib2/libb.la
lib2/b.lo, [0], [ignore], [ignore])
AT_CHECK($LIBTOOL --tag=CXX --mode=link $CXX $CXXFLAGS -o sub/main sub/main.o
lib2/libb.la lib/liba.la, [0], [ignore], [ignore])
-AT_CHECK([./sub/main$EXEEXT], [ignore])
+LT_AT_EXEC_CHECK([./sub/main], [ignore])
# lib convenience
AT_CHECK($LIBTOOL --tag=CXX --mode=link $CXX $CXXFLAGS -o lib2/libb.la
lib2/b.lo -rpath /foo, [0], [ignore], [ignore])
AT_CHECK($LIBTOOL --tag=CXX --mode=link $CXX $CXXFLAGS -o sub/main sub/main.o
lib2/libb.la lib/liba.la, [0], [ignore], [ignore])
-AT_CHECK([./sub/main$EXEEXT])
+LT_AT_EXEC_CHECK([./sub/main])
# both installed
AT_CHECK($LIBTOOL --tag=CXX --mode=link $CXX $CXXFLAGS -o lib/liba.la lib/a.lo
-rpath /foo, [0], [ignore], [ignore])
AT_CHECK($LIBTOOL --tag=CXX --mode=link $CXX $CXXFLAGS -o lib2/libb.la
lib2/b.lo -rpath /bar, [0], [ignore], [ignore])
AT_CHECK($LIBTOOL --tag=CXX --mode=link $CXX $CXXFLAGS -o sub/main sub/main.o
lib2/libb.la lib/liba.la, [0], [ignore], [ignore])
-AT_CHECK([./sub/main$EXEEXT])
+LT_AT_EXEC_CHECK([./sub/main])
# both convenience, libb depending on liba
AT_CHECK($LIBTOOL --tag=CXX --mode=link $CXX $CXXFLAGS -o lib/liba.la
lib/a.lo, [0], [ignore], [ignore])
AT_CHECK($LIBTOOL --tag=CXX --mode=link $CXX $CXXFLAGS -o lib2/libb.la
lib2/b.lo lib/liba.la, [0], [ignore], [ignore])
AT_CHECK($LIBTOOL --tag=CXX --mode=link $CXX $CXXFLAGS -o sub/main sub/main.o
lib2/libb.la, [0], [ignore], [ignore])
-AT_CHECK([./sub/main$EXEEXT])
+LT_AT_EXEC_CHECK([./sub/main])
# lib convenience
AT_CHECK($LIBTOOL --tag=CXX --mode=link $CXX $CXXFLAGS -o lib2/libb.la
lib2/b.lo lib/liba.la -rpath /foo, [0], [ignore], [ignore])
AT_CHECK($LIBTOOL --tag=CXX --mode=link $CXX $CXXFLAGS -o sub/main sub/main.o
lib2/libb.la, [0], [ignore], [ignore])
-AT_CHECK([./sub/main$EXEEXT])
+LT_AT_EXEC_CHECK([./sub/main])
# both installed
AT_CHECK($LIBTOOL --tag=CXX --mode=link $CXX $CXXFLAGS -o lib/liba.la lib/a.lo
-rpath /foo, [0], [ignore], [ignore])
AT_CHECK($LIBTOOL --tag=CXX --mode=link $CXX $CXXFLAGS -o lib2/libb.la
lib2/b.lo lib/liba.la -rpath /bar, [0], [ignore], [ignore])
AT_CHECK($LIBTOOL --tag=CXX --mode=link $CXX $CXXFLAGS -o sub/main sub/main.o
lib2/libb.la, [0], [ignore], [ignore])
-AT_CHECK([./sub/main$EXEEXT])
+LT_AT_EXEC_CHECK([./sub/main])
cd ..
Index: tests/testsuite.at
===================================================================
RCS file: /cvsroot/libtool/libtool/tests/testsuite.at,v
retrieving revision 1.12
diff -u -r1.12 testsuite.at
--- tests/testsuite.at 17 Apr 2005 14:30:34 -0000 1.12
+++ tests/testsuite.at 18 Apr 2005 14:58:09 -0000
@@ -21,6 +21,8 @@
m4_divert_push([PREPARE_TESTS])dnl
: ${LIBTOOLIZE="${abs_top_builddir}/libtoolize"}
export LIBTOOLIZE
+eval `${abs_top_builddir}/libtool --config | grep ^EGREP=`
+eval `${abs_top_builddir}/libtool --config | $EGREP '(host|build|exeext)='`
m4_divert_pop([PREPARE_TESTS])dnl
# LT_AT_LIBTOOLIZE([ARGS])
@@ -43,11 +45,20 @@
m4_define([LT_AT_BOOTSTRAP],
[
test -f ./ltmain.sh || LT_AT_LIBTOOLIZE([--copy])
-test -f ./configure || _lt_pkgvdatadir="$abs_top_srcdir" autoreconf --force
--verbose --install
+test -f ./configure || _lt_pkgvdatadir="$abs_top_srcdir" autoreconf --force
--verbose --install || exit 1
test -f ./configure || exit 1
./configure
])
+# LT_AT_EXEC_CHECK(EXECUTABLE, [STATUS = 0], [STDOUT], [STDERR])
+# --------------------------------------------------------------
+m4_define([LT_AT_EXEC_CHECK],
+[AT_CHECK([$1],[$2],[$3],[$4],
+ [if test "X$host" != "X$build" && test -x "$1"$exeext
+ then (exit 77); fi])
+])
+
+
# We use `dnl' in zillions of places...
m4_pattern_allow([^dnl$])
@@ -68,10 +79,11 @@
m4_include([inherited_flags.at])
# stress test
m4_include([stresstest.at])
+# convenience archives test
+m4_include([convenience.at])
# C++ templates tests
m4_include([template.at])
# libtoolize tests
m4_include([libtoolize.at])
# link order test
m4_include([link-order.at])
-
--- /dev/null 2005-04-04 11:53:15.417024464 +0200
+++ tests/convenience.at 2005-04-18 17:23:31.366914128 +0200
@@ -0,0 +1,56 @@
+# Hand crafted tests for GNU Libtool. -*- Autotest -*-
+# Copyright 2005 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, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+# 02111-1307, USA.
+
+# Test that convenience archives work.
+
+AT_SETUP([Convenience archives test])
+
+: ${LIBTOOL=${abs_top_builddir}/libtool}
+
+AT_DATA(a.c,
+[[int a(void) { return 1; }
+]])
+
+AT_DATA(b.c,
+[[int b(void) { return 2; }
+]])
+
+AT_DATA(c.c,
+[[int c(void) { return 3; }
+]])
+
+AT_DATA(main.c,
+[[extern int a(void);
+extern int b(void);
+int main(void) { return a() + b() + c() != 6; }
+]])
+
+$LIBTOOL --mode=compile $CC $CFLAGS -c a.c
+$LIBTOOL --mode=compile $CC $CFLAGS -c b.c
+$LIBTOOL --mode=compile $CC $CFLAGS -c c.c
+$LIBTOOL --mode=compile $CC $CFLAGS -c main.c
+$LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o liba.la a.lo
+$LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o libb.la b.lo
+$LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o libcee.la c.lo liba.la libb.la
-rpath /notexist
+AT_CHECK([$LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -static -o main_static
main.lo libcee.la],
+ [0],[ignore],[ignore])
+AT_CHECK([$LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o main main.lo libcee.la],
+ [0],[ignore],[ignore])
+LT_AT_EXEC_CHECK([./main_static])
+LT_AT_EXEC_CHECK([./main])
+AT_CLEANUP
- test convenience archives; testsuite update,
Ralf Wildenhues <=