libtool-patches
[Top][All Lists]
Advanced

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

Re: versioning test


From: Ralf Wildenhues
Subject: Re: versioning test
Date: Sat, 31 Jan 2009 11:43:34 +0100
User-agent: Mutt/1.5.18 (2008-05-17)

* Mike Gorchak wrote on Tue, Jan 27, 2009 at 08:56:25AM CET:
> > RW>> 2) Failure test:
> > RW>> does this work on your system?
> > RW>>   echo 'int not_main () { return 0; }' > a.c
> > RW>>   qcc -V3.3.5,gcc_ntox86 -O3 -funroll-all-loops -c a.c
> > RW>>   qcc -V3.3.5,gcc_ntox86 -O3 -funroll-all-loops -o a a.o
> > RW>>   echo $?
> > RW>>   ls -l a
> >>
> >> Yes, it works. Reporting 0 as exit code and: ls -l a reports:
> >>
> >> -rwxrwxr-x  1 root    root        4110    Jan 27 08:13    a
> >>
> >> ldd /ports/temp/libtool-2.2.6-qnx/a
> >>
> >> /ports/temp/libtool-2.2.6-qnx/a
> >> libc.so.2 => /usr/lib/ldqnx.so.2 (0xb0300000)
>
> RW> Argh.  What happens if you try to execute it?
> RW>   ./a; echo $?
>
> Exit code is 0x01.

Thanks.  I guess we have to weaken the test further.  I'm pushing this.

If this causes a test regression on some other system, and I'm guessing
this system will qualify:
<http://thread.gmane.org/gmane.comp.sysutils.autoconf.general/11226>
then I suppose that configure tests for library functions will be
broken, too, so let's check for nonzero libtool exit status only if the
link without libtool would have exited nonzero too.
(IOW: working around such a failure should not be done _within libtool_
but at a different level: either by fixing the compiler, or a compiler
wrapper or so).

Cheers,
Ralf

        Nonexistent `main' does not guarantee link failure.
        * tests/fail.at (Failure tests): Use an unresolved symbol,
        rather than non-presence of `main', to provoke a link failure
        also on QNX.  Only check for failure of the libtool script if
        the link without libtool would have failed, too.
        Report by Mike Gorchak.

diff --git a/tests/fail.at b/tests/fail.at
index 088ad9e..fb05f8c 100644
--- a/tests/fail.at
+++ b/tests/fail.at
@@ -1,6 +1,6 @@
 # fail.at -- test that libtool really fail when it should     -*- Autotest -*-
 #
-#   Copyright (C) 2005, 2008 Free Software Foundation, Inc.
+#   Copyright (C) 2005, 2008, 2009 Free Software Foundation, Inc.
 #   Written by Ralf Wildenhues, 2005
 #
 #   This file is part of GNU Libtool.
@@ -64,13 +64,26 @@ case $pic_mode in default | yes)
   ;;
 esac
 
-# program creation failure
-echo 'int not_main(void) { return 0; }' > a.c
+# program creation failure.
+# We can't rely on `main' not being present: the QNX linker
+# won't error out in that case, although the resulting binary won't work.
+# So we provoke a link failure due to an unresolved symbol, and require
+# libtool to fail only if the link without libtool would have failed, too.
+cat > a.c <<'EOF'
+extern int nonexistent_function (void);
+int main (void)
+{
+  return nonexistent_function ();
+}
+EOF
 $CC $CPPFLAGS $CFLAGS -c a.c
-FAIL_CHECK([$LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o a$EXEEXT a.$OBJEXT])
-AT_CHECK([{ test -f a && $test_x a; } || { test -f a$EXEEXT && $test_x 
a$EXEEXT; }], [1])
-FAIL_CHECK([$LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o a$EXEEXT a.$OBJEXT 
-static])
-AT_CHECK([{ test -f a && $test_x a; } || { test -f a$EXEEXT && $test_x 
a$EXEEXT; }], [1])
+if $CC $CFLAGS $LDFLAGS -o a$EXEEXT a.$OBJEXT; then :; else
+  rm -f a a$EXEEXT
+  FAIL_CHECK([$LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o a$EXEEXT a.$OBJEXT])
+  AT_CHECK([{ test -f a && $test_x a; } || { test -f a$EXEEXT && $test_x 
a$EXEEXT; }], [1])
+  FAIL_CHECK([$LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o a$EXEEXT a.$OBJEXT 
-static])
+  AT_CHECK([{ test -f a && $test_x a; } || { test -f a$EXEEXT && $test_x 
a$EXEEXT; }], [1])
+fi
 
 # shared library creation failure
 case $build_libtool_libs in yes)




reply via email to

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