From mboxrd@z Thu Jan 1 00:00:00 1970 From: Paolo Bonzini Subject: Re: [kvm-unit-tests PATCH 5/6] runtime: move getopts to run_tests.sh Date: Tue, 26 Jan 2016 12:06:46 +0100 Message-ID: <56A75346.4000003@redhat.com> References: <1453474709-10679-1-git-send-email-drjones@redhat.com> <1453474709-10679-6-git-send-email-drjones@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Cc: rkrcmar@redhat.com To: Andrew Jones , kvm@vger.kernel.org Return-path: Received: from mx1.redhat.com ([209.132.183.28]:44628 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933434AbcAZLGu (ORCPT ); Tue, 26 Jan 2016 06:06:50 -0500 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (Postfix) with ESMTPS id 0EADE5D for ; Tue, 26 Jan 2016 11:06:50 +0000 (UTC) In-Reply-To: <1453474709-10679-6-git-send-email-drjones@redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: 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 > --- > 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 < + > +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 < - > -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? Paolo