Den 2010-08-30 20:55 skrev Ralf Wildenhues:
> Hi Peter,
> 
> * Peter Rosin wrote on Mon, Aug 30, 2010 at 03:25:30PM CEST:
>> The archive-in-archive.at test uses ar "blindly". It also assumes that
>> the "old archive" of libfoo.la is named libfoo.a, but both that's not
>> portable. See attached patch.
> 
> OK with nits below.

Thanks!

> I don't like that we don't have a decent abstraction for static
> libraries, but that again is something we *should* fix in Automake
> not Libtool IMVHO.  (I'm not yet quite sure how exactly ...)
> 
> Thanks,
> Ralf
> 
>> --- a/tests/archive-in-archive.at
>> +++ b/tests/archive-in-archive.at
> 
> missing copyright year update.
> 
>> @@ -42,11 +42,15 @@ $LIBTOOL --mode=compile --tag=CC $CC $CPPFLAGS $CFLAGS 
>> -c -o bar.lo bar.c
>>  $LIBTOOL --mode=link --tag=CC --tag=disable-shared $CC $CFLAGS $LDFLAGS \
>>  -o libfoo.la foo.lo -version-info 1:0:0 -rpath $thisdir
>>  $LIBTOOL --mode=install cp libfoo.la $thisdir 
>> +eval `$EGREP '^(old_library)=' < libfoo.la`
>> +libfoo=$old_library
>>  AT_CHECK([$LIBTOOL --mode=link --tag=CC --tag=disable-shared $CC $CFLAGS 
>> $LDFLAGS \
>> -     -o libbar.la bar.lo ./libfoo.a -version-info 1:0:0 -rpath $thisdir],
>> +     -o libbar.la bar.lo $libfoo -version-info 1:0:0 -rpath $thisdir],
>>       [], [ignore], [ignore])
>>  AT_CHECK([$LIBTOOL --mode=install cp libbar.la $thisdir], [], [ignore], 
>> [ignore])
>> -AT_CHECK([ar -t libbar.a | grep libfoo.a],[1],[ignore],[ignore])
>> -archive_contents=`ar -t libbar.a`
>> -AT_XFAIL_IF([case "$archive_contents" in *"libfoo.a"*) : ;; esac])
>> +eval `$EGREP '^(old_library)=' < libbar.la`
>> +libbar=$old_library
>> +AT_CHECK([$AR -t $libbar | grep $libfoo],[1],[ignore],[ignore])
> 
> How about $FGREP?  You' need to extract it from $LIBTOOL though.

Then I can't anchor the fixed pattern at the beginning of the line,
so I'm sticking with EGREP...

>> +archive_contents=`$AR -t $libbar`
>> +AT_XFAIL_IF([case "$archive_contents" in *"$libfoo"*) : ;; esac])
> 
> This AT_XFAIL_IF it completely bogus at this point.  The argument to
> AT_XFAIL_IF is, yes, surprisingly, evaluated *before* the rest of the
> test group is started.  So all it does is
> 
>  AT_XFAIL_IF([case "$empty_var" in *"$another_empty_var"*) : ;; esac])
> 
> Please remove these two lines and instead add
>   AT_XFAIL_IF([:]) dnl This is currently broken
> 
> at the *beginning* of the test group (so readers are not confused)
> right after AT_SETUP, and adjust the log entry accordingly.

Ok, done.

Pushing as attached, expected fail on Cygwin/ar and unexpected pass on
MSYS/lib just as before.

Cheers,
Peter
>From 9a99cfa036a1c9ab7e3afa8815ef79b99d80cc3c Mon Sep 17 00:00:00 2001
From: Peter Rosin <[email protected]>
Date: Tue, 31 Aug 2010 11:48:28 +0200
Subject: [PATCH] Extract the archive name from the .la file and use $AR (not 
ar).

* Makefile.am: Pass AR through to the testsuite.
* tests/archive-in-archive.at: Bump copyright year. Extract archive
name from the .la file instead of hardcoding the name, and allow
different archivers. Also clarify that the tested functionality is
currently broken.

