From 676251f119c4dc2f6e76579313d186135f9eba63 Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Thu, 10 Sep 2020 14:41:25 +0100 Subject: [PATCH] Add -v/--verbose option. --- qemu-sanity-check.in | 13 +++++++++++-- qemu-sanity-check.pod.in | 6 ++++++ 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/qemu-sanity-check.in b/qemu-sanity-check.in index e1abafd..72257a8 100644 --- a/qemu-sanity-check.in +++ b/qemu-sanity-check.in @@ -24,6 +24,7 @@ initrd="@libdir@/qemu-sanity-check/initrd" arch="$(uname -m)" canonical_arch="$(uname -m | sed 's/i[456]86/i386/')" +verbose=no timeout=10m accel=kvm:tcg @@ -47,12 +48,13 @@ function usage { echo " -m|--machine=machine Set machine type" echo " -q|--qemu=qemu Set location of qemu/KVM binary" echo " -t|--timeout=timeout Set the timeout" + echo " -v|--verbose Verbose output" echo " -V|--version Display version and exit" exit 0 } TEMP=$(getopt \ - -o i:k:m:q:t:V \ + -o i:k:m:q:t:vV \ --long help \ --long accel: \ --long initrd: \ @@ -60,6 +62,7 @@ TEMP=$(getopt \ --long machine: \ --long qemu: \ --long timeout: \ + --long verbose \ --long version \ -n 'qemu-sanity-check' -- "$@") if [ $? != 0 ]; then exit 2; fi @@ -94,6 +97,10 @@ while true; do timeout="$2" shift 2 ;; + -v|--verbose) + verbose=yes + shift + ;; -V|--version) echo "@PACKAGE_NAME@ @PACKAGE_VERSION@" exit 0 @@ -170,7 +177,9 @@ argv[$((i++))]="$initrd" argv[$((i++))]="-append" argv[$((i++))]="console=ttyS0 oops=panic panic=-1" -#echo "${argv[@]}" +if [ "$verbose" = "yes" ]; then + echo "${argv[@]}" +fi # Run the command. timeout "$timeout" "${argv[@]}" diff --git a/qemu-sanity-check.pod.in b/qemu-sanity-check.pod.in index 1559093..8bf1d4b 100644 --- a/qemu-sanity-check.pod.in +++ b/qemu-sanity-check.pod.in @@ -115,6 +115,12 @@ Specify a timeout instead of the default which is C<10m> (10 minutes). The syntax for the C is described in full in the man page for L. +=item B<-v> + +=item B<--verbose> + +Print extra debugging information. + =item B<-V> =item B<--version> -- 1.8.3.1