tests: Verify there are no duplicate symbols exported

This commit is contained in:
Jakub Jelen 2020-12-11 20:13:00 +01:00 committed by Jakub Jelen
parent 88543529a2
commit b48696539d
2 changed files with 22 additions and 1 deletions

View File

@ -8,7 +8,8 @@ dist_noinst_SCRIPTS = common.sh \
test-pkcs11-tool-allowed-mechanisms.sh
TESTS = \
test-manpage.sh \
test-manpage.sh \
test-duplicate-symbols.sh \
test-pkcs11-tool-sign-verify.sh \
test-pkcs11-tool-test.sh \
test-pkcs11-tool-allowed-mechanisms.sh

20
tests/test-duplicate-symbols.sh Executable file
View File

@ -0,0 +1,20 @@
#!/bin/bash
SOURCE_PATH=../
EXPORTS=`find "${SOURCE_PATH}" -name "*exports"`
ERRORS=0
for E in $EXPORTS; do
NUM_DUPES=`sort $E | uniq -D | wc -l`
if [[ "$NUM_DUPES" != 0 ]]; then
echo "There are duplicate symbols in '$E'"
ERRORS=1
fi
done
if [[ "$ERRORS" = 1 ]]; then
echo "There are duplicate symbols"
exit 1
fi
exit $ERRORS