Skip to content

Commit f121fbb

Browse files
paulmckrcuFrederic Weisbecker
authored andcommitted
rcutorture: Permit kvm-again.sh to re-use the build directory
This commit adds "inplace" and "inplace-force" values to the kvm-again.sh "--link" argument, which causes the run's output to be placed into the build directory. This could be used to save build time if the machine went down partway into a run, but it can also be used to do a large number of builds, and run the resulting kernels concurrently even if the builds are based on different commits. A later commit will add this latter capability to kvm-series.sh in order to produce large speedups for branch-checking operations. Signed-off-by: Paul E. McKenney <paulmck@kernel.org> Signed-off-by: Frederic Weisbecker <frederic@kernel.org>
1 parent 515a48f commit f121fbb

1 file changed

Lines changed: 40 additions & 16 deletions

File tree

tools/testing/selftests/rcutorture/bin/kvm-again.sh

Lines changed: 40 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ fi
3131
if ! cp "$oldrun/scenarios" $T/scenarios.oldrun
3232
then
3333
# Later on, can reconstitute this from console.log files.
34-
echo Prior run batches file does not exist: $oldrun/batches
34+
echo Prior run scenarios file does not exist: $oldrun/scenarios
3535
exit 1
3636
fi
3737

@@ -68,7 +68,7 @@ usage () {
6868
echo " --datestamp string"
6969
echo " --dryrun"
7070
echo " --duration minutes | <seconds>s | <hours>h | <days>d"
71-
echo " --link hard|soft|copy"
71+
echo " --link hard|soft|copy|inplace|inplace-force"
7272
echo " --remote"
7373
echo " --rundir /new/res/path"
7474
echo "Command line: $scriptname $args"
@@ -121,7 +121,7 @@ do
121121
shift
122122
;;
123123
--link)
124-
checkarg --link "hard|soft|copy" "$#" "$2" 'hard\|soft\|copy' '^--'
124+
checkarg --link "hard|soft|copy|inplace|inplace-force" "$#" "$2" 'hard\|soft\|copy\|inplace\|inplace-force' '^--'
125125
case "$2" in
126126
copy)
127127
arg_link="cp -R"
@@ -132,6 +132,14 @@ do
132132
soft)
133133
arg_link="cp -Rs"
134134
;;
135+
inplace)
136+
arg_link="inplace"
137+
rundir="$oldrun"
138+
;;
139+
inplace-force)
140+
arg_link="inplace-force"
141+
rundir="$oldrun"
142+
;;
135143
esac
136144
shift
137145
;;
@@ -172,21 +180,37 @@ fi
172180

173181
echo ---- Re-run results directory: $rundir
174182

175-
# Copy old run directory tree over and adjust.
176-
mkdir -p "`dirname "$rundir"`"
177-
if ! $arg_link "$oldrun" "$rundir"
178-
then
179-
echo "Cannot copy from $oldrun to $rundir."
180-
usage
181-
fi
182-
rm -f "$rundir"/*/{console.log,console.log.diags,qemu_pid,qemu-pid,qemu-retval,Warnings,kvm-test-1-run.sh.out,kvm-test-1-run-qemu.sh.out,vmlinux} "$rundir"/log
183-
touch "$rundir/log"
184-
echo $scriptname $args | tee -a "$rundir/log"
185-
echo $oldrun > "$rundir/re-run"
186-
if ! test -d "$rundir/../../bin"
183+
if test "$oldrun" != "$rundir"
187184
then
188-
$arg_link "$oldrun/../../bin" "$rundir/../.."
185+
# Copy old run directory tree over and adjust.
186+
mkdir -p "`dirname "$rundir"`"
187+
if ! $arg_link "$oldrun" "$rundir"
188+
then
189+
echo "Cannot copy from $oldrun to $rundir."
190+
usage
191+
fi
192+
rm -f "$rundir"/*/{console.log,console.log.diags,qemu_pid,qemu-pid,qemu-retval,Warnings,kvm-test-1-run.sh.out,kvm-test-1-run-qemu.sh.out,vmlinux} "$rundir"/log
193+
touch "$rundir/log"
194+
echo $scriptname $args | tee -a "$rundir/log"
195+
echo $oldrun > "$rundir/re-run"
196+
if ! test -d "$rundir/../../bin"
197+
then
198+
$arg_link "$oldrun/../../bin" "$rundir/../.."
199+
fi
200+
else
201+
# Check for a run having already happened.
202+
find "$rundir" -name console.log -print > $T/oldrun-console.log
203+
if test -s $T/oldrun-console.log
204+
then
205+
echo Run already took place in $rundir
206+
if test "$arg_link" = inplace
207+
then
208+
usage
209+
fi
210+
fi
189211
fi
212+
213+
# Find runs to be done based on their qemu-cmd files.
190214
for i in $rundir/*/qemu-cmd
191215
do
192216
cp "$i" $T

0 commit comments

Comments
 (0)