From 439a696903a9aaa45ed5d3909466c23c2b324b46 Mon Sep 17 00:00:00 2001 From: Joe Subbiani Date: Thu, 29 Jul 2021 12:51:09 +0100 Subject: [PATCH] Improve translation error checking If translate_ciphers.py is used incorrectly in compat.sh, an error check function - check_translation - is called to evaluate and inform the user of the error that has occured. Added an output that informs the users an error has taken place in translate_ciphers.py incase the error response is an empty string. Signed-off-by: Joe Subbiani --- tests/compat.sh | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/tests/compat.sh b/tests/compat.sh index e532604bf..36018f2d1 100755 --- a/tests/compat.sh +++ b/tests/compat.sh @@ -238,8 +238,9 @@ reset_ciphersuites() check_translation() { - if [ $? -eq 1 ]; then - echo $T + if [ $1 -ne 0 ]; then + echo "translate_ciphers.py failed with exit code $1" >&2 + echo "$2" >&2 exit 1 fi } @@ -329,11 +330,11 @@ add_common_ciphersuites() M_CIPHERS="$M_CIPHERS $CIPHERS" T=`python3 scripts/translate_ciphers.py g "$CIPHERS"` - check_translation $? $T + check_translation $? "$T" G_CIPHERS="$G_CIPHERS $T" T=`python3 scripts/translate_ciphers.py o "$CIPHERS"` - check_translation $? $T + check_translation $? "$T" O_CIPHERS="$O_CIPHERS $T" } @@ -417,7 +418,7 @@ add_openssl_ciphersuites() M_CIPHERS="$M_CIPHERS $CIPHERS" T=`python3 scripts/translate_ciphers.py o "$CIPHERS"` - check_translation $? $T + check_translation $? "$T" O_CIPHERS="$O_CIPHERS $T" } @@ -551,7 +552,7 @@ add_gnutls_ciphersuites() M_CIPHERS="$M_CIPHERS $CIPHERS" T=`python3 scripts/translate_ciphers.py g "$CIPHERS"` - check_translation $? $T + check_translation $? "$T" G_CIPHERS="$G_CIPHERS $T" }