From 421b19c488b2d78925361a6697d60a4f85a515cf Mon Sep 17 00:00:00 2001 From: Krystian Hebel Date: Mon, 28 Jul 2025 14:04:04 +0200 Subject: [PATCH] scripts/regression.sh: allow for execution of tests from the release scope Release scope can be taken directly from the release document in the database to avoid running unnecessary tests and avoid mistakes. To run the script that way, it must be started as: DB_URL=http://web:site@localhost:5984 \ REL_ID=f1ce0f69153f6e229363c653aacb4aad \ FW_FILE=... CONFIG=... DEVICE_IP=... \ ./scripts/regression.sh Signed-off-by: Krystian Hebel --- scripts/lib/robot.sh | 5 ++++- scripts/regression.sh | 16 +++++++++++++--- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/scripts/lib/robot.sh b/scripts/lib/robot.sh index a53ee8ed95..64c2db43a3 100644 --- a/scripts/lib/robot.sh +++ b/scripts/lib/robot.sh @@ -54,7 +54,7 @@ execute_robot() { # scope and additional arguments to robot which need to be separated # when calling robot for ((i=0;i<_args_len;i++)); do - if [[ ${_args[$i]} == *"--"* ]]; then + if [[ ${_args[$i]} == "--" ]]; then _separator_idx=$i break fi @@ -67,6 +67,9 @@ execute_robot() { if [[ $_separator_idx -gt 0 ]]; then _separator_idx=$_separator_idx+1 for ((i=_separator_idx;i<_args_len;i++)); do + if [[ ${_args[$i]} == "--" ]]; then + continue + fi # Some arguments may contain spaces. Bash removes quotation marks # from command arguments. Because we need to pass them again to # another command the quotation marks need to be restored or the arguments diff --git a/scripts/regression.sh b/scripts/regression.sh index 1948b4f965..5aa96fc1c2 100755 --- a/scripts/regression.sh +++ b/scripts/regression.sh @@ -25,6 +25,16 @@ if [ -z "$NO_SETUP" ]; then execute_robot "util/basic-platform-setup.robot" "${@}" fi -execute_robot "dasharo-compatibility" "${@}" -execute_robot "dasharo-security" "${@}" -execute_robot "dasharo-performance" "${@}" +TESTS="" + +if [ -n "$REL_ID" ] && [ -n "$DB_URL" ]; then + TESTS+=" --" + JSON=`curl -s -k "$DB_URL/releases/$REL_ID"` + for t in `echo "$JSON" | jq '.test_cases | map_values(select(endswith("automated"))) | keys | map(.+"*") | .[]'`; do + TESTS+=" -t $t" + done +fi + +execute_robot "dasharo-compatibility" "${@}" $TESTS +execute_robot "dasharo-security" "${@}" $TESTS +execute_robot "dasharo-performance" "${@}" $TESTS