From 03091d1114450dd19a10215094682f14761540d9 Mon Sep 17 00:00:00 2001 From: Nir Sonnenschein Date: Tue, 8 Jan 2019 18:15:50 +0200 Subject: [PATCH 1/2] modify check-names.sh and list-macros.sh to work with PSA constants fixed processing of PSA macros in check names script. This required changes in: *list-macros.sh to scan the PSA headers *check-names to scan PSA files and allow PSA_* macro names --- tests/scripts/check-names.sh | 6 ++++-- tests/scripts/list-macros.sh | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/tests/scripts/check-names.sh b/tests/scripts/check-names.sh index addcc05dc1..a90d2c027b 100755 --- a/tests/scripts/check-names.sh +++ b/tests/scripts/check-names.sh @@ -40,7 +40,7 @@ diff macros identifiers | sed -n -e 's/< //p' > actual-macros for THING in actual-macros enum-consts; do printf "Names of $THING: " test -r $THING - BAD=$( grep -v '^MBEDTLS_[0-9A-Z_]*[0-9A-Z]$' $THING || true ) + BAD=$( grep -E -v '^(MBEDTLS|PSA)_[0-9A-Z_]*[0-9A-Z]$' $THING || true ) if [ "x$BAD" = "x" ]; then echo "PASS" else @@ -65,12 +65,14 @@ done printf "Likely typos: " sort -u actual-macros enum-consts > _caps -HEADERS=$( ls include/mbedtls/*.h | egrep -v 'compat-1\.3\.h' ) +HEADERS=$( ls include/mbedtls/*.h include/psa/*.h | egrep -v 'compat-1\.3\.h' ) NL=' ' sed -n 's/MBED..._[A-Z0-9_]*/\'"$NL"'&\'"$NL"/gp \ $HEADERS library/*.c \ | grep MBEDTLS | sort -u > _MBEDTLS_XXX + + TYPOS=$( diff _caps _MBEDTLS_XXX | sed -n 's/^> //p' \ | egrep -v 'XXX|__|_$|^MBEDTLS_.*CONFIG_FILE$' || true ) rm _MBEDTLS_XXX _caps diff --git a/tests/scripts/list-macros.sh b/tests/scripts/list-macros.sh index 3c84adba63..5982bb7a02 100755 --- a/tests/scripts/list-macros.sh +++ b/tests/scripts/list-macros.sh @@ -7,7 +7,7 @@ if [ -d include/mbedtls ]; then :; else exit 1 fi -HEADERS=$( ls include/mbedtls/*.h | egrep -v 'compat-1\.3\.h' ) +HEADERS=$( ls include/mbedtls/*.h include/psa/*.h | egrep -v 'compat-1\.3\.h' ) sed -n -e 's/.*#define \([a-zA-Z0-9_]*\).*/\1/p' $HEADERS \ | egrep -v '^(asm|inline|EMIT|_CRT_SECURE_NO_DEPRECATE)$|^MULADDC_' \ From 6bd14269c948492ca3e8e99cf8305f60c2377727 Mon Sep 17 00:00:00 2001 From: Nir Sonnenschein Date: Wed, 9 Jan 2019 00:32:56 +0200 Subject: [PATCH 2/2] remove excess whitespace --- tests/scripts/check-names.sh | 2 -- 1 file changed, 2 deletions(-) diff --git a/tests/scripts/check-names.sh b/tests/scripts/check-names.sh index a90d2c027b..925037c330 100755 --- a/tests/scripts/check-names.sh +++ b/tests/scripts/check-names.sh @@ -71,8 +71,6 @@ NL=' sed -n 's/MBED..._[A-Z0-9_]*/\'"$NL"'&\'"$NL"/gp \ $HEADERS library/*.c \ | grep MBEDTLS | sort -u > _MBEDTLS_XXX - - TYPOS=$( diff _caps _MBEDTLS_XXX | sed -n 's/^> //p' \ | egrep -v 'XXX|__|_$|^MBEDTLS_.*CONFIG_FILE$' || true ) rm _MBEDTLS_XXX _caps