diff options
author | Paul E. McKenney <paulmck@kernel.org> | 2021-02-22 14:12:58 -0800 |
---|---|---|
committer | Paul E. McKenney <paulmck@kernel.org> | 2021-03-22 08:29:19 -0700 |
commit | 00505165cf4484dffc488259d59689845ba77939 (patch) | |
tree | dc07466c2ee92d0c9daa69b9cb4763ca5eb6ca99 /tools/testing/selftests/rcutorture/bin/kvm-transform.sh | |
parent | 7cf86c0b6279d9d12bb697e58c7e8b2184a8f3db (diff) |
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>
Diffstat (limited to 'tools/testing/selftests/rcutorture/bin/kvm-transform.sh')
-rwxr-xr-x | tools/testing/selftests/rcutorture/bin/kvm-transform.sh | 29 |
1 files changed, 23 insertions, 6 deletions
diff --git a/tools/testing/selftests/rcutorture/bin/kvm-transform.sh b/tools/testing/selftests/rcutorture/bin/kvm-transform.sh index c45a953ef393..162dddbcde00 100755 --- a/tools/testing/selftests/rcutorture/bin/kvm-transform.sh +++ b/tools/testing/selftests/rcutorture/bin/kvm-transform.sh @@ -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; } |