public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Dave Chinner <david@fromorbit.com>
To: Jeff Liu <jeff.liu@oracle.com>
Cc: Christoph Hellwig <hch@infradead.org>,
	Mark Tinguely <tinguely@sgi.com>,
	xfs@oss.sgi.com
Subject: Re: [PATCH v2 1/2] xfstests: introduce 279 for SEEK_DATA/SEEK_HOLE sanity check
Date: Wed, 8 Feb 2012 16:42:42 +1100	[thread overview]
Message-ID: <20120208054241.GH20305@dastard> (raw)
In-Reply-To: <4F2FE40A.6050108@oracle.com>

On Mon, Feb 06, 2012 at 10:30:34PM +0800, Jeff Liu wrote:
> Introduce 279 for SEEK_DATA/SEEK_HOLE sanity check.
.....
> +echo "QA output created by $seq"
> +
> +here=`pwd`
> +status=0	# success is the default!

Why? failure should be the default, and it is in the new test
template...

$ grep failure new
status=1        # failure is the default!

> +trap "_cleanup; exit \$status" 0 1 2 3 15

Indeed, we want the test to fail if it is interrupted.

> +
> +# get standard environment, filters and checks
> +. ./common.rc
> +. ./common.filter
> +
> +# real QA test starts here
> +
> +# Modify as appropriate.
> +# FIXME: _supported_os should include Solaris too.
> +_supported_fs generic
> +_supported_os Linux Solaris

What is the FIXME for?

> +base_test_path=$TEST_DIR/seek_sanity_testfile
> +
> +[ -x $here/src/seek_sanity_tester ] || _notrun "seek_sanitfy_tester not built"
> +
> +_cleanup()
> +{
> +	rm -f $base_test_path.*
> +}
> +
> +rm -rf $seq.out
> +echo "QA output created by $seq" > $seq.out

Anything output on stdout automatically gets put into $seq.out by
the test harness. The $seq.out file is truncated before the test, so
this is not necessary. Indeed, doing this is probably why the tee
command below only results in a single copy of the output in
$seq.out.

> +$here/src/seek_sanity_tester $base_test_path 2>&1 | tee -a $seq.out

This only needs to be:

$here/src/seek_sanity_tester $base_test_path 2>&1

to redirect both stdout and stderr to $seq.out.

> --- /dev/null
> +++ b/279.out
> @@ -0,0 +1,116 @@
> +QA output created by 279
> +File system supports the default behavior.
> +File system magic#: 0x58465342

You can't put the filesystem magic number in the output. It is
different for XFS, ext4, ext3, etc. Either it needs to be removed or
filtered.

> +Allocation size: 4096

That's no good, either, as filesystems can easily return return
something other than 4k there as well.

> +01. Test empty file
> +01.01 SEEK_DATA expected -1 with errno -6, got -6.                succ
> +01.02 SEEK_HOLE expected -1 with errno -6, got -6.                succ
> +01.03 SEEK_HOLE expected -1 with errno -6, got -6.                succ
> +
> +02. Test a tiny full file
> +02.01 SEEK_HOLE expected 8 or 8, got 8.                           succ
> +02.02 SEEK_DATA expected 0 or 0, got 0.                           succ
> +02.03 SEEK_DATA expected 1 or 1, got 1.                           succ
> +02.04 SEEK_HOLE expected 8 or 8, got 8.                           succ
> +02.05 SEEK_DATA expected 7 or 7, got 7.                           succ
> +02.06 SEEK_HOLE expected -1 with errno -6, got -6.                succ
> +02.07 SEEK_DATA expected -1 with errno -6, got -6.                succ
> +02.08 SEEK_HOLE expected -1 with errno -6, got -6.                succ
> +02.09 SEEK_DATA expected -1 with errno -6, got -6.                succ
> +
> +03. Test a larger full file
> +03.01 SEEK_HOLE expected 8292 or 8292, got 8292.                  succ
> +03.02 SEEK_HOLE expected 8292 or 8292, got 8292.                  succ
> +03.03 SEEK_DATA expected 0 or 0, got 0.                           succ
> +03.04 SEEK_DATA expected 1 or 1, got 1.                           succ
> +03.05 SEEK_HOLE expected 8292 or 8292, got 8292.                  succ
> +03.06 SEEK_DATA expected 8291 or 8291, got 8291.                  succ

Hmmm, these are all numbers that are based on an allocation size of
4k. So this test is guaranteed to fail on configurations that don't
report a 4k block size from fstat().

I'd suggest that what you need to do here is have the test exit with
a 1 or 0 to indicate success, and test for that in the 279 script,
and pipe all this output to $seq.full so it can be used for
debugging when a failure occurs.

Basically, if numbers can change between different test configs,
then they either need to be filtered out of the golden output or
directed to the $seq.full and the test does something like:

status=1 # failure is the default
rm -f $seq.full
....
run_test >> $seq.full 2>&1 || _fail "run_test failed!"
status=0
exit

Cheers,

Dave.
-- 
Dave Chinner
david@fromorbit.com

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

  reply	other threads:[~2012-02-08  5:42 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-06 14:30 [PATCH v2 1/2] xfstests: introduce 279 for SEEK_DATA/SEEK_HOLE sanity check Jeff Liu
2012-02-08  5:42 ` Dave Chinner [this message]
2012-02-09 14:01   ` Jeff Liu
2012-02-09 14:27     ` Jeff Liu
2012-02-09 22:25       ` Dave Chinner
2012-02-10  3:24         ` Jeff Liu
2012-02-10  5:20           ` Dave Chinner
2012-02-10  5:38             ` Jeff Liu

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=20120208054241.GH20305@dastard \
    --to=david@fromorbit.com \
    --cc=hch@infradead.org \
    --cc=jeff.liu@oracle.com \
    --cc=tinguely@sgi.com \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox