mirror of
git://git.savannah.gnu.org/libtool.git
synced 2024-12-27 07:09:26 +08:00
fc9914a1d1
On darwin, uniq can not take the flags -cd together, thanks to Ralf for the fix, also ar does not accept N, so we use the fact that ar x libfoo.a foo.o will always extract the first foo.o in the archive and we then delete foo.o from the archive, which will also delete only the first foo.o, then rinse and repeat. Also add markers for the testuite. * m4/libtool.m4 (_LT_CONFIG): Add a marker so that we can use a sed expression to find the shell functions in libtool. * tests/functests.at: Test this feature. * tests/testsuite.at: Add the test. * tests/Makefile.am: Add the test.
104 lines
3.1 KiB
Plaintext
104 lines
3.1 KiB
Plaintext
# Hand crafted tests for GNU Libtool. -*- Autotest -*-
|
|
# Copyright 2004 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.
|
|
|
|
|
|
AT_BANNER([Libtool's shell function tests.])
|
|
|
|
AT_SETUP([func_extract_archives tests])
|
|
|
|
sed -n -e '/^# TEST SUITE MARKER ## BEGIN SOURCABLE$/,/^# TEST SUITE MARKER ## NON-FUNCTION$/p' < ${abs_top_builddir}/libtool > ltdefs
|
|
|
|
AT_DATA(func_extract_archives,
|
|
[[#! /bin/sh
|
|
# func_extract_archives
|
|
. ./ltdefs
|
|
SED=${SED-sed}
|
|
Xsed="$SED -e s/^X//"
|
|
progname=libtool
|
|
mode=testing
|
|
case $host in
|
|
*darwin*)
|
|
for afile in baz foobar foobaz
|
|
do
|
|
echo "ppc $afile" > $afile.ppc.o
|
|
echo "m68k $afile" > $afile.m68k.o
|
|
echo "i386 $afile" > $afile.i386.o
|
|
lipo -create -output $afile.o -arch ppc $afile.ppc.o -arch m68k \
|
|
$afile.m68k.o -arch i386 $afile.i386.o
|
|
rm -f $afile.*.o
|
|
ar -q libfoo.a $afile.o
|
|
rm -f $afile.o
|
|
done
|
|
for anum in 1 2 3 4 5 6 7 8 9 10 11 12
|
|
do
|
|
echo "ppc foo $anum" > foo.ppc.o
|
|
echo "m68k foo $anum" > foo.m68k.o
|
|
echo "i386 foo $anum" > foo.i386.o
|
|
lipo -create -output foo.o -arch ppc foo.ppc.o -arch m68k foo.m68k.o \
|
|
-arch i386 foo.i386.o
|
|
ar -q libfoo.a foo.o
|
|
rm -f foo.o foo.*.o
|
|
echo "ppc bar $anum" > bar.ppc.o
|
|
echo "m68k bar $anum" > bar.m68k.o
|
|
echo "i386 bar $anum" > bar.i386.o
|
|
lipo -create -output bar.o -arch ppc bar.ppc.o -arch m68k bar.m68k.o \
|
|
-arch i386 bar.i386.o
|
|
ar -q libfoo.a bar.o
|
|
done
|
|
test -d .libs || mkdir .libs
|
|
func_extract_archives ".libs/libfoo" "libfoo.a"
|
|
for anum in 1 2 3 4 5 6 7 8 9 10 11 12
|
|
do
|
|
test -f ".libs/libfoo/libfoo.a/foo-$anum.o" || exit 1
|
|
$EGREP -v "foo-$anum" ".libs/libfoo/libfoo.a/foo-$anum.o" || exit 1
|
|
rm -f ".libs/libfoo/libfoo.a/foo-$anum.o"
|
|
done
|
|
esac
|
|
rm -f foo.o bar.o libfoo.a
|
|
|
|
for afile in baz foobar foobaz
|
|
do
|
|
echo "$afile" > $afile.o
|
|
ar -q libfoo.a $afile.o
|
|
rm -f $afile.o
|
|
done
|
|
for anum in 1 2 3 4 5 6 7 8 9 10 11 12
|
|
do
|
|
echo "foo $anum" > foo.o
|
|
echo "bar $anum" > bar.o
|
|
ar -q libfoo.a foo.o bar.o
|
|
done
|
|
test -d .libs || mkdir .libs
|
|
|
|
func_extract_archives ".libs/libfoo" "libfoo.a"
|
|
for anum in 1 2 3 4 5 6 7 8 9 10 11 12
|
|
do
|
|
test -f ".libs/libfoo/libfoo.a/foo-$anum.o" || exit 1
|
|
$EGREP -v "foo-$anum" ".libs/libfoo/libfoo.a/foo-$anum.o" || exit 1
|
|
rm -f ".libs/libfoo/libfoo.a/foo-$anum.o"
|
|
done
|
|
rm -rf ".libs/libfoo"
|
|
exit 0
|
|
]])
|
|
|
|
chmod +x func_extract_archives
|
|
|
|
AT_CHECK([./func_extract_archives],[0],[ignore],[ignore])
|
|
|
|
AT_CLEANUP
|