mirror of https://gitee.com/openkylin/linux.git
torture: Add --duration argument to kvm-again.sh
This commit adds a --duration argument to kvm-again.sh to allow the user to override the --duration specified for the original kvm.sh run. Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
This commit is contained in:
parent
7cf86c0b62
commit
00505165cf
|
@ -52,6 +52,7 @@ PATH=${KVM}/bin:$PATH; export PATH
|
|||
. functions.sh
|
||||
|
||||
dryrun=
|
||||
dur=
|
||||
default_link="cp -R"
|
||||
rundir="`pwd`/tools/testing/selftests/rcutorture/res/`date +%Y.%m.%d-%H.%M.%S-again`"
|
||||
|
||||
|
@ -61,6 +62,7 @@ starttime="`get_starttime`"
|
|||
usage () {
|
||||
echo "Usage: $scriptname $oldrun [ arguments ]:"
|
||||
echo " --dryrun"
|
||||
echo " --duration minutes | <seconds>s | <hours>h | <days>d"
|
||||
echo " --link hard|soft|copy"
|
||||
echo " --remote"
|
||||
echo " --rundir /new/res/path"
|
||||
|
@ -73,6 +75,23 @@ do
|
|||
--dryrun)
|
||||
dryrun=1
|
||||
;;
|
||||
--duration)
|
||||
checkarg --duration "(minutes)" $# "$2" '^[0-9][0-9]*\(s\|m\|h\|d\|\)$' '^error'
|
||||
mult=60
|
||||
if echo "$2" | grep -q 's$'
|
||||
then
|
||||
mult=1
|
||||
elif echo "$2" | grep -q 'h$'
|
||||
then
|
||||
mult=3600
|
||||
elif echo "$2" | grep -q 'd$'
|
||||
then
|
||||
mult=86400
|
||||
fi
|
||||
ts=`echo $2 | sed -e 's/[smhd]$//'`
|
||||
dur=$(($ts*mult))
|
||||
shift
|
||||
;;
|
||||
--link)
|
||||
checkarg --link "hard|soft|copy" "$#" "$2" 'hard\|soft\|copy' '^--'
|
||||
case "$2" in
|
||||
|
@ -134,7 +153,11 @@ do
|
|||
cp "$i" $T
|
||||
qemu_cmd_dir="`dirname "$i"`"
|
||||
kernel_dir="`echo $qemu_cmd_dir | sed -e 's/\.[0-9]\+$//'`"
|
||||
kvm-transform.sh $kernel_dir/bzImage $qemu_cmd_dir/console.log < $T/qemu-cmd > $i
|
||||
kvm-transform.sh $kernel_dir/bzImage $qemu_cmd_dir/console.log $dur < $T/qemu-cmd > $i
|
||||
if test -n "$dur"
|
||||
then
|
||||
echo "# seconds=$dur" >> $i
|
||||
fi
|
||||
echo "# TORTURE_KCONFIG_GDB_ARG=''" >> $i
|
||||
done
|
||||
grep -v '^#' $T/batches.oldrun | awk '
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
#
|
||||
# Transform a qemu-cmd file to allow reuse.
|
||||
#
|
||||
# Usage: kvm-transform.sh bzImage console.log < qemu-cmd-in > qemu-cmd-out
|
||||
# Usage: kvm-transform.sh bzImage console.log [ seconds ] < qemu-cmd-in > qemu-cmd-out
|
||||
#
|
||||
# bzImage: Kernel and initrd from the same prior kvm.sh run.
|
||||
# console.log: File into which to place console output.
|
||||
|
@ -29,20 +29,37 @@ then
|
|||
echo "Need console log file name."
|
||||
exit 1
|
||||
fi
|
||||
seconds=$3
|
||||
if test -n "$seconds" && echo $seconds | grep -q '[^0-9]'
|
||||
then
|
||||
echo "Invalid duration, should be numeric in seconds: '$seconds'"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
awk -v image="$image" -v consolelog="$consolelog" -v seconds="$seconds" '
|
||||
/^#/ {
|
||||
print $0;
|
||||
next;
|
||||
}
|
||||
|
||||
awk -v image="$image" -v consolelog="$consolelog" '
|
||||
{
|
||||
line = "";
|
||||
for (i = 1; i <= NF; i++) {
|
||||
if (line == "")
|
||||
if ("" seconds != "" && $i ~ /\.shutdown_secs=[0-9]*$/) {
|
||||
sub(/[0-9]*$/, seconds, $i);
|
||||
if (line == "")
|
||||
line = $i;
|
||||
else
|
||||
line = line " " $i;
|
||||
} else if (line == "") {
|
||||
line = $i;
|
||||
else
|
||||
} else {
|
||||
line = line " " $i;
|
||||
}
|
||||
if ($i == "-serial") {
|
||||
i++;
|
||||
line = line " file:" consolelog;
|
||||
}
|
||||
if ($i == "-kernel") {
|
||||
} else if ($i == "-kernel") {
|
||||
i++;
|
||||
line = line " " image;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue