Re: [kvm-unit-tests PATCH 5/6] runtime: move getopts to run_tests.sh

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




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@xxxxxxxxxx>
> ---
>  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?

Paolo
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux