Manuel Pégourié-Gonnard | e137ea6 | 2015-04-09 10:47:44 +0200 | [diff] [blame^] | 1 | #!/bin/sh |
| 2 | |
| 3 | set -eu |
| 4 | |
| 5 | tests/scripts/list-macros.sh |
| 6 | tests/scripts/list-enum-consts.pl |
| 7 | tests/scripts/list-identifiers.sh |
| 8 | tests/scripts/list-symbols.sh |
| 9 | |
| 10 | FAIL=0 |
| 11 | |
| 12 | printf "Exported symbols declared in header: " |
| 13 | UNDECLARED=$( diff exported-symbols identifiers | sed -n -e 's/^< //p' ) |
| 14 | if [ "x$UNDECLARED" == "x" ]; then |
| 15 | echo "PASS" |
| 16 | else |
| 17 | echo "FAIL" |
| 18 | echo "$UNDECLARED" |
| 19 | FAIL=1 |
| 20 | fi |
| 21 | |
| 22 | diff macros identifiers | sed -n -e 's/< //p' > actual-macros |
| 23 | |
| 24 | for THING in actual-macros enum-consts; do |
| 25 | printf "Names of $THING: " |
| 26 | test -r $THING |
| 27 | BAD=$( grep -v '^MBEDTLS_[0-9A-Z_]*[0-9A-Z]$' $THING || true ) |
| 28 | if [ "x$BAD" = "x" ]; then |
| 29 | echo "PASS" |
| 30 | else |
| 31 | echo "FAIL" |
| 32 | echo "$BAD" |
| 33 | FAIL=1 |
| 34 | fi |
| 35 | done |
| 36 | |
| 37 | for THING in identifiers; do |
| 38 | printf "Names of $THING: " |
| 39 | test -r $THING |
| 40 | BAD=$( grep -v '^mbedtls_[0-9a-z_]*[0-9a-z]$' $THING || true ) |
| 41 | if [ "x$BAD" = "x" ]; then |
| 42 | echo "PASS" |
| 43 | else |
| 44 | echo "FAIL" |
| 45 | echo "$BAD" |
| 46 | FAIL=1 |
| 47 | fi |
| 48 | done |
| 49 | |
| 50 | if [ "$FAIL" -eq 0 ]; then |
| 51 | rm macros actual-macros enum-consts identifiers exported-symbols |
| 52 | echo "PASSED" |
| 53 | exit 0 |
| 54 | else |
| 55 | echo "FAILED" |
| 56 | exit 1 |
| 57 | fi |