Signed-off-by: Peter Rosin <[email protected]>
---
 ChangeLog                   |    9 +++++++++
 Makefile.am                 |    1 +
 tests/archive-in-archive.at |   14 +++++++++-----
 3 files changed, 19 insertions(+), 5 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 5d7a1dc..8a183e2 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2010-08-31  Peter Rosin  <[email protected]>
+
+       Extract the archive name from the .la file and use $AR (not ar).
+       * Makefile.am: Pass AR through to the testsuite.
+       * tests/archive-in-archive.at: Bump copyright year. Extract archive
+       name from the .la file instead of hardcoding the name, and allow
+       different archivers. Also clarify that the tested functionality is
+       currently broken.
+
 2010-08-30  Ralf Wildenhues  <[email protected]>
 
        tests: skip -Wall -Werror with Tru64 cc in cwrapper test.
diff --git a/Makefile.am b/Makefile.am
index de3eafe..b5cde00 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -513,6 +513,7 @@ EXTRA_DIST     += $(srcdir)/$(TESTSUITE) $(TESTSUITE_AT) 
$(srcdir)/tests/package
 TESTS_ENVIRONMENT = MAKE="$(MAKE)" CC="$(CC)" CFLAGS="$(CFLAGS)" \
        CPP="$(CPP)" CPPFLAGS="$(CPPFLAGS)" LD="$(LD)" LDFLAGS="$(LDFLAGS)" \
        LIBS="$(LIBS)" LN_S="$(LN_S)" NM="$(NM)" RANLIB="$(RANLIB)" \
+       AR="$(AR)" \
        M4SH="$(M4SH)" SED="$(SED)" STRIP="$(STRIP)" lt_INSTALL="$(INSTALL)" \
        MANIFEST_TOOL="$(MANIFEST_TOOL)" \
        OBJEXT="$(OBJEXT)" EXEEXT="$(EXEEXT)" \
diff --git a/tests/archive-in-archive.at b/tests/archive-in-archive.at
index a57dfdd..32e3543 100644
--- a/tests/archive-in-archive.at
+++ b/tests/archive-in-archive.at
@@ -1,6 +1,6 @@
 # dmacks.at --  test for dmacks bug  -*- Autotest -*-
 #
-#   Copyright (C) 2007, 2008 Free Software Foundation, Inc.
+#   Copyright (C) 2007, 2008, 2010 Free Software Foundation, Inc.
 #   Written by Peter O'Gorman, 2007
 #
 #   This file is part of GNU Libtool.
@@ -26,6 +26,8 @@
 AT_SETUP([static library contains static library])
 AT_KEYWORDS([libtool])
 
+AT_XFAIL_IF([:]) dnl This is currently broken
+
 AT_DATA([foo.c],
 [
 int foo() { return 1;}
@@ -42,11 +44,13 @@ $LIBTOOL --mode=compile --tag=CC $CC $CPPFLAGS $CFLAGS -c 
-o bar.lo bar.c
 $LIBTOOL --mode=link --tag=CC --tag=disable-shared $CC $CFLAGS $LDFLAGS \
 -o libfoo.la foo.lo -version-info 1:0:0 -rpath $thisdir
 $LIBTOOL --mode=install cp libfoo.la $thisdir 
+eval `$EGREP '^(old_library)=' < libfoo.la`
+libfoo=$old_library
 AT_CHECK([$LIBTOOL --mode=link --tag=CC --tag=disable-shared $CC $CFLAGS 
$LDFLAGS \
-        -o libbar.la bar.lo ./libfoo.a -version-info 1:0:0 -rpath $thisdir],
+        -o libbar.la bar.lo $libfoo -version-info 1:0:0 -rpath $thisdir],
         [], [ignore], [ignore])
 AT_CHECK([$LIBTOOL --mode=install cp libbar.la $thisdir], [], [ignore], 
[ignore])
-AT_CHECK([ar -t libbar.a | grep libfoo.a],[1],[ignore],[ignore])
-archive_contents=`ar -t libbar.a`
-AT_XFAIL_IF([case "$archive_contents" in *"libfoo.a"*) : ;; esac])
+eval `$EGREP '^(old_library)=' < libbar.la`
+libbar=$old_library
+AT_CHECK([$AR -t $libbar | grep $libfoo],[1],[ignore],[ignore])
 AT_CLEANUP
-- 
1.7.1

Reply via email to