All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrew Jones <drjones@redhat.com>
To: "Radim Krčmář" <rkrcmar@redhat.com>
Cc: kvm@vger.kernel.org, Paolo Bonzini <pbonzini@redhat.com>
Subject: Re: [PATCH kvm-unit-tests v2 11/12] wrappers: consolidate skip output
Date: Thu, 17 Dec 2015 13:59:52 -0600	[thread overview]
Message-ID: <20151217195952.GI14168@hawk.localdomain> (raw)
In-Reply-To: <1450374823-7648-12-git-send-email-rkrcmar@redhat.com>

On Thu, Dec 17, 2015 at 06:53:42PM +0100, Radim Krčmář wrote:
> Ugly helpers will get us yellow "SKIP" to stdout and 77 on exit.
> 
> Signed-off-by: Radim Krčmář <rkrcmar@redhat.com>
> ---
>  v2: new
>  
>  scripts/mkstandalone.sh |  6 +++---
>  scripts/run.bash        | 25 ++++++++++++++++---------
>  2 files changed, 19 insertions(+), 12 deletions(-)
> 
> diff --git a/scripts/mkstandalone.sh b/scripts/mkstandalone.sh
> index c37f694398b8..adb11abf650c 100755
> --- a/scripts/mkstandalone.sh
> +++ b/scripts/mkstandalone.sh
> @@ -66,7 +66,7 @@ cat scripts/run.bash >> $standalone
>  
>  if [ ! -f $kernel ]; then
>  	cat <<EOF >> $standalone
> -echo "skip $testname (test kernel not present)" 1>&2
> +echo "\$(SKIP) $testname (test kernel not present)"
>  exit 1
>  EOF
>  else
> @@ -89,8 +89,8 @@ echo \$qemu $cmdline -smp $smp $opts
>  
>  cmdline="\`echo '$cmdline' | sed s%$kernel%_NO_FILE_4Uhere_%\`"
>  if \$qemu \$cmdline 2>&1 | grep 'No accelerator found' >/dev/null; then
> -	echo "skip $testname (QEMU doesn't support KVM)"
> -	exit 1
> +	echo "\$(SKIP) $testname (QEMU doesn't support KVM)"
> +	exit \$EXIT_SKIP
>  fi
>  
>  __run()
> diff --git a/scripts/run.bash b/scripts/run.bash
> index d3e8d37d315d..06a13b9aaf1a 100644
> --- a/scripts/run.bash
> +++ b/scripts/run.bash
> @@ -1,3 +1,10 @@
> +PASS() { echo -ne "\e[32mPASS\e[0m"; }
> +SKIP() { echo -ne "\e[33mSKIP\e[0m"; }
> +FAIL() { echo -ne "\e[31mFAIL\e[0m"; }

I definitely put these in functions.bash, but then I'd put run() in
functions.bash too, as I said earlier.

> +
> +EXIT_SUCCESS=0
> +EXIT_SKIP=77
> +
>  function run()
>  {
>      local testname="$1"
> @@ -10,22 +17,22 @@ function run()
>      local accel="$8"
>  
>      if [ -z "$testname" ]; then
> -        return
> +        return $EXIT_SKIP
>      fi
>  
>      if [ -n "$only_group" ] && ! grep -q "$only_group" <<<$groups; then
> -        return
> +        return $EXIT_SKIP
>      fi
>  
>      if [ -n "$arch" ] && [ "$arch" != "$ARCH" ]; then
> -        echo "skip $1 ($arch only)"
> -        return
> +        echo "`SKIP` $testname ($arch only)"
> +        return $EXIT_SKIP
>      fi
>  
>      __eval_log "$check" || {
>          __eval_log 'echo "skipped $testname (check returned $?)"'
> -        echo "skip $testname (failed check)"
> -        return
> +        echo "`SKIP` $testname (failed check)"
> +        return $EXIT_SKIP
>      }
>  
>      cmdline="TESTNAME=$testname ACCEL=$accel __run $kernel -smp $smp $opts"
> @@ -41,9 +48,9 @@ function run()
>      ret=$(($? >> 1))
>  
>      case $ret in
> -    0)  echo -ne "\e[32mPASS\e[0m" ;;
> -    77) echo -ne "\e[33mSKIP\e[0m" ;;
> -    *)  echo -ne "\e[31mFAIL\e[0m"
> +    $EXIT_SUCCESS) PASS ;;
> +    $EXIT_SKIP)    SKIP ;;
> +    *)             FAIL
>      esac
>  
>      echo -n " $testname"
> -- 
> 2.6.4

