Re: [PATCH kvm-unit-tests v2 10/12] run_tests: print summary

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

 



On Thu, Dec 17, 2015 at 06:53:41PM +0100, Radim Krčmář wrote:
> Might be interesting and hopefully won't break too many scripts.
> 
> Signed-off-by: Radim Krčmář <rkrcmar@xxxxxxxxxx>
> ---
>  v2:
>  - don't print "0 unexpected failures" in run_tests' summary. [Drew]
>    (This could have been done in lib/report, but I'm not sure why we want
>     to always print it in the summary, so I've kept it there.)
>  - use $testname
>  - don't buffer the output (a serious bug in v1)
>  - worse performance (reads the output of all tests)
>  
>  run_tests.sh            | 1 +
>  scripts/mkstandalone.sh | 2 ++
>  scripts/run.bash        | 5 ++++-
>  3 files changed, 7 insertions(+), 1 deletion(-)
> 
> diff --git a/run_tests.sh b/run_tests.sh
> index e09d410beaa4..62c106a0b693 100755
> --- a/run_tests.sh
> +++ b/run_tests.sh
> @@ -30,6 +30,7 @@ EOF
>  
>  __run() { ./$TEST_DIR-run "${@}"; }
>  __eval_log() { eval "${@}" >> test.log; }
> +__echo_last_log() { cat test.log; } # XXX: ignores the 'last' bit
>  
>  echo > test.log
>  
> diff --git a/scripts/mkstandalone.sh b/scripts/mkstandalone.sh
> index 778383077769..c37f694398b8 100755
> --- a/scripts/mkstandalone.sh
> +++ b/scripts/mkstandalone.sh
> @@ -104,7 +104,9 @@ __run()
>  	\$qemu \$cmdline -smp $smp $opts
>  }
>  
> +# log goes to stdout and nothing is remembered
>  __eval_log() { eval "\${@}"; }
> +__echo_last_log() { echo; }
>  
>  run `escape "${@}"`
>  exit \$?
> diff --git a/scripts/run.bash b/scripts/run.bash
> index f532cb9e8b1c..d3e8d37d315d 100644
> --- a/scripts/run.bash
> +++ b/scripts/run.bash
> @@ -46,7 +46,10 @@ function run()
>      *)  echo -ne "\e[31mFAIL\e[0m"
>      esac
>  
> -    echo " $1"
> +    echo -n " $testname"
> +
> +    __echo_last_log | sed 'x;$s/^SUMMARY: //;ta;$s/.*//p;d;
> +                             :a s/, 0 unexpected failures//;s/^/ (/;s/$/)/'

This sed is way beyond my skillz. I would have just done the following
at the expense of an extra pipe :-)

tac test.log | grep -m1 '^SUMMARY:' | sed 's/.*: \(.*\),.*/\1/'

>  
>      return $ret
>  }
> -- 
> 2.6.4
> 
> --
> 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
--
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