All of lore.kernel.org
 help / color / mirror / Atom feed
From: NeilBrown <neilb@suse.de>
To: Jes.Sorensen@redhat.com
Cc: dledford@redhat.com, linux-raid@vger.kernel.org
Subject: Re: [PATCH 1/4] Add support for saving log files in test script
Date: Mon, 28 May 2012 10:54:55 +1000	[thread overview]
Message-ID: <20120528105455.5d4a1211@notabene.brown> (raw)
In-Reply-To: <1337959448-5299-2-git-send-email-Jes.Sorensen@redhat.com>

[-- Attachment #1: Type: text/plain, Size: 3009 bytes --]

On Fri, 25 May 2012 17:24:05 +0200 Jes.Sorensen@redhat.com wrote:

> From: Jes Sorensen <Jes.Sorensen@redhat.com>
> 
> --logdir= specifies where to save, if different from default, and
> --save-logs tells test to save all log files.
> 
> Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
> ---
>  test |   42 ++++++++++++++++++++++++++++++++++++------
>  1 files changed, 36 insertions(+), 6 deletions(-)
> 
> diff --git a/test b/test
> index 7882586..c7eb069 100755
> --- a/test
> +++ b/test
> @@ -16,6 +16,10 @@ then
>     echo >&2 "test: $mdadm isn't usable."
>  fi
>  
> +testdir="tests"
> +logdir="$testdir/logs"
> +logsave=0
> +
>  # Check whether to run multipath tests
>  modprobe multipath 2> /dev/null
>  if grep -s 'Personalities : .*multipath' > /dev/null /proc/mdstat ; then
> @@ -204,6 +208,7 @@ rotest() {
>  
>  do_test() {
>    _script=$1
> +  _basename=`basename $_script`
>    if [ -f "$_script" ]
>    then
>      rm -f $targetdir/stderr
> @@ -215,8 +220,17 @@ do_test() {
>      # namespace, but cannot change it.
>      echo -ne "$_script... "
>      if ( set -ex ; . $_script )  2> $targetdir/log
> -    then echo "succeeded"
> -    else echo "FAILED - see $targetdir/log for details"
> +    then
> +      echo "succeeded"
> +      _fail=0
> +    else
> +      echo "FAILED - see $targetdir/log for details"
> +      _fail=1
> +    fi
> +    if [ "$savelogs" == "1" ]; then
> +      cp $targetdir/log $logdir/$_basename.log
> +    fi
> +    if [ "$_fail" == "1" ]; then
>        exit 1
>      fi
>    fi
> @@ -224,7 +238,7 @@ do_test() {
>  
>  do_help() {
>    echo "Usage: "
> -  echo " $0 [--tests=<test1,test2,..>] [--disable-multipath] [setup] [prefix]"
> +  echo " $0 [--tests=<test1,test2,..>] [--disable-multipath] [--logdir] [--save-logs] [setup] [prefix]"
>  }
>  
>  parse_args() {
> @@ -241,6 +255,18 @@ parse_args() {
>      --tests=*)
>        TESTLIST=`expr "x$i" : 'x[^=]*=\(.*\)' | sed -e 's/,/ /g'`
>        ;;
> +    --logdir=*)
> +      logdir=`expr "x$i" : 'x[^=]*=\(.*\)'`
> +      ;;
> +    --save-logs)
> +      savelogs=1
> +      if [ ! -d $logdir ] ; then
> +        mkdir $logdir
> +        if [ $? -ne 0 ] ; then
> +	  exit 1;
> +	fi
> +      fi
> +      ;;
>      --disable-multipath)
>        unset MULTIPATH
>        ;;
> @@ -259,13 +285,17 @@ done
>  
>  parse_args $@
>  
> +if [ "$savelogs" == "1" ]; then
> +  echo "Saving logs to $logdir"
> +fi
> +
>  if [ "x$TESTLIST" != "x" ]; then
> -  for script in $TESTLIST
> +  for script in $testdir/$TESTLIST

That's not really right, is it?
I fixed it to instead change...

>    do
> -    do_test tests/$script
> +    do_test $script

..this to
       do_text $testdir/$script

and applied.

Thanks,
NeilBrown


>    done
>  else
> -  for script in tests/$prefix tests/$prefix*[^~]
> +  for script in $testdir/$prefix $testdir/$prefix*[^~]
>    do
>      do_test $script
>    done


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 828 bytes --]

  reply	other threads:[~2012-05-28  0:54 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-05-25 15:24 [PATCH 0/4] More test suite enchancements Jes.Sorensen
2012-05-25 15:24 ` [PATCH 1/4] Add support for saving log files in test script Jes.Sorensen
2012-05-28  0:54   ` NeilBrown [this message]
2012-05-25 15:24 ` [PATCH 2/4] Add --no-error argument to 'test' Jes.Sorensen
2012-05-25 15:24 ` [PATCH 3/4] Improve --help message from test Jes.Sorensen
2012-05-25 15:24 ` [PATCH 4/4] Move setup code to a function and introduce matching cleanup argument Jes.Sorensen
2012-05-28  0:56   ` NeilBrown
2012-05-29  6:02     ` Jes Sorensen

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=20120528105455.5d4a1211@notabene.brown \
    --to=neilb@suse.de \
    --cc=Jes.Sorensen@redhat.com \
    --cc=dledford@redhat.com \
    --cc=linux-raid@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.