Otherwise
Reviewed-by: Andrew Jones <drjones@redhat.com>
> 
> --
> To unsubscribe from this list: send the line "unsubscribe kvm" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

  reply	other threads:[~2015-12-17 19:59 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-17 17:53 [PATCH kvm-unit-tests v2 00/12] Improve the output of test runners Radim Krčmář
2015-12-17 17:53 ` [PATCH kvm-unit-tests v2 01/12] run_tests: move run() to scripts/ Radim Krčmář
2015-12-17 18:45   ` Andrew Jones
2015-12-18 10:42     ` Radim Krčmář
2015-12-18 18:52       ` Andrew Jones
2015-12-17 17:53 ` [PATCH kvm-unit-tests v2 02/12] run_tests: prepare for changes in scripts/mkstandalone Radim Krčmář
2015-12-17 18:53   ` Andrew Jones
2015-12-18 10:49     ` Radim Krčmář
2015-12-17 17:53 ` [PATCH kvm-unit-tests v2 03/12] scripts/mkstandalone: use common run function Radim Krčmář
2015-12-17 19:09   ` Andrew Jones
2015-12-18 11:02     ` Radim Krčmář
2015-12-17 17:53 ` [PATCH kvm-unit-tests v2 04/12] scripts/mkstandalone: improve exit paths Radim Krčmář
2015-12-17 19:15   ` Andrew Jones
2015-12-17 17:53 ` [PATCH kvm-unit-tests v2 05/12] lib/report: allow test skipping Radim Krčmář
2015-12-17 19:30   ` Andrew Jones
2015-12-17 19:37     ` Andrew Jones
2015-12-18 11:18       ` Radim Krčmář
2015-12-18 18:55         ` Andrew Jones
2015-12-17 17:53 ` [PATCH kvm-unit-tests v2 06/12] x86/*: report skipped tests Radim Krčmář
2015-12-17 17:53 ` [PATCH kvm-unit-tests v2 07/12] x86/pmu: expect failure with nmi_watchdog Radim Krčmář
2015-12-17 17:53 ` [PATCH kvm-unit-tests v2 08/12] scripts/run: generalize check Radim Krčmář
2015-12-17 17:53 ` [PATCH kvm-unit-tests v2 09/12] x86/hyperv_synic: check for support before testing Radim Krčmář
2015-12-17 19:42   ` Andrew Jones
2015-12-18 12:13     ` Radim Krčmář
2015-12-17 17:53 ` [PATCH kvm-unit-tests v2 10/12] run_tests: print summary Radim Krčmář
2015-12-17 19:55   ` Andrew Jones
2015-12-18 12:24     ` Radim Krčmář
2015-12-17 20:06   ` Andrew Jones
2015-12-18 12:25     ` Radim Krčmář
2015-12-17 17:53 ` [PATCH kvm-unit-tests v2 11/12] wrappers: consolidate skip output Radim Krčmář
2015-12-17 19:59   ` Andrew Jones [this message]
2015-12-17 17:53 ` [PATCH kvm-unit-tests v2 12/12] run_tests: suppress stderr Radim Krčmář
2015-12-17 20:01   ` Andrew Jones
2015-12-17 20:04 ` [PATCH kvm-unit-tests v2 00/12] Improve the output of test runners Andrew Jones
2015-12-18 12:38   ` Radim Krčmář
2015-12-18 18:57     ` Andrew Jones

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=20151217195952.GI14168@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 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.