Browse Source

mftest: Fix multi-line commands

Scott Lahteine 5 years ago
parent
commit
39a5e3ca6e
1 changed files with 9 additions and 2 deletions
  1. 9
    2
      buildroot/share/git/mftest

+ 9
- 2
buildroot/share/git/mftest View File

35
 ISNUM='^[0-9]+$'
35
 ISNUM='^[0-9]+$'
36
 ISCMD='^(restore|opt|exec|use|pins|env)_'
36
 ISCMD='^(restore|opt|exec|use|pins|env)_'
37
 ISEXEC='^exec_'
37
 ISEXEC='^exec_'
38
+ISCONT='\\ *$'
38
 
39
 
39
 # List available tests and ask for selection
40
 # List available tests and ask for selection
40
 if [[ $TESTENV == '-' ]]; then
41
 if [[ $TESTENV == '-' ]]; then
102
 # Finally, run the specified test lines
103
 # Finally, run the specified test lines
103
 echo "$OUT" | {
104
 echo "$OUT" | {
104
   IND=0
105
   IND=0
106
+  GOTX=0
107
+  CMD=""
105
   while IFS= read -r LINE
108
   while IFS= read -r LINE
106
   do
109
   do
107
-    if [[ $LINE =~ $ISCMD ]]; then
110
+    if [[ $LINE =~ $ISCMD || $GOTX == 1 ]]; then
108
       ((!IND)) && let IND++
111
       ((!IND)) && let IND++
109
       if [[ $LINE =~ $ISEXEC ]]; then
112
       if [[ $LINE =~ $ISEXEC ]]; then
110
         ((IND++ > CHOICE)) && break
113
         ((IND++ > CHOICE)) && break
113
           HEADER=1
116
           HEADER=1
114
           echo -e "\n#\n# Test $TESTENV ($CHOICE) $DESC\n#"
117
           echo -e "\n#\n# Test $TESTENV ($CHOICE) $DESC\n#"
115
         }
118
         }
116
-        ((IND == CHOICE)) && { echo "$LINE" ; eval "$LINE" ; }
119
+        ((IND == CHOICE)) && {
120
+          GOTX=1
121
+          [[ $CMD == "" ]] && CMD="$LINE" || CMD=$( echo -e "$CMD$LINE" | sed -e 's/\\//g' )
122
+          [[ $LINE =~ $ISCONT ]] || { echo $CMD ; eval "$CMD" ; CMD="" ; }
123
+        }
117
       fi
124
       fi
118
     fi
125
     fi
119
   done
126
   done

Loading…
Cancel
Save