compat.sh: uniform test description
Test case description is printed by different block of code. This
causes code maintenance harder since we need to maintain two parts
of code with same functionality. print_test_title is used to
control test case description in compat.sh
Signed-off-by: Yanray Wang <yanray.wang@arm.com>
diff --git a/tests/compat.sh b/tests/compat.sh
index 440e87a..9a435c3 100755
--- a/tests/compat.sh
+++ b/tests/compat.sh
@@ -35,6 +35,7 @@
FAILED=0
SKIPPED=0
SRVMEM=0
+LIST_TEST_CASE=0
# default commands, can be overridden by the environment
: ${M_SRV:=../programs/ssl/ssl_server2}
@@ -113,14 +114,6 @@
printf " --list-test-case\tList all potential test cases (No Execution)\n"
}
-# print_test_title <CLIENT> <SERVER> <STANDARD_CIPHER_SUITE>
-print_test_title() {
- for i in $3; do
- TITLE="$1->$2 $MODE,$VERIF $i"
- echo "$TITLE"
- done
-}
-
list_test_case() {
reset_ciphersuites
for TYPE in $TYPES; do
@@ -170,6 +163,7 @@
MEMCHECK=1
;;
--list-test-case)
+ LIST_TEST_CASE=1
list_test_case
exit 0
;;
@@ -824,14 +818,21 @@
echo "EXIT: $EXIT" >> $CLI_OUT
}
+# print_test_title <CLIENT> <SERVER> <STANDARD_CIPHER_SUITE>
+print_test_title() {
+ for i in $3; do
+ TITLE="$1->$2 $MODE,$VERIF $i"
+ DOTS72="........................................................................"
+ printf "%s %.*s " "$TITLE" "$((71 - ${#TITLE}))" "$DOTS72"
+ [ $LIST_TEST_CASE -eq 1 ] && printf "\n"
+ done
+}
+
# run_client PROGRAM_NAME STANDARD_CIPHER_SUITE PROGRAM_CIPHER_SUITE
run_client() {
# announce what we're going to do
TESTS=$(( $TESTS + 1 ))
- TITLE="${1%"${1#?}"}->${SERVER_NAME%"${SERVER_NAME#?}"}"
- TITLE="$TITLE $MODE,$VERIF $2"
- DOTS72="........................................................................"
- printf "%s %.*s " "$TITLE" "$((71 - ${#TITLE}))" "$DOTS72"
+ print_test_title "${1%"${1#?}"}" "${SERVER_NAME%"${SERVER_NAME#?}"}" $2
# should we skip?
if [ "X$SKIP_NEXT" = "XYES" ]; then
diff --git a/tests/scripts/check_test_cases.py b/tests/scripts/check_test_cases.py
index dd16767..b75d517 100755
--- a/tests/scripts/check_test_cases.py
+++ b/tests/scripts/check_test_cases.py
@@ -123,8 +123,8 @@
print(*compat_cmd, 'returned', str(result.returncode))
return
else:
- # Pattern: g->m dtls12,no TLS_DHE_PSK_WITH_AES_128_CBC_SHA\n
- m = re.findall(br'[^ogm]*((?:[ogm]->[ogm]\s*\w*.\w*\s\w*)*)\n',
+ # Pattern: g->m dtls12,no TLS_DHE_PSK_WITH_AES_128_CBC_SHA .......... \n
+ m = re.findall(br'[^ogm]*((?:[ogm]->[ogm]\s*\w*.\w*\s\w*)*)\s*\.*\s*\n',
result.stdout)
if m:
for i in m: