torture: Use "-o Batchmode=yes" to disable ssh password requests
authorPaul E. McKenney <paulmck@kernel.org>
Wed, 16 Feb 2022 01:22:32 +0000 (17:22 -0800)
committerPaul E. McKenney <paulmck@kernel.org>
Tue, 12 Apr 2022 00:08:59 +0000 (17:08 -0700)
The torture.sh script normally runs unattended, so there is not much
point in the "ssh" command asking for a password.  This commit therefore
adds the "-o Batchmode=yes" argument to each "ssh" command to cause it
to fail rather than ask for a password.

Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
tools/testing/selftests/rcutorture/bin/kvm-remote.sh

index 03d7ded..0ff59bd 100755 (executable)
@@ -138,7 +138,7 @@ chmod +x $T/bin/kvm-remote-*.sh
 # Check first to avoid the need for cleanup for system-name typos
 for i in $systems
 do
-       ncpus="`ssh $i getconf _NPROCESSORS_ONLN 2> /dev/null`"
+       ncpus="`ssh -o BatchMode=yes $i getconf _NPROCESSORS_ONLN 2> /dev/null`"
        ret=$?
        if test "$ret" -ne 0
        then
@@ -153,14 +153,14 @@ echo Build-products tarball: `du -h $T/binres.tgz` | tee -a "$oldrun/remote-log"
 for i in $systems
 do
        echo Downloading tarball to $i `date` | tee -a "$oldrun/remote-log"
-       cat $T/binres.tgz | ssh $i "cd /tmp; tar -xzf -"
+       cat $T/binres.tgz | ssh -o BatchMode=yes $i "cd /tmp; tar -xzf -"
        ret=$?
        tries=0
        while test "$ret" -ne 0
        do
                echo Unable to download $T/binres.tgz to system $i, waiting and then retrying.  $tries prior retries. | tee -a "$oldrun/remote-log"
                sleep 60
-               cat $T/binres.tgz | ssh $i "cd /tmp; tar -xzf -"
+               cat $T/binres.tgz | ssh -o BatchMode=yes $i "cd /tmp; tar -xzf -"
                ret=$?
                if test "$ret" -ne 0
                then
@@ -185,7 +185,7 @@ checkremotefile () {
 
        while :
        do
-               ssh $1 "test -f \"$2\""
+               ssh -o BatchMode=yes $1 "test -f \"$2\""
                ret=$?
                if test "$ret" -eq 255
                then
@@ -228,7 +228,7 @@ startbatches () {
                then
                        continue # System still running last test, skip.
                fi
-               ssh "$i" "cd \"$resdir/$ds\"; touch remote.run; PATH=\"$T/bin:$PATH\" nohup kvm-remote-$curbatch.sh > kvm-remote-$curbatch.sh.out 2>&1 &" 1>&2
+               ssh -o BatchMode=yes "$i" "cd \"$resdir/$ds\"; touch remote.run; PATH=\"$T/bin:$PATH\" nohup kvm-remote-$curbatch.sh > kvm-remote-$curbatch.sh.out 2>&1 &" 1>&2
                ret=$?
                if test "$ret" -ne 0
                then
@@ -267,7 +267,7 @@ do
                sleep 30
        done
        echo " ---" Collecting results from $i `date` | tee -a "$oldrun/remote-log"
-       ( cd "$oldrun"; ssh $i "cd $rundir; tar -czf - kvm-remote-*.sh.out */console.log */kvm-test-1-run*.sh.out */qemu[_-]pid */qemu-retval */qemu-affinity; rm -rf $T > /dev/null 2>&1" | tar -xzf - )
+       ( cd "$oldrun"; ssh -o BatchMode=yes $i "cd $rundir; tar -czf - kvm-remote-*.sh.out */console.log */kvm-test-1-run*.sh.out */qemu[_-]pid */qemu-retval */qemu-affinity; rm -rf $T > /dev/null 2>&1" | tar -xzf - )
 done
 
 ( kvm-end-run-stats.sh "$oldrun" "$starttime"; echo $? > $T/exitcode ) | tee -a "$oldrun/remote-log"