Lines Matching +full:sub +full:- +full:systems
2 # SPDX-License-Identifier: GPL-2.0+
4 # Run a series of tests on remote systems under KVM.
6 # Usage: kvm-remote.sh "systems" [ <kvm.sh args> ]
7 # kvm-remote.sh "systems" /path/to/old/run [ <kvm-again.sh args> ]
16 if ! test -d tools/testing/selftests/rcutorture/bin
18 echo $scriptname must be run from top-level directory of kernel source tree.
28 systems="$1"
29 if test -z "$systems"
31 echo $scriptname: Empty list of systems will go nowhere good, giving up.
37 # T: /tmp/kvm-remote.sh.$$
38 # resdir: /tmp/kvm-remote.sh.$$/res
39 # rundir: /tmp/kvm-remote.sh.$$/res/$ds ("-remote" suffix)
43 # TD: kvm-remote.sh.$$
44 # ds: yyyy.mm.dd-hh.mm.ss-remote
46 TD=kvm-remote.sh.$$
47 T=${TMPDIR-/tmp}/$TD
48 trap 'rm -rf $T' 0
52 ds=`date +%Y.%m.%d-%H.%M.%S`-remote
56 if echo $1 | grep -q '^--'
59 datestamp="`echo "$@" | awk -v ds="$ds" '{
61 if ($i == "--datestamp") {
67 print "--datestamp " ds;
69 kvm.sh --remote "$@" $datestamp --buildonly > $T/kvm.sh.out 2>&1
71 if test "$ret" -ne 0
77 oldrun="`grep -m 1 "^Results directory: " $T/kvm.sh.out | awk '{ print $3 }'`"
78 touch "$oldrun/remote-log"
79 echo $scriptname $args >> "$oldrun/remote-log"
80 echo | tee -a "$oldrun/remote-log"
81 echo " ----" kvm.sh output: "(`date`)" | tee -a "$oldrun/remote-log"
82 cat $T/kvm.sh.out | tee -a "$oldrun/remote-log"
84 rm -f "$oldrun"/*/buildonly
85 kvm-again.sh $oldrun --dryrun --remote --rundir "$rundir" > $T/kvm-again.sh.out 2>&1
87 if test "$ret" -ne 0
89 echo $scriptname: kvm-again.sh failed exit code $? | tee -a "$oldrun/remote-log"
90 cat $T/kvm-again.sh.out | tee -a "$oldrun/remote-log"
94 # Re-use old run.
96 if ! echo $oldrun | grep -q '^/'
101 touch "$oldrun/remote-log"
102 echo $scriptname $args >> "$oldrun/remote-log"
103 kvm-again.sh "$oldrun" "$@" --dryrun --remote --rundir "$rundir" > $T/kvm-again.sh.out 2>&1
105 if test "$ret" -ne 0
107 echo $scriptname: kvm-again.sh failed exit code $? | tee -a "$oldrun/remote-log"
108 cat $T/kvm-again.sh.out | tee -a "$oldrun/remote-log"
111 cp -a "$rundir" "$KVM/res/"
114 echo | tee -a "$oldrun/remote-log"
115 echo " ----" kvm-again.sh output: "(`date`)" | tee -a "$oldrun/remote-log"
116 cat $T/kvm-again.sh.out
117 echo | tee -a "$oldrun/remote-log"
118 echo Remote run directory: $rundir | tee -a "$oldrun/remote-log"
119 echo Local build-side run directory: $oldrun | tee -a "$oldrun/remote-log"
121 # Create the kvm-remote-N.sh scripts in the bin directory.
122 awk < "$rundir"/scenarios -v dest="$T/bin" -v rundir="$rundir" '
125 sub(/\./, "", n);
126 fn = dest "/kvm-remote-" n ".sh"
127 print "kvm-remote-noreap.sh " rundir " &" > fn;
131 print "kvm-test-1-run-batch.sh" scenarios >> fn;
135 chmod +x $T/bin/kvm-remote-*.sh
136 ( cd "`dirname $T`"; tar -chzf $T/binres.tgz "$TD/bin" "$TD/res" )
138 # Check first to avoid the need for cleanup for system-name typos
139 for i in $systems
142 echo $i: $ncpus CPUs " " `date` | tee -a "$oldrun/remote-log"
144 if test "$ret" -ne 0
146 echo System $i unreachable, giving up. | tee -a "$oldrun/remote-log"
147 exit 4 | tee -a "$oldrun/remote-log"
151 # Download and expand the tarball on all systems.
152 for i in $systems
154 echo Downloading tarball to $i `date` | tee -a "$oldrun/remote-log"
155 cat $T/binres.tgz | ssh $i "cd /tmp; tar -xzf -"
157 if test "$ret" -ne 0
159 echo Unable to download $T/binres.tgz to system $i, giving up. | tee -a "$oldrun/remote-log"
160 exit 10 | tee -a "$oldrun/remote-log"
175 ssh $1 "test -f \"$2\""
177 if test "$ret" -eq 255
179 echo " ---" ssh failure to $1 checking for file $2, retry after $sleeptime seconds. `date`
180 elif test "$ret" -eq 0
183 elif test "$ret" -eq 1
185 echo " ---" File \"$2\" not found: ssh $1 test -f \"$2\"
188 echo " ---" Exit code $ret: ssh $1 test -f \"$2\", retry after $sleeptime seconds. `date`
195 # Function to start batches on idle remote $systems
207 for i in $systems
209 if test "$curbatch" -gt "$nbatches"
218 …ir/$ds\"; touch remote.run; PATH=\"$T/bin:$PATH\" nohup kvm-remote-$curbatch.sh > kvm-remote-$curb…
220 if test "$ret" -ne 0
225 echo " ----" System $i Batch `head -n $curbatch < "$rundir"/scenarios | tail -1` `date` 1>&2
232 nbatches="`wc -l "$rundir"/scenarios | awk '{ print $1 }'`"
234 while test "$curbatch" -le "$nbatches"
238 if test -s "$T/startbatches.stderr"
240 cat "$T/startbatches.stderr" | tee -a "$oldrun/remote-log"
242 if test "$curbatch" -le "$nbatches"
250 for i in $systems
256 echo " ---" Collecting results from $i `date`
257 … -czf - kvm-remote-*.sh.out */console.log */kvm-test-1-run*.sh.out */qemu[_-]pid */qemu-retval */q…
260 ( kvm-end-run-stats.sh "$oldrun" "$starttime"; echo $? > $T/exitcode ) | tee -a "$oldrun/remote-log"