aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorarehbein <arehbein@sysmocom.de>2023-01-31 01:30:15 +0100
committerarehbein <arehbein@sysmocom.de>2023-09-26 23:27:16 +0200
commit68a48089674eacc43f14b50fa0f874387db1a9ea (patch)
tree2eb30ee950c8fa11c64274b2d9d9f3fe4ce41c84
parentb355ac3615f7b38708fa859b29558f33a5b3c4f4 (diff)
scripts/docker-playground_adapt: Fix testcase order
Fix testcase order being reversed due to inserting item by item after [EXECUTE] line, before previous item Print hint if file list is empty Change-Id: Iebc462b8fdbfaa52db59da8373c760da9fd2c4e8
-rwxr-xr-xscripts/docker-playground_adapt15
1 files changed, 10 insertions, 5 deletions
diff --git a/scripts/docker-playground_adapt b/scripts/docker-playground_adapt
index 43e35fe..10270dc 100755
--- a/scripts/docker-playground_adapt
+++ b/scripts/docker-playground_adapt
@@ -125,7 +125,7 @@ adapt_ttcn3_testcases() {
FNAME_REGEX="/$SUBDIR/.*/\?$TESTSUITE_CFG"
fi
if [ -n "$TESTCASES" ] && echo "$file" | grep -q "[^/]*$FNAME_REGEX"; then
- if ! user_wants "Adapt file $file?" "$NO_PROMPT"; then # Multiple cfg files possible, so we prompt
+ if [ -z "$NO_PROMPT_TC" ] && ! user_wants "Adapt file $file?" "$NO_PROMPT"; then # Multiple cfg files possible, so we prompt
break; # Avoid too many nested ifs...
fi
TMP_FILE="/tmp/$$_file"
@@ -139,8 +139,12 @@ adapt_ttcn3_testcases() {
REPLACE_ERR=1
fi
fi
- # Append testcase lines
- for tc in $TESTCASES; do
+ # Insert testcase lines after [EXECUTE] block. This means the list of testcases
+ # has to be reversed. We use tac, which only works like we want if we
+ # - prepend and append a space
+ # - echo without a trailing newline
+ TESTCASES_FOR_REVERSAL=" $TESTCASES "
+ for tc in $(echo -n "$TESTCASES_FOR_REVERSAL" | tac -s' '); do
tc_testsuite="$(echo $tc | grep '\.' | sed 's/\([^\.]\+\)\..*/\1/')"
if [ $testsuite != $tc_testsuite ]; then
continue
@@ -195,7 +199,6 @@ adapt_dockerfile() {
echo "Found more than one line entry matching 'CMD.*git clone' in '"$(pwd)"'/Dockerfile, not proceeding" >&2
exit 1
fi
- set -x
sed -i 's:RUN.*git clone.*$:ADD\t'"$DOCKER_SUBDIR"' '"$DOCKER_SUBDIR"':g' Dockerfile # Should fit the Dockerfile, e.g. 'osmo-bts' still being used inside Docker
CD_LINE="RUN.*cd $DOCKER_SUBDIR"
# INSTALL_LINE=".*make.*install$"
@@ -211,7 +214,6 @@ adapt_dockerfile() {
fi
fi
sed -i '/ADD.*http.* .*commit-.*$/d' Dockerfile
- set +x
}
# Use to test if anything is to be done
@@ -395,6 +397,9 @@ if [ -n "$TESTCASE_OPT" ]; then
FILE_LIST="$(find $REPO_ROOT -name "$TESTSUITE_CFG" -exec readlink -f {} \;)"
if [ -n "$LIST_FILES" ]; then
list_files "Target files for adapting testcases (testsuite $testsuite)" $FILE_LIST
+ elif [ -z "$FILE_LIST" ]; then
+ echo "Empty file list for adapting testcases. Maybe you need to adapt the config file basename via the '-c'-flag" >&2
+ echo "Current config file basename searched for: $TESTSUITE_CFG" >&2
else
adapt_ttcn3_testcases $FILE_LIST
fi