From d830fef30035ae1c3527a2de5e6f93bf85e94bb4 Mon Sep 17 00:00:00 2001 From: Darryl Green Date: Thu, 4 Apr 2019 11:33:22 +0100 Subject: [PATCH 1/2] Add --internal option to list-identifiers.sh When doing ABI/API checking, its useful to have a list of all the identifiers that are defined in the internal header files, as we do not promise compatibility for them. This option allows for a simple method of getting them for use with the ABI checking script. --- tests/scripts/list-identifiers.sh | 31 +++++++++++++++++++++++++++++-- 1 file changed, 29 insertions(+), 2 deletions(-) diff --git a/tests/scripts/list-identifiers.sh b/tests/scripts/list-identifiers.sh index 130d9d63f..4303413c4 100755 --- a/tests/scripts/list-identifiers.sh +++ b/tests/scripts/list-identifiers.sh @@ -1,4 +1,9 @@ -#!/bin/sh +#!/bin/bash +# +# Outputs a file containing identifiers from internal header files or all +# header files, based on --internal flag. +# +# Usage: list-identifiers.sh [ -i | --internal ] set -eu @@ -7,7 +12,29 @@ if [ -d include/mbedtls ]; then :; else exit 1 fi -HEADERS=$( ls include/mbedtls/*.h | egrep -v 'compat-1\.3\.h|bn_mul' ) +INTERNAL="" + +until [ -z "${1-}" ] +do + case "$1" in + -i|--internal) + INTERNAL="1" + ;; + *) + # print error + echo "Unknown argument: '$1'" + exit 1 + ;; + esac + shift +done + +if [ $INTERNAL ] +then + HEADERS=$( ls include/mbedtls/*_internal.h | egrep -v 'compat-1\.3\.h|bn_mul' ) +else + HEADERS=$( ls include/mbedtls/*.h | egrep -v 'compat-1\.3\.h|bn_mul' ) +fi rm -f identifiers From d0edbd508b0b95d1a4e4e41fe60fdf61df484ddb Mon Sep 17 00:00:00 2001 From: Darryl Green Date: Thu, 18 Apr 2019 13:09:25 +0100 Subject: [PATCH 2/2] Document the scripts behaviour further --- tests/scripts/list-identifiers.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tests/scripts/list-identifiers.sh b/tests/scripts/list-identifiers.sh index 4303413c4..cc9c54fad 100755 --- a/tests/scripts/list-identifiers.sh +++ b/tests/scripts/list-identifiers.sh @@ -1,7 +1,8 @@ #!/bin/bash # -# Outputs a file containing identifiers from internal header files or all -# header files, based on --internal flag. +# Create a file named identifiers containing identifiers from internal header +# files or all header files, based on --internal flag. +# Outputs the line count of the file to stdout. # # Usage: list-identifiers.sh [ -i | --internal ]