Merge check-internal-symbols.sh and check-exported-symbols.sh

This commit is contained in:
Behdad Esfahbod 2013-02-04 23:06:50 -05:00
parent ceeae30f47
commit bafdf3d983
3 changed files with 14 additions and 39 deletions

View File

@ -277,9 +277,8 @@ test_size_params_LDADD = libharfbuzz.la $(HBLIBS)
dist_check_SCRIPTS = \ dist_check_SCRIPTS = \
check-c-linkage-decls.sh \ check-c-linkage-decls.sh \
check-header-guards.sh \ check-header-guards.sh \
check-exported-symbols.sh \
check-includes.sh \ check-includes.sh \
check-internal-symbols.sh \ check-symbols.sh \
$(NULL) $(NULL)
if HAVE_ICU if HAVE_ICU

View File

@ -1,34 +0,0 @@
#!/bin/sh
LC_ALL=C
export LC_ALL
test -z "$srcdir" && srcdir=.
stat=0
if which nm 2>/dev/null >/dev/null; then
:
else
echo "check-internal-symbols.sh: 'nm' not found; skipping test"
exit 77
fi
tested=false
for suffix in .so; do
so=`echo .libs/libharfbuzz$suffix`
if test -f "$so"; then
echo "Checking that we are not exposing internal symbols"
if nm "$so" | grep ' [BCDGINRSTVW] ' | grep -v ' T _fini\>\| T _init\>\| T hb_\| __bss_start\>\| __bss_start__\>\| __bss_end__\>\| _edata\>\| _end\>\| _bss_end__\>\| __end__\>'; then
echo "Ouch, internal symbols exposed"
stat=1
fi
tested=true
fi
done
if ! $tested; then
echo "check-internal-symbols.sh: libharfbuzz shared library not found; skipping test"
exit 77
fi
exit $stat

View File

@ -10,7 +10,7 @@ stat=0
if which nm 2>/dev/null >/dev/null; then if which nm 2>/dev/null >/dev/null; then
: :
else else
echo "check-exported-symbols.sh: 'nm' not found; skipping test" echo "check-symbols.sh: 'nm' not found; skipping test"
exit 77 exit 77
fi fi
@ -20,15 +20,25 @@ tested=false
for def in $defs; do for def in $defs; do
lib=`echo "$def" | sed 's/[.]def$//;s@.*/@@'` lib=`echo "$def" | sed 's/[.]def$//;s@.*/@@'`
so=.libs/lib${lib}.so so=.libs/lib${lib}.so
EXPORTED_SYMBOLS="`nm "$so" | grep ' [BCDGINRSTVW] ' | grep -v ' T _fini\>\| T _init\>\| __bss_start\>\| __bss_start__\>\| __bss_end__\>\| _edata\>\| _end\>\| _bss_end__\>\| __end__\>' | cut -d' ' -f3`"
if test -f "$so"; then if test -f "$so"; then
echo "Checking that $so has the same symbol list as $def" echo "Checking that $so has the same symbol list as $def"
{ {
echo EXPORTS echo EXPORTS
nm "$so" | grep ' [BCDGINRSTVW] ' | grep -v ' T _fini\>\| T _init\>\| __bss_start\>\| __bss_start__\>\| __bss_end__\>\| _edata\>\| _end\>\| _bss_end__\>\| __end__\>' | cut -d' ' -f3 echo "$EXPORTED_SYMBOLS"
stat=1
# cheat: copy the last line from the def file! # cheat: copy the last line from the def file!
tail -n1 "$def" tail -n1 "$def"
} | diff "$def" - >&2 || stat=1 } | diff "$def" - >&2 || stat=1
echo "Checking that we are not exposing internal symbols"
if echo "$EXPORTED_SYMBOLS" | grep -v 'hb_'; then
echo "Ouch, internal symbols exposed"
stat=1
fi
tested=true tested=true
fi fi
done done