From 74a3b90edabfc96931a941026586394af7ba2db6 Mon Sep 17 00:00:00 2001 From: Pengfei Xu Date: Wed, 27 Sep 2023 11:29:52 +0800 Subject: [PATCH] runtests: ensure all list cases are not cleared before testing Shell read command will be cleared in the vm test, ensure all the test TODO list are not cleared before testing, improve the TODO list way. Signed-off-by: Pengfei Xu --- runtests | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/runtests b/runtests index 873b7cc8..acd377e1 100755 --- a/runtests +++ b/runtests @@ -10,6 +10,8 @@ TESTS_CLIENT="tests-client" TESTS_SERVER="tests-server" TEST_FILES="" SUB_FOLDERS="" +TEST_LIST_FILE="/tmp/tests" +OLD_IFS="" usage() { cat << _EOF @@ -100,6 +102,8 @@ runcmdfile() { local logfile=$2 local subfolder="" local file_type="" + local lines="" + local line="" if [[ "$cmdfile" == *"/"* ]]; then subfolder=${cmdfile%/*} @@ -107,13 +111,14 @@ runcmdfile() { echo "cmdfile:$cmdfile(no '/') is not in a subfolder!" fi - while read -r line; do - if grep -Eq "^#.*" <<< "$line" || grep -Eq "^$" <<< "$line"; then - continue - fi - + grep -v "^#.*" "$cmdfile" | grep -v "^$" > "$TEST_LIST_FILE" + lines=$(cat $TEST_LIST_FILE) + OLD_IFS="$IFS" + IFS=$'\n' + for line in $lines; do runtest "$line" "$logfile" "$subfolder" - done < "$cmdfile" + done + IFS="$OLD_IFS" } prepare_files_list() {