[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: test failures
From: |
Ralf Wildenhues |
Subject: |
Re: test failures |
Date: |
Sat, 28 Oct 2006 00:57:09 +0200 |
User-agent: |
Mutt/1.5.13 (2006-08-11) |
Hello Patrick,
* Patrick Welche wrote on Fri, Oct 27, 2006 at 06:35:31PM CEST:
>
> (Spent the afternoon teaching reciprocal space in hexagonal crystals, so
> I'm quite sure sin(pi/2) = 1 :-) )
LOL. The test was written to prove you wrong. :->
I've checked in the patch below, to hopefully fix all the glitches I put
in that test. Now it should really do what I intended it to do.
However, I do not know how portable such setup is that depends upon
library ordering in both static and non-static case: the test is to find
out. Could you try it (and report the system you tried)?
Thanks,
Ralf
2006-10-28 Ralf Wildenhues <address@hidden>
* tests/link-order2.at: Add missing $bindir setting. Prevent
compiler optimization of sqrt call. Fix logic inversion and
add some comments about this stunt. Add a test with reversed
library link order that should fail if the system has a libm.
Report by Patrick Welche.
Index: tests/link-order2.at
===================================================================
RCS file: /cvsroot/libtool/libtool/tests/link-order2.at,v
retrieving revision 1.1
diff -u -r1.1 link-order2.at
--- tests/link-order2.at 24 Oct 2006 20:30:05 -0000 1.1
+++ tests/link-order2.at 27 Oct 2006 22:40:55 -0000
@@ -26,6 +26,7 @@
AT_KEYWORDS([libtool])
LDFLAGS="$LDFLAGS -no-undefined"
libdir=`pwd`/inst/lib
+bindir=`pwd`/inst/bin
mkdir inst inst/bin inst/lib
cat >a.c <<\EOF
@@ -41,9 +42,17 @@
cat >main.c <<\EOF
#include <math.h>
extern double b (double);
+extern double four;
+double four = 4.0;
int main (void)
{
- return fabs (b (3.1415 / 2.)) < 0.01 && fabs (sqrt (4.) - 2.) < 0.01;
+ /* The ! is to invert C true to shell true
+ * The function b should call our sin (that returns 0) and not libm's
+ * (in the latter case, b returns approximately 1)
+ * the sqrt is to force linking against libm
+ * the variable four is to prevent most compiler optimizations
+ */
+ return !( fabs (b (3.1415 / 2.)) < 0.01 && fabs (sqrt (four) - 2.) < 0.01 );
}
EOF
@@ -55,6 +64,14 @@
$LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS $static -o libb.la b.lo liba.la
-rpath $libdir
$LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o main main.$OBJEXT libb.la -lm
LT_AT_EXEC_CHECK([./main])
+ # Now test that if we reverse the link order, the program fails.
+ # The execution failure can only work on systems that actually have a libm.
+ $LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o wrong main.$OBJEXT -lm libb.la
+ case $host_os in
+ cygwin* | mingw* | pw32* | beos* ) ;;
+ *) LT_AT_EXEC_CHECK([./wrong], [1]) ;;
+ esac
+
$LIBTOOL --mode=install cp liba.la $libdir/liba.la
$LIBTOOL --mode=install cp libb.la $libdir/libb.la
$LIBTOOL --mode=install cp main $bindir/main