Skip to content

Commit 1f5d092

Browse files
committed
torture: Make "--dryrun script" output self-sufficient
The scripts produced by kvm.sh's "--dryrun script" argument were intended for debugging rather than to run, but it is easier to debug if the script output matches exactly what is run. This commit therefore makes this script runnable. Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com> Reviewed-by: Josh Triplett <josh@joshtriplett.org>
1 parent b3b8a4d commit 1f5d092

1 file changed

Lines changed: 27 additions & 33 deletions

File tree

  • tools/testing/selftests/rcutorture/bin

‎tools/testing/selftests/rcutorture/bin/kvm.sh‎

Lines changed: 27 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -175,30 +175,6 @@ then
175175
resdir=$KVM/res
176176
fi
177177

178-
if test "$dryrun" = ""
179-
then
180-
if ! test -e $resdir
181-
then
182-
mkdir -p "$resdir" || :
183-
fi
184-
mkdir $resdir/$ds
185-
186-
# Be noisy only if running the script.
187-
echo Results directory: $resdir/$ds
188-
echo $scriptname $args
189-
190-
touch $resdir/$ds/log
191-
echo $scriptname $args >> $resdir/$ds/log
192-
echo ${TORTURE_SUITE} > $resdir/$ds/TORTURE_SUITE
193-
194-
pwd > $resdir/$ds/testid.txt
195-
if test -d .git
196-
then
197-
git status >> $resdir/$ds/testid.txt
198-
git rev-parse HEAD >> $resdir/$ds/testid.txt
199-
fi
200-
fi
201-
202178
# Create a file of test-name/#cpus pairs, sorted by decreasing #cpus.
203179
touch $T/cfgcpu
204180
for CF in $configs
@@ -267,6 +243,22 @@ END {
267243
cat << ___EOF___ > $T/script
268244
TORTURE_SUITE="$TORTURE_SUITE"; export TORTURE_SUITE
269245
TORTURE_DEFCONFIG="$TORTURE_DEFCONFIG"; export TORTURE_DEFCONFIG
246+
if ! test -e $resdir
247+
then
248+
mkdir -p "$resdir" || :
249+
fi
250+
mkdir $resdir/$ds
251+
echo Results directory: $resdir/$ds
252+
echo $scriptname $args
253+
touch $resdir/$ds/log
254+
echo $scriptname $args >> $resdir/$ds/log
255+
echo ${TORTURE_SUITE} > $resdir/$ds/TORTURE_SUITE
256+
pwd > $resdir/$ds/testid.txt
257+
if test -d .git
258+
then
259+
git status >> $resdir/$ds/testid.txt
260+
git rev-parse HEAD >> $resdir/$ds/testid.txt
261+
fi
270262
___EOF___
271263
awk < $T/cfgcpu.pack \
272264
-v CONFIGDIR="$CONFIGFRAG/$kversion/" \
@@ -366,6 +358,17 @@ END {
366358
dump(first, i);
367359
}' >> $T/script
368360

361+
cat << ___EOF___ >> $T/script
362+
echo
363+
echo
364+
echo " --- `date` Test summary:"
365+
echo Results directory: $resdir/$ds
366+
if test -z "$TORTURE_BUILDONLY"
367+
then
368+
kvm-recheck.sh $resdir/$ds
369+
fi
370+
___EOF___
371+
369372
if test "$dryrun" = script
370373
then
371374
# Dump out the script, but define the environment variables that
@@ -397,12 +400,3 @@ else
397400
fi
398401

399402
# Tracing: trace_event=rcu:rcu_grace_period,rcu:rcu_future_grace_period,rcu:rcu_grace_period_init,rcu:rcu_nocb_wake,rcu:rcu_preempt_task,rcu:rcu_unlock_preempted_task,rcu:rcu_quiescent_state_report,rcu:rcu_fqs,rcu:rcu_callback,rcu:rcu_kfree_callback,rcu:rcu_batch_start,rcu:rcu_invoke_callback,rcu:rcu_invoke_kfree_callback,rcu:rcu_batch_end,rcu:rcu_torture_read,rcu:rcu_barrier
400-
401-
echo
402-
echo
403-
echo " --- `date` Test summary:"
404-
echo Results directory: $resdir/$ds
405-
if test -n "$TORTURE_BUILDONLY"
406-
then
407-
kvm-recheck.sh $resdir/$ds
408-
fi

0 commit comments

Comments
 (0)