16451: make it possible to run a test many times in interactive mode.
authorWard Vandewege <ward@jhvc.com>
Tue, 19 May 2020 20:53:11 +0000 (16:53 -0400)
committerWard Vandewege <ward@jhvc.com>
Wed, 20 May 2020 14:00:06 +0000 (10:00 -0400)
Arvados-DCO-1.1-Signed-off-by: Ward Vandewege <ward@jhvc.com>

build/run-tests.sh

index 0212d1bc0e13e7b6202a04f4da00436a6c278ed1..70aec2aa145f744d62e836409a33acfcae757a9e 100755 (executable)
@@ -1205,6 +1205,7 @@ help_interactive() {
     echo "== Interactive commands:"
     echo "TARGET                 (short for 'test DIR')"
     echo "test TARGET"
+    echo "10 test TARGET         (run test 10 times)"
     echo "test TARGET:py3        (test with python3)"
     echo "test TARGET -check.vv  (pass arguments to test)"
     echo "install TARGET"
@@ -1265,7 +1266,15 @@ else
     while read -p 'What next? ' -e -i "$nextcmd" nextcmd; do
         history -s "$nextcmd"
         history -w
-        read verb target opts <<<"${nextcmd}"
+        read verb target opt1 opts <<<"${nextcmd}"
+        count=1
+        if [[ "$verb" =~ ^[0-9]+$ ]]; then
+          count=$verb
+          verb=${target}
+          target=$opt1
+        else
+          opts="$opt1 $opts"
+        fi
         target="${target%/}"
         target="${target/\/:/:}"
         case "${verb}" in
@@ -1284,11 +1293,14 @@ else
                         ${verb}_${target}
                         ;;
                     *)
-                       argstarget=${target%:py3}
+                        argstarget=${target%:py3}
                         testargs["$argstarget"]="${opts}"
                         tt="${testfuncargs[${target}]}"
                         tt="${tt:-$target}"
-                        do_$verb $tt
+                        while [ $count -gt 0 ]; do
+                          do_$verb $tt
+                          let "count=count-1"
+                        done
                         ;;
                 esac
                 ;;