kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andrew Jones <drjones@redhat.com>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: kvm@vger.kernel.org, rkrcmar@redhat.com
Subject: Re: [kvm-unit-tests PATCH 5/6] runtime: move getopts to run_tests.sh
Date: Tue, 26 Jan 2016 13:24:09 +0100	[thread overview]
Message-ID: <20160126122409.GC10697@hawk.localdomain> (raw)
In-Reply-To: <56A75346.4000003@redhat.com>

On Tue, Jan 26, 2016 at 12:06:46PM +0100, Paolo Bonzini wrote:
> 
> 
> On 22/01/2016 15:58, Andrew Jones wrote:
> > We don't need to check options in standalone tests, kick the
> > loop and usage() function out to run_tests.sh
> > 
> > Signed-off-by: Andrew Jones <drjones@redhat.com>
> > ---
> >  run_tests.sh         | 36 ++++++++++++++++++++++++++++++++++++
> >  scripts/runtime.bash | 37 +------------------------------------
> >  2 files changed, 37 insertions(+), 36 deletions(-)
> > 
> > diff --git a/run_tests.sh b/run_tests.sh
> > index 2312e031482a4..558b8e7431d8e 100755
> > --- a/run_tests.sh
> > +++ b/run_tests.sh
> > @@ -1,5 +1,7 @@
> >  #!/bin/bash
> >  
> > +verbose="no"
> > +
> >  if [ ! -f config.mak ]; then
> >      echo "run ./configure && make first. See ./configure -h"
> >      exit
> > @@ -7,9 +9,43 @@ fi
> >  source config.mak
> >  source scripts/functions.bash
> >  
> > +function usage()
> > +{
> > +cat <<EOF
> > +
> > +Usage: $0 [-g group] [-h] [-v]
> > +
> > +    -g: Only execute tests in the given group
> > +    -h: Output this help text
> > +    -v: Enables verbose mode
> > +
> > +Set the environment variable QEMU=/path/to/qemu-system-ARCH to
> > +specify the appropriate qemu binary for ARCH-run.
> > +
> > +EOF
> > +}
> > +
> >  RUNTIME_arch_run="./$TEST_DIR/run"
> >  source scripts/runtime.bash
> >  
> > +while getopts "g:hv" opt; do
> > +    case $opt in
> > +        g)
> > +            only_group=$OPTARG
> > +            ;;
> > +        h)
> > +            usage
> > +            exit
> > +            ;;
> > +        v)
> > +            verbose="yes"
> > +            ;;
> > +        *)
> > +            exit
> > +            ;;
> > +    esac
> > +done
> > +
> >  RUNTIME_arch_run="./$TEST_DIR/run >> test.log"
> >  config=$TEST_DIR/unittests.cfg
> >  echo > test.log
> > diff --git a/scripts/runtime.bash b/scripts/runtime.bash
> > index fc878f99c977f..63d1b9653007b 100644
> > --- a/scripts/runtime.bash
> > +++ b/scripts/runtime.bash
> > @@ -1,7 +1,6 @@
> >  : "${RUNTIME_arch_run?}"
> >  
> >  qemu=${QEMU:-qemu-system-$ARCH}
> > -verbose=0
> >  
> >  function run()
> >  {
> > @@ -40,7 +39,7 @@ function run()
> >      done
> >  
> >      cmdline="TESTNAME=$testname ACCEL=$accel $RUNTIME_arch_run $kernel -smp $smp $opts"
> > -    if [ $verbose != 0 ]; then
> > +    if [ "$verbose" = "yes" ]; then
> >          echo $cmdline
> >      fi
> >  
> > @@ -58,40 +57,6 @@ function run()
> >      return $ret
> >  }
> >  
> > -function usage()
> > -{
> > -cat <<EOF
> > -
> > -Usage: $0 [-g group] [-h] [-v]
> > -
> > -    -g: Only execute tests in the given group
> > -    -h: Output this help text
> > -    -v: Enables verbose mode
> > -
> > -Set the environment variable QEMU=/path/to/qemu-system-ARCH to
> > -specify the appropriate qemu binary for ARCH-run.
> > -
> > -EOF
> > -}
> > -
> > -while getopts "g:hv" opt; do
> > -    case $opt in
> > -        g)
> > -            only_group=$OPTARG
> > -            ;;
> > -        h)
> > -            usage
> > -            exit
> > -            ;;
> > -        v)
> > -            verbose=1
> > -            ;;
> > -        *)
> > -            exit
> > -            ;;
> > -    esac
> > -done
> > -
> >  MAX_SMP=$(getconf _NPROCESSORS_CONF)
> >  #
> >  # Probe for MAX_SMP, in case it's less than the number of host cpus.
> > 
> 
> Should standalone tests always set verbose=1?

atm, no. standalone tests already always echo the command line, which
is currently the only thing verbose does. Actually, turning it on would
result in a redundant echo. So, if we ever expand the scope of verbose,
then we may need to revisit this some day, but I don't see much need now.

Thanks,
drew

  reply	other threads:[~2016-01-26 12:24 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-22 14:58 [kvm-unit-tests PATCH 0/6] run_tests fixes and new functionality prep Andrew Jones
2016-01-22 14:58 ` [kvm-unit-tests PATCH 1/6] run_tests.sh: a few rewrite fixups Andrew Jones
2016-01-22 14:58 ` [kvm-unit-tests PATCH 2/6] mkstandalone: fix generation for arm Andrew Jones
2016-01-26 11:01   ` Paolo Bonzini
2016-01-26 12:21     ` Andrew Jones
2016-01-22 14:58 ` [kvm-unit-tests PATCH 3/6] arch-run: DRYRUN is no longer needed, kill it Andrew Jones
2016-01-22 14:58 ` [kvm-unit-tests PATCH 4/6] arm/run: allow tests to run in AArch32 mode Andrew Jones
2016-01-22 14:58 ` [kvm-unit-tests PATCH 5/6] runtime: move getopts to run_tests.sh Andrew Jones
2016-01-26 11:06   ` Paolo Bonzini
2016-01-26 12:24     ` Andrew Jones [this message]
2016-01-22 14:58 ` [kvm-unit-tests PATCH 6/6] runtime: make the MAX_SMP loop a function Andrew Jones
2016-01-26 11:08   ` Paolo Bonzini
2016-01-26 12:28     ` Andrew Jones
2016-01-26 12:38       ` Paolo Bonzini
2016-01-22 15:29 ` [kvm-unit-tests PATCH 0/6] run_tests fixes and new functionality prep Radim Krčmář
2016-01-26 11:09   ` Paolo Bonzini

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160126122409.GC10697@hawk.localdomain \
    --to=drjones@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=pbonzini@redhat.com \
    --cc=rkrcmar@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).