All of lore.kernel.org
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: Chris J Arges <chris.j.arges@canonical.com>, kvm@vger.kernel.org
Subject: Re: [PATCH 1/2 v3] add check parameter to run_tests configuration
Date: Wed, 27 Aug 2014 16:52:15 +0200	[thread overview]
Message-ID: <53FDF09F.4060007@redhat.com> (raw)
In-Reply-To: <1409150751-22763-1-git-send-email-chris.j.arges@canonical.com>

Il 27/08/2014 16:45, Chris J Arges ha scritto:
> In unittests.cfg one can add a line like the following:
> check = /proc/sys/kernel/nmi_watchdog=0 /proc/sys/kernel/ostype=Linux
> 
> run_tests.sh will now check for those values (if defined) and only run
> the test if all conditions are true.
> 
> Signed-off-by: Chris J Arges <chris.j.arges@canonical.com>
> ---
>  run_tests.sh | 21 +++++++++++++++++++--
>  1 file changed, 19 insertions(+), 2 deletions(-)
> 
> diff --git a/run_tests.sh b/run_tests.sh
> index 4758573..e48f1db 100755
> --- a/run_tests.sh
> +++ b/run_tests.sh
> @@ -18,6 +18,7 @@ function run()
>      local kernel="$4"
>      local opts="$5"
>      local arch="$6"
> +    local check="$7"
>  
>      if [ -z "$testname" ]; then
>          return
> @@ -32,6 +33,18 @@ function run()
>          return
>      fi
>  
> +    # check a file for a particular value before running a test
> +    # the check line can contain multiple files to check separated by a space
> +    # but each check parameter needs to be of the form <path>=<value>
> +    for check_param in ${check[@]}; do
> +        path=${check_param%%=*}
> +        value=${check_param#*=}
> +        if [ "$path" ] && [ "$(cat $path)" != "$value" ]; then
> +            echo "skip $1 ($path not equal to $value)"
> +            return
> +        fi
> +    done
> +
>      cmdline="./$TEST_DIR-run $kernel -smp $smp $opts"
>      if [ $verbose != 0 ]; then
>          echo $cmdline
> @@ -57,18 +70,20 @@ function run_all()
>      local opts
>      local groups
>      local arch
> +    local check
>  
>      exec {config_fd}<$config
>  
>      while read -u $config_fd line; do
>          if [[ "$line" =~ ^\[(.*)\]$ ]]; then
> -            run "$testname" "$groups" "$smp" "$kernel" "$opts" "$arch"
> +            run "$testname" "$groups" "$smp" "$kernel" "$opts" "$arch" "$check"
>              testname=${BASH_REMATCH[1]}
>              smp=1
>              kernel=""
>              opts=""
>              groups=""
>              arch=""
> +            check=""
>          elif [[ $line =~ ^file\ *=\ *(.*)$ ]]; then
>              kernel=$TEST_DIR/${BASH_REMATCH[1]}
>          elif [[ $line =~ ^smp\ *=\ *(.*)$ ]]; then
> @@ -79,10 +94,12 @@ function run_all()
>              groups=${BASH_REMATCH[1]}
>          elif [[ $line =~ ^arch\ *=\ *(.*)$ ]]; then
>              arch=${BASH_REMATCH[1]}
> +        elif [[ $line =~ ^check\ *=\ *(.*)$ ]]; then
> +            check=${BASH_REMATCH[1]}
>          fi
>      done
>  
> -    run "$testname" "$groups" "$smp" "$kernel" "$opts" "$arch"
> +    run "$testname" "$groups" "$smp" "$kernel" "$opts" "$arch" "$check"
>  
>      exec {config_fd}<&-
>  }
> 

Thanks, looks good.  Are there more failures?

Paolo

  reply	other threads:[~2014-08-27 14:52 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-26 18:29 [PATCH 0/2] kvm-unit-tests: add check parameter to run_tests configuration Chris J Arges
2014-08-26 18:29 ` [PATCH 1/2] " Chris J Arges
2014-08-27 13:29   ` Paolo Bonzini
2014-08-27 14:42     ` [PATCH 1/2 v2] " Chris J Arges
2014-08-27 14:45     ` [PATCH 1/2 v3] " Chris J Arges
2014-08-27 14:52       ` Paolo Bonzini [this message]
2014-08-27 21:24         ` kvm-unit-test failures (was: [PATCH 1/2 v3] add check parameter to run_tests configuration) Chris J Arges
2014-08-27 22:05           ` Paolo Bonzini
2014-08-29 17:36             ` kvm-unit-test failures Chris J Arges
2014-08-29 21:05               ` Chris J Arges
2014-08-31 16:05                 ` Paolo Bonzini
2014-09-02 19:57                   ` Chris J Arges
2014-09-03 14:47                     ` Paolo Bonzini
2014-09-03 15:21                       ` Chris J Arges
2014-09-03 14:59                     ` Paolo Bonzini
2014-09-03 16:23                       ` Chris J Arges
2014-09-03 17:52                         ` Paolo Bonzini
2014-09-03 18:25                           ` Chris J Arges
     [not found]                             ` <54083688.6000201@redhat.com>
2014-09-04 11:33                               ` Paolo Bonzini
2014-09-04 12:24                                 ` Wanpeng Li
2014-09-04 13:11                                   ` Paolo Bonzini
2014-08-29 21:08               ` Paolo Bonzini
2014-08-29 21:18                 ` Chris J Arges
2014-08-26 18:29 ` [PATCH 2/2] x86/unittests.cfg: the pmu testcase requires that nmi_watchdog is disabled Chris J Arges
2014-08-27 13:29   ` 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=53FDF09F.4060007@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=chris.j.arges@canonical.com \
    --cc=kvm@vger.kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.