Browse Source

mftest: Fix multi-line commands

pull/1/head
Scott Lahteine 6 years ago
committed by Scott Lahteine
parent
commit
39a5e3ca6e
  1. 11
      buildroot/share/git/mftest

11
buildroot/share/git/mftest

@ -35,6 +35,7 @@ esac
ISNUM='^[0-9]+$' ISNUM='^[0-9]+$'
ISCMD='^(restore|opt|exec|use|pins|env)_' ISCMD='^(restore|opt|exec|use|pins|env)_'
ISEXEC='^exec_' ISEXEC='^exec_'
ISCONT='\\ *$'
# List available tests and ask for selection # List available tests and ask for selection
if [[ $TESTENV == '-' ]]; then if [[ $TESTENV == '-' ]]; then
@ -102,9 +103,11 @@ fi
# Finally, run the specified test lines # Finally, run the specified test lines
echo "$OUT" | { echo "$OUT" | {
IND=0 IND=0
GOTX=0
CMD=""
while IFS= read -r LINE while IFS= read -r LINE
do do
if [[ $LINE =~ $ISCMD ]]; then if [[ $LINE =~ $ISCMD || $GOTX == 1 ]]; then
((!IND)) && let IND++ ((!IND)) && let IND++
if [[ $LINE =~ $ISEXEC ]]; then if [[ $LINE =~ $ISEXEC ]]; then
((IND++ > CHOICE)) && break ((IND++ > CHOICE)) && break
@ -113,7 +116,11 @@ echo "$OUT" | {
HEADER=1 HEADER=1
echo -e "\n#\n# Test $TESTENV ($CHOICE) $DESC\n#" echo -e "\n#\n# Test $TESTENV ($CHOICE) $DESC\n#"
} }
((IND == CHOICE)) && { echo "$LINE" ; eval "$LINE" ; } ((IND == CHOICE)) && {
GOTX=1
[[ $CMD == "" ]] && CMD="$LINE" || CMD=$( echo -e "$CMD$LINE" | sed -e 's/\\//g' )
[[ $LINE =~ $ISCONT ]] || { echo $CMD ; eval "$CMD" ; CMD="" ; }
}
fi fi
fi fi
done done

Loading…
Cancel
Save