Add symbol tests for apple

closes #21
This commit is contained in:
2024-04-03 12:15:08 -07:00
parent 38c1481432
commit c4862fee9b
5 changed files with 48 additions and 7 deletions

View File

@@ -2,5 +2,15 @@
set -euo pipefail
# ./test_symbols.sh <library> <expected exported symbols file> <allowed imported symbols file>
diff -u <(sort < "$2") <(nm "$1" | grep " T " | cut -f3 -d " " | sort)
nm "$1" | grep " U " | (! grep -Pv 'abort|free|malloc|mem[a-z]*|__ashlti3|__stack_chk_[a-z]*|__tls_get_addr|_GLOBAL_OFFSET_TABLE_')
ec=0
for symbol in $(nm "$1" | grep " U " | sed 's/ U //') ; do
if ! grep "$symbol" "$3" > /dev/null ; then
echo "Imported symbol $symbol not present in $3"
ec=1
fi
done
exit $ec