Symbol visibility tests
This commit is contained in:
16
test_symbols.sh
Executable file
16
test_symbols.sh
Executable file
@@ -0,0 +1,16 @@
|
||||
#!/bin/bash
|
||||
|
||||
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)
|
||||
ec=0
|
||||
for symbol in $(nm "$1" | grep " U " | sed 's/ U //') ; do
|
||||
if ! grep --fixed-strings "$symbol" "$3" > /dev/null ; then
|
||||
echo "Imported symbol $symbol not present in $3"
|
||||
ec=1
|
||||
fi
|
||||
done
|
||||
|
||||
exit $ec
|
Reference in New Issue
Block a user