1
0
mirror of https://github.com/ARMmbed/mbedtls.git synced 2025-05-10 17:01:41 +08:00

Avoid using external programs in inner loops

Don't use external programs for string manipulation that the shell can do.
This makes the script a little faster (~10% when testing PSK).

For this commit, I only looked at code run in the innermost loop.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
This commit is contained in:
Gilles Peskine 2023-01-26 21:34:01 +01:00
parent 47aab850da
commit b20028b3a3

View File

@ -679,7 +679,11 @@ setup_arguments()
# is_mbedtls <cmd_line>
is_mbedtls() {
echo "$1" | grep 'ssl_server2\|ssl_client2' > /dev/null
case $1 in
*ssl_client2*) true;;
*ssl_server2*) true;;
*) false;;
esac
}
# has_mem_err <log_file_name>
@ -798,12 +802,9 @@ wait_client_done() {
run_client() {
# announce what we're going to do
TESTS=$(( $TESTS + 1 ))
VERIF=$(echo $VERIFY | tr '[:upper:]' '[:lower:]')
TITLE="`echo $1 | head -c1`->`echo $SERVER_NAME | head -c1`"
TITLE="${1%"${1#?}"}->${SERVER_NAME%"${SERVER_NAME#?}"}"
TITLE="$TITLE $MODE,$VERIF $2"
printf "%s " "$TITLE"
LEN=$(( 72 - `echo "$TITLE" | wc -c` ))
for i in `seq 1 $LEN`; do printf '.'; done; printf ' '
printf "%s %.*s " "$TITLE" "$((72 - ${#TITLE}))" ........................................................................
# should we skip?
if [ "X$SKIP_NEXT" = "XYES" ]; then
@ -996,6 +997,7 @@ SKIP_NEXT="NO"
trap cleanup INT TERM HUP
for VERIFY in $VERIFIES; do
VERIF=$(echo $VERIFY | tr '[:upper:]' '[:lower:]')
for MODE in $MODES; do
for TYPE in $TYPES; do
for PEER in $PEERS; do