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,6 +35,7 @@ esac
35 35
 ISNUM='^[0-9]+$'
36 36
 ISCMD='^(restore|opt|exec|use|pins|env)_'
37 37
 ISEXEC='^exec_'
38
+ISCONT='\\ *$'
38 39
 
39 40
 # List available tests and ask for selection
40 41
 if [[ $TESTENV == '-' ]]; then
@@ -102,9 +103,11 @@ fi
102 103
 # Finally, run the specified test lines
103 104
 echo "$OUT" | {
104 105
   IND=0
106
+  GOTX=0
107
+  CMD=""
105 108
   while IFS= read -r LINE
106 109
   do
107
-    if [[ $LINE =~ $ISCMD ]]; then
110
+    if [[ $LINE =~ $ISCMD || $GOTX == 1 ]]; then
108 111
       ((!IND)) && let IND++
109 112
       if [[ $LINE =~ $ISEXEC ]]; then
110 113
         ((IND++ > CHOICE)) && break
@@ -113,7 +116,11 @@ echo "$OUT" | {
113 116
           HEADER=1
114 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 124
       fi
118 125
     fi
119 126
   done

Loading…
Cancel
Save