From: Dave Chinner <david@fromorbit.com>
To: Hugo Mills <hugo@carfax.org.uk>,
Hemanth Kumar <hemanthkumar51@gmail.com>,
linux-btrfs@vger.kernel.org, skjmca51@gmail.com,
ganeshkumar14@gmail.com, kirantpatil@gmail.com,
praneethu.u@gmail.com, chethan.casey@gmail.com, sensille@gmx.net,
bo.li.liu@oracle.com, sandeen@redhat.com
Subject: Re: [btrfs-progs] testing btrfs hierarchical quotas
Date: Sat, 16 Feb 2013 18:55:09 +1100 [thread overview]
Message-ID: <20130216075509.GW26694@dastard> (raw)
In-Reply-To: <20130215205906.GI28997@carfax.org.uk>
On Fri, Feb 15, 2013 at 08:59:06PM +0000, Hugo Mills wrote:
> Hi, Hemanth,
>
> Here's a question -- what are you testing? (Not just here, but in
> general, with your test infrastructure)
>
> There are (at least) three classes of tests you could be doing:
>
> 1) Unit tests, which test individual functions within the code and
> ensure they do what they're meant to do.
>
> 2) Integration tests, which test the full end-to-end system.
>
> 3) Partial integration tests, which exercise the kernel
> filesystem code.
>
> 4) Partial integration tests, which exercise the userspace tools code.
>
>
> Now, clearly you're not doing (1) here. It's going to be hard to
> separate (2) from (3) and (4), but it's possible to write your tests
> to do more of one or of the other. (*)
>
> xfstests clearly is much more geared to (3), and stresses the
> kernel filesystem implementation rather than the userspace tools. If
Definitely not. There are lots of userspace tools tests in xfstests
for stuff like mkfs.xfs, xfs_repair, xfs_dump/restore,
xfs_quota, xfs_metadump/restore, xfs_copy, etc.
> you want to test the implementation of qgroups, it belongs in
> xfstests. If you want to test the userspace code, you need to make
> sure that (over all your tests) you cover every command-line option,
> and every different way of using the tool, and ensure that it does the
> right things.
Yup, that's why there are are so many xfs specific tests. :) e.g.
there are 31 tests that use xfsdump/restore in lots of different
ways, including exercising dumping to tape devices if you have the
hardware...
Another small comment that needs to be pointed out:
> > +cleanup()
> > +{
> > + btrfs subvolume delete $TEST_DIR/vol1/vol2/vol3
> > + btrfs subvolume delete $TEST_DIR/vol1/vol2
> > + btrfs subvolume delete $TEST_DIR/vol1
> > + btrfs subvolume disable $TEST_DIR
> > +}
> > +
> > +#trap "_cleanup ; exit \$status" 0 1 2 3 15
This test is clearly derived from an xfstests test script (status,
the trap, the cleanup function, the tmp variable, use of TEST_DEV
and TEST_DIR, etc), but it clearly isn't a functional test without
the rest of the xfstests harness...
> > +btrfs quota enable $TEST_DIR
> > +echo "quota enabled on $TEST_DEV"
> > +btrfs subvolume create $TEST_DIR/vol1
> > +btrfs subvolume create $TEST_DIR/vol1/vol2
> > +btrfs subvolume create $TEST_DIR/vol1/vol2/vol3
> > +btrfs qgroup limit 5m $TEST_DIR/vol1
> > +btrfs qgroup limit 3m $TEST_DIR/vol1/vol2
> > +btrfs qgroup limit 2m $TEST_DIR/vol1/vol2/vol3
> > +dd if=$TEST_DEV of=$TEST_DIR/vol1/vol2/vol3/file1 bs=3M count=1
> > +dd if=$TEST_DEV of=$TEST_DIR/vol1/vol2/file1 bs=2M count=1
> > +dd if=$TEST_DEV of=$TEST_DIR/vol1/file1 bs=5M count=1
>
> What happens if one of these commands fails?
The xfstests harness would catch the error message because it
wouldn't match the golden output.
> You should be testing
> the exit status of almost every command.
No need with xfstests. As I said, the golden output image matching
will catch the error message emitted by the failed comand...
> Then you can fail in one of
> two different ways: a failure of the test (where the thing you were
> trying to test has not succeeded), or a failure of the test harness
> (where the setup functions have gone wrong).
But both can be detected the same way without having to put anything
in the test script to detect it.
> I'd do this with a setup function to set up the test environment, a
> teardown function to undo it cleanly afterwards, and one or more test
> functions which can be used to run tests.
Which is already provided by xfstests.
> > +cleanup
> > +exit
>
> It's the end of the script. You don't need to use exit here.
Copied again from a xfstests test, obviously without understanding
what the commented out trap does.
$ man bash
.....
exit [n]
Cause the shell to exit with a status of n. If n is
omitted, the exit status is that of the last command
executed. A trap on EXIT is executed before the
shell terminates.
.....
trap [-lp] [[arg] sigspec ...]
.....
If a sigspec is EXIT (0) the command arg is executed
on exit from the shell.
IOWs, the trap command causes the cleanup function to be called
automatically on exit....
Seriously, guys, just write new tests for xfstests. Everything you
need to run btrfs-progs tests is already there. Don't try to
re-invent the wheel simply because you don't understand how the
current wheels we have are made....
Cheers,
Dave.
--
Dave Chinner
david@fromorbit.com
next prev parent reply other threads:[~2013-02-16 7:55 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-02-15 13:05 [btrfs-progs] testing btrfs hierarchical quotas Hemanth Kumar
2013-02-15 13:48 ` shilong wang
2013-02-15 20:59 ` Hugo Mills
2013-02-16 7:55 ` Dave Chinner [this message]
2013-02-16 17:45 ` Hugo Mills
[not found] ` <CAG_LFoCRWaKHe2_AYspN3qUUFw4iWgdB56fWeSGP5C0iKAaX8w@mail.gmail.com>
2013-02-18 11:20 ` Hugo Mills
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=20130216075509.GW26694@dastard \
--to=david@fromorbit.com \
--cc=bo.li.liu@oracle.com \
--cc=chethan.casey@gmail.com \
--cc=ganeshkumar14@gmail.com \
--cc=hemanthkumar51@gmail.com \
--cc=hugo@carfax.org.uk \
--cc=kirantpatil@gmail.com \
--cc=linux-btrfs@vger.kernel.org \
--cc=praneethu.u@gmail.com \
--cc=sandeen@redhat.com \
--cc=sensille@gmx.net \
--cc=skjmca51@gmail.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