All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alex Elder <aelder@sgi.com>
To: Eric Sandeen <sandeen@sandeen.net>
Cc: Eric Sandeen <sandeen@redhat.com>, xfs-oss <xfs@oss.sgi.com>
Subject: Re: [PATCH] xfstests: exit non-0 if fs check fails
Date: Thu, 15 Apr 2010 14:29:31 -0500	[thread overview]
Message-ID: <1271359771.2680.128.camel@doink> (raw)
In-Reply-To: <4BB3F61D.3020507@sandeen.net>

On Wed, 2010-03-31 at 20:25 -0500, Eric Sandeen wrote:
> Dave Chinner wrote:
> > On Wed, Mar 31, 2010 at 06:38:23PM -0500, Eric Sandeen wrote:
> >> Right now if any of the _check_scratch_fs tests etc fail,
> >> the check script exits but with 0 status.
> >>
> >> This change will cause the status to be non-0 so we can detect
> >> the error.
> >>
> >> Signed-off-by: Eric Sandeen <sandeen@redhat.com>
> > 
> > Wouldn't it be better to do:
> > 
> > -   [ $ok -eq 0 ] && exit 1
> > +    if [ $ok -eq 0 ]; then
> > +	status=1
> > +	exit 1
> > +    fi
> > 
> > To catch all failures rather than just the fsck failure?

I see this patch is already committed to xfstests-dev.

I don't see the point of setting status=1 before exiting.
If what you meant was to set the status and then *return*
a non-zero value it would make sense.

How do you feel about updating your patch and committing
the result to the -dev tree?

If you change "exit" to "return" in both spots you
can consider it reviewed by me.

					-Alex

PS  Here is a script that shows what's going on.

#!/bin/bash

echo =============
status=1
echo top-level shell PID is $$
echo initial status is $status

bash <<!
        echo -------------
        echo sub-shell PID is \$$
        echo sub-shell initial status is \$status

        foo() { echo foo PID is \$$; status=2; return 3; }
        bar() { echo bar PID is \$$; status=4; exit 5; }
        
        echo -------------
        status=0
        foo             # This is run in the current (sub) shell
        echo foo result is \$?
        echo post-foo status is \$status
        echo current shell PID is \$$

        echo -------------
        status=0
        bar             # This will exit to the top-level shell
        # And the next three will not get executed
        echo bar result is \$?
        echo post-bar status is \$status
        echo current shell PID is \$$
!
R=$?
echo -------------
echo final result is $R
echo final shell PID is $$
echo final status is $status

echo =============

exit 0



> sure, that sounds better.  I'll check that version in w/ your SOB
> unless I hear otherwise :)
> 
> Thanks,
> -Eric
> 
> >> ---
> >>
> >> (aside - we could make it 2 instead of 1, so that a calling script
> >> could fsck and continue ... thoughts?)
> > 
> > I think if a test corrupts a filesystem, the test run should stop
> > so the failure can be analysed without needing to reproduce it
> > again...
> > 
> > Cheers,
> > 
> > Dave.
> 
> _______________________________________________
> xfs mailing list
> xfs@oss.sgi.com
> http://oss.sgi.com/mailman/listinfo/xfs



_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

      reply	other threads:[~2010-04-15 19:27 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-03-31 23:38 [PATCH] xfstests: exit non-0 if fs check fails Eric Sandeen
2010-04-01  0:19 ` Dave Chinner
2010-04-01  1:25   ` Eric Sandeen
2010-04-15 19:29     ` Alex Elder [this message]

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=1271359771.2680.128.camel@doink \
    --to=aelder@sgi.com \
    --cc=sandeen@redhat.com \
    --cc=sandeen@sandeen.net \
    --cc=xfs@oss.sgi.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.