xfstests-dev.git
11 years agoxfstests: make install support common/ and tests/ dirs
Wang Sheng-Hui [Fri, 12 Apr 2013 04:26:53 +0000 (04:26 +0000)]
xfstests: make install support common/ and tests/ dirs

xfstests have some change on the organization of the testcases
and common* files:
     * The common* scripts have been reorganized into the common/ dir.
     * The testcases have been reorganized into sub test dirs under tests/.
     * The run.* scripts have been removed.

This patch uses the simple way to make install support above changes:
     Make up one Makefile for each newly created subdirs, which can control
     'make install' separately.

v2 introduces the following changes compared with v1:
     * Ignore the file 'group' under the top dir, for it's useless in the new
       structures.
     * Remove the redundant comments in the Makefiles.
     * Use XXX_DIR instead of XXX_SUBDIR in the Makefiles under common/ and tests/.
     * Export TESTS_DIR in teh top level Makefile instead of tests/Makefile.
     * Obtain the names of dirs for testcases by iterating sub dirs under /tests,
       not by enumeration in tests/Makefile.

Signed-off-by: Wang Sheng-Hui <shhuiw@gmail.com>
Reviewed-by: Rich Johnston <rjohnston@sgi.com>
[rjohnston@sgi.com Minor modification to Makefile]
Signed-off-by: Rich Johnston <rjohnston@sgi.com>
11 years agoxfstests: replace $seq.full with $seqres.full in ext4/305 and generic/308
Eryu Guan [Sun, 7 Apr 2013 10:39:06 +0000 (10:39 +0000)]
xfstests: replace $seq.full with $seqres.full in ext4/305 and generic/308

We use $seqres.full to record verbose output now, replace $seq.full with
$seqres.full in ext4/305 and generic/308.

Signed-off-by: Eryu Guan <eguan@redhat.com>
Reviewed-by: Rich Johnston <rjohnston@sgi.com>
Signed-off-by: Rich Johnston <rjohnston@sgi.com>
11 years agoxfstests: remove comments about creator in new
Eryu Guan [Sun, 7 Apr 2013 10:39:05 +0000 (10:39 +0000)]
xfstests: remove comments about creator in new

We have removed creator/owner info from each test case, remove the
'creator' comment in template too.

Signed-off-by: Eryu Guan <eguan@redhat.com>
Reviewed-by: Rich Johnston <rjohnston@sgi.com>
Signed-off-by: Rich Johnston <rjohnston@sgi.com>
11 years agoxfstests generic 310: check concurrently of readdir and read on the same directory fd
Zhao Hongjiang [Wed, 3 Apr 2013 06:09:10 +0000 (06:09 +0000)]
xfstests generic 310: check concurrently of readdir and read on the same directory fd

Check if there are two threads,one keeps calling read() or lseek(), and
the other calling readdir(), both on the same directory fd.

Based on a testcase from Li Zefan <lizefan@huawei.com>.
http://marc.info/?l=linux-kernel&m=136123703211869&w=2

Signed-off-by: Zhao Hongjiang <zhaohongjiang@huawei.com>
Reviewed-by: Rich Johnston <rjohnston@sgi.com>
[rjohnston@sgi.com minor white space fixes and test renumbering]
Signed-off-by: Rich Johnston <rjohnston@sgi.com>
11 years agoxfstests generic 309: test dir mtime and ctime are updated on rename
Eryu Guan [Mon, 1 Apr 2013 10:57:44 +0000 (10:57 +0000)]
xfstests generic 309: test dir mtime and ctime are updated on rename

Test directory mtime and ctime are updated when moving a file onto an
existing file in the directory

Regression test for commit:
0b23076 ext3: fix update of mtime and ctime on rename

Signed-off-by: Eryu Guan <eguan@redhat.com>
Reviewed-by: Rich Johnston <rjohnston@sgi.com>
[rjohnston@sgi.com renumbered test to next in group sequence]
Signed-off-by: Rich Johnston <rjohnston@sgi.com>
11 years agoxfstests ext4 305: test read /proc/fs/ext4/<dev>/mb_groups while the fs is being...
Eryu Guan [Mon, 1 Apr 2013 10:57:43 +0000 (10:57 +0000)]
xfstests ext4 305: test read /proc/fs/ext4/<dev>/mb_groups while the fs is being unmounted

Regression test for commit:
9559996 ext4: remove mb_groups before tearing down the buddy_cache

Signed-off-by: Eryu Guan <eguan@redhat.com>
Reviewed-by: Rich Johnston <rjohnston@sgi.com>
[rjohnston@sgi.com renumbered test to next in group sequence]
Signed-off-by: Rich Johnston <rjohnston@sgi.com>
11 years agoxfstests generic 308: test write to the last block of max file size on ext4
Eryu Guan [Mon, 1 Apr 2013 10:57:42 +0000 (10:57 +0000)]
xfstests generic 308: test write to the last block of max file size on ext4

On unpatched ext4 if an extent exists which includes the block right
before the maximum file offset, and the block for the maximum file
offset is written, the kernel panics.

On patched ext4, the write would get EFBIG since we lower s_maxbytes
by one fs block.

Regression test for commit:
f17722f ext4: Fix max file size and logical block counting of extent format file

Though it's an ext4 specific issue, it's no harm to run on all file
systems, so put it in generic.

Signed-off-by: Eryu Guan <eguan@redhat.com>
Reviewed-by: Rich Johnston <rjohnston@sgi.com>
[rjohnston@sgi.com renumbered test to next in group sequence]
Signed-off-by: Rich Johnston <rjohnston@sgi.com>
11 years agoxfstests generic 307: check ctime updates for setfacl
Eryu Guan [Mon, 1 Apr 2013 10:57:41 +0000 (10:57 +0000)]
xfstests generic 307: check ctime updates for setfacl

Check if ctime is updated and written to disk after setfacl

Regression test for the following extN commits
c6ac12a ext4: update ctime when changing the file's permission by setfacl
30e2bab ext3: update ctime when changing the file's permission by setfacl
523825b ext2: update ctime when changing the file's permission by setfacl

Signed-off-by: Eryu Guan <eguan@redhat.com>
Reviewed-by: Rich Johnston <rjohnston@sgi.com>
[rjohnston@sgi.com renumbered test to next in group sequence]
Signed-off-by: Rich Johnston <rjohnston@sgi.com>
11 years agoxfstests: cleanup duplicates in all tests
Rich Johnston [Wed, 3 Apr 2013 17:31:49 +0000 (17:31 +0000)]
xfstests: cleanup duplicates in all tests

There are duplicate blank lines, comment hash and lines
containing duplicate seqres= declarations, remove them.

Signed-off-by: Rich Johnston <rjohnston@sgi.com>
Reviewed-by: Eric Sandeen <sandeen@redhat.com>
11 years agoxfstests: set correct seqres variable in new when creating test template
Eryu Guan [Mon, 1 Apr 2013 10:58:15 +0000 (10:58 +0000)]
xfstests: set correct seqres variable in new when creating test template

When setting seqres in the new script, '$' should be escaped,
otherwise seqres will be set to '/' not '$RESULT_DIR/$seq'

Signed-off-by: Eryu Guan <eguan@redhat.com>
Reviewed-by: Rich Johnston <rjohnston@sgi.com>
Signed-off-by: Rich Johnston <rjohnston@sgi.com>
11 years agoxfstests: fix common source file path
Eryu Guan [Fri, 29 Mar 2013 04:49:55 +0000 (04:49 +0000)]
xfstests: fix common source file path

After the re-factor, common.* have been renamed to common/* but there
are several files still look for the old path, fix it.

Signed-off-by: Eryu Guan <eguan@redhat.com>
Reviewed-by: Rich Johnston <rjohnston@sgi.com>
Signed-off-by: Rich Johnston <rjohnston@sgi.com>
11 years agoxfstests: use BTRFS_UTIL_PROG instead of btrfs
David Sterba [Thu, 28 Mar 2013 16:13:43 +0000 (16:13 +0000)]
xfstests: use BTRFS_UTIL_PROG instead of btrfs

Signed-off-by: David Sterba <dsterba@suse.cz>
Reviewed-by: Rich Johnston <rjohnston@sgi.com>
Signed-off-by: Rich Johnston <rjohnston@sgi.com>
11 years agoxfstests: check: set up config variables before using them
David Sterba [Thu, 28 Mar 2013 17:00:18 +0000 (17:00 +0000)]
xfstests: check: set up config variables before using them

HOSTOS was used in a test before being initialized and this led to
failed filesystem type detection.

Signed-off-by: David Sterba <dsterba@suse.cz>
Reviewed-by: Rich Johnston <rjohnston@sgi.com>
Signed-off-by-by: Rich Johnston <rjohnston@sgi.com>
11 years agoxfstests: use _notrun for tape checks
Dave Chinner [Fri, 15 Mar 2013 12:28:09 +0000 (12:28 +0000)]
xfstests: use _notrun for tape checks

_require_tape is failing tests when no TAPE_DEV is specified. It
should be using _notrun for these cases rather than trying to open
code the $seqres.notrun magic file manipulations.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Phil White <pwhite@sgi.com>
Signed-off-by: Rich Johnston <rjohnston@sgi.com>
11 years agoxfstests: clean up test 262 output file use.
Dave Chinner [Fri, 15 Mar 2013 12:28:08 +0000 (12:28 +0000)]
xfstests: clean up test 262 output file use.

Test 262 uses ${} notation for some variables, and so is resistant
to grep and sed matches. Change it to use the same notation as the
rest of xfstests and fix up the output file redirections made in
previous patches.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Phil White <pwhite@sgi.com>
Signed-off-by: Rich Johnston <rjohnston@sgi.com>
11 years agoxfstests: Decomplicate quota setup in 050
Dave Chinner [Fri, 15 Mar 2013 12:28:07 +0000 (12:28 +0000)]
xfstests: Decomplicate quota setup in 050

Only test 050 uses the _qsetup function, and it only uses the ID
part of it in the test. The attempts to link output files is useless
as there are no different output files used by the test.

Hence kill the _qsetup function, and move the code into test 050,
simplifying it down to the minimum needed.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Phil White <pwhite@sgi.com>
Signed-off-by: Rich Johnston <rjohnston@sgi.com>
11 years agoxfstests: RESULTS_DIR needs to be an absolute path
Dave Chinner [Fri, 15 Mar 2013 12:28:06 +0000 (12:28 +0000)]
xfstests: RESULTS_DIR needs to be an absolute path

Some tests 'cd <somedir>' and then direct output to $RESULT_DIR,
which fails if the current working directory is not $here.
Regardless, if an external results directory is to be used it needs
to have a full path specified and the use of $here as the base of
the results files is completely incorrect.

Hence change all the $here/$seqres* references to simply be
$seqres*, and instead encode the full path to the results in
$RESULT_DIR.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Phil White <pwhite@sgi.com>
Signed-off-by: Rich Johnston <rjohnston@sgi.com>
11 years agoxfstests: Reintroduce configurable test expunging.
Dave Chinner [Fri, 15 Mar 2013 12:28:05 +0000 (12:28 +0000)]
xfstests: Reintroduce configurable test expunging.

It is definitely handy to be able to disabdle certain tests (e.g. tests that are
known to hang or crash the test machine on certain kernels), so re-introducing
the capability of avoiding certain tests just by placing them in a file is
useful.

Introduce a command line option to specify the expunged file name. The file will
exist in each tests/* sub-directory so that only the testname is required, and
can be managed independently. The use of a command line parameter allows
multiple expunge files to exist simultaneously in the one xfstests tree which
simplifies management of a source repository used for multiple versions of a
distro.

Typical usage:

$ cat tests/generic/3.0-stable-avoid
280
$ sudo ./check -X 3.0-stable-avoid generic/280
FSTYP         -- xfs (debug)
PLATFORM      -- Linux/x86_64 test-1 3.0.39-dgc+
MKFS_OPTIONS  -- -f -bsize=4096 /dev/vdb
MOUNT_OPTIONS -- /dev/vdb /mnt/scratch

generic/280     [expunged]
Passed all 0 tests
$

Eventually we should be able to automate setting up expunged files based on
distro release or kernel version through this infrastructure.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Phil White <pwhite@sgi.com>
Signed-off-by: Rich Johnston <rjohnston@sgi.com>
11 years agoxfstests: introduce a common directory
Dave Chinner [Fri, 15 Mar 2013 12:28:04 +0000 (12:28 +0000)]
xfstests: introduce a common directory

Introduce a top level common directory and move all the common.*
files into it.  Because there is now a directory named common, the
prefix can be dropped from all the files. Convert all the tests to
use this new directory for including common files.

for f in common.*; do \
git mv `echo -n "$f " ; echo $f | sed -e 's;n\.;n/;'` \
done

Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Phil White <pwhite@sgi.com>
[rjohnston@sgi.com reworked for TOT changes]
Signed-off-by: Rich Johnston <rjohnston@sgi.com>
11 years agoxfstests: fix _link_out_file callers
Dave Chinner [Fri, 15 Mar 2013 12:28:03 +0000 (12:28 +0000)]
xfstests: fix _link_out_file callers

Currently the callers pass $seq, rather than the full path to the
test. As a result, it creates the link in the top level directory
and it points nowhere.  Fix it to create the link in the correct
place.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Phil White <pwhite@sgi.com>
Signed-off-by: Rich Johnston <rjohnston@sgi.com>
11 years agoxfstests: convert tests to use new results directory
Dave Chinner [Fri, 15 Mar 2013 12:28:02 +0000 (12:28 +0000)]
xfstests: convert tests to use new results directory

Essentially the change is simply this. Converting:

... >> $seq.????

to:

.... >> $RESULT_DIR/$seq.????

so that output files are directed to the defined output directory.

sed to the rescue:

$ sed -i -e '/^seq=.*$/a seqres=$RESULT_DIR/$seq' -e 's/seq.full/seqres.full/' tests/*/*

will do most of the work automatically.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Phil White <pwhite@sgi.com>
[rjohnston@sgi.com reworked for TOT changes]
Signed-off-by: Rich Johnston <rjohnston@sgi.com>
11 years agoxfstests: Introduce a results directory
Dave Chinner [Fri, 15 Mar 2013 12:28:01 +0000 (12:28 +0000)]
xfstests: Introduce a results directory

Currently each test gets it's sequence number from it's name. It
separates this from the path via basename, and uses it for
outputting full, notrun and other status/log files. Hence these end
up in the top level directory.

All these output files need to go somewhere other than the top level
directory. Right now the check script is looking for them in the new
test directories (e.g. for the notrun files), but it would be good
to be able to separate the test source form the test output.

Hence create an output directory which has a similar heirarchy to
the test source directory. Create it on demand when we build the
list of tests to run if it doesn't already exist.

Change the high level check script to set up this variable
appropriately for each test that is being run, and to use this new
output directory for it's result files as well. The next commit will
change all the tests themselves to use the new output directory.

This is the first (small) step in being able to store test results
in an external location for archival/data mining purposes.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Phil White <pwhite@sgi.com>
[rjohnston@sgi.com rm whitespace and fix typos in commit message]
Signed-off-by: Rich Johnston <rjohnston@sgi.com>
11 years agoxfstests: make exclude groups aware of multiple subdirectories
Dave Chinner [Fri, 15 Mar 2013 12:28:00 +0000 (12:28 +0000)]
xfstests: make exclude groups aware of multiple subdirectories

Now that there are no tests in the top level directory, the exlude
group functionality no longer works (-x group) as it cannot find
tests to build an initial list of tests. Rework the the exclude
group implementation to operate correctly on the new test locations.

Also, switch from sed to grep for exclusion because sed has problems
distnguishing the '/' in path names from regex control...

Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Phil White <pwhite@sgi.com>
Signed-off-by: Rich Johnston <rjohnston@sgi.com>
11 years agoxfstests: rework CLI individual test specification
Dave Chinner [Fri, 15 Mar 2013 12:27:59 +0000 (12:27 +0000)]
xfstests: rework CLI individual test specification

Now that tests are in separate subdirectories, they cannot be selected purely by
test number on the command line. We need to specify the test by subdir and test
name, so effectively we move to specifying them by regexes on the command line
rather than by expanding a range internally. This is needed to support
non-numeric test names as well, so the change may as well be made here.

This means the command line parsing needs to change from trying to detect tests
by a regex match to a processing loop that simply parses the tests and checks
for there existence. Hence the moment we find an argument that is not a switch
(i.e no preceeding "-"), we move from the arg processing loop to the test name
processing loop. IOWs, tests must be specified last on the command line.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Phil White <pwhite@sgi.com>
Signed-off-by: Rich Johnston <rjohnston@sgi.com>
11 years agoxfstests: move remaining tests out of top level directory
Dave Chinner [Fri, 15 Mar 2013 12:27:58 +0000 (12:27 +0000)]
xfstests: move remaining tests out of top level directory

These are tests that are shared between multiple filesystems (moved
to shared), and udf/btrfs/ext4 specific tests, moved to appropriate
directories.

I created the "shared" directory to indicate tests that are not
truly generic, but also not filesystem specific. They might rely on
a feature that is only implmented in a few filesystems and so can't
be truly generic.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Phil White <pwhite@sgi.com>
[rjohnston@sgi.com reworked for TOT changes]
Signed-off-by: Rich Johnston <rjohnston@sgi.com>
11 years agoxfstests: move xfs specific tests out of top directory
Dave Chinner [Fri, 15 Mar 2013 12:27:57 +0000 (12:27 +0000)]
xfstests: move xfs specific tests out of top directory

And into tests/xfs. Tests found and moved via:

$ grep "supported_fs xfs$" [0-2]* | cut -d : -f 1 > xfs.tests
$ for i in `cat xfs.tests`; do
> git mv $i* tests/xfs/
> grep ^$i group >> tests/xfs/group
> sed -i -e "/^$i/d" group
> done

Output now looks like:

 sudo ./check -g quick -r
FSTYP         -- xfs (debug)
PLATFORM      -- Linux/x86_64 test-1 3.5.0-rc5-dgc+
MKFS_OPTIONS  -- -f -bsize=4096 /dev/vdb
MOUNT_OPTIONS -- /dev/vdb /mnt/scratch

xfs/170  4s
generic/120      16s
generic/248      0s
generic/213      0s
generic/256      39s
xfs/121  6s
xfs/026  11s
generic/131      1s
xfs/187  1s
generic/135      0s
....

Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Phil White <pwhite@sgi.com>
[rjohnston@sgi.com did not move test 032, belongs in shared]
Signed-off-by: Rich Johnston <rjohnston@sgi.com>
11 years agoxfstests: move generic tests out of top level dir
Dave Chinner [Fri, 15 Mar 2013 12:27:56 +0000 (12:27 +0000)]
xfstests: move generic tests out of top level dir

And into tests/generic.  Tests were found simply by grepping for the
__supported_fs field in the tests.

Output starts to look like:

$ sudo ./check -g quick -r
FSTYP         -- xfs (debug)
PLATFORM      -- Linux/x86_64 test-1 3.5.0-rc5-dgc+
MKFS_OPTIONS  -- -f -bsize=4096 /dev/vdb
MOUNT_OPTIONS -- /dev/vdb /mnt/scratch

./242    1s
./183    2s
generic/236      1s
generic/014      1s
generic/258      0s
./096    1s
generic/245      0s
^C
Ran: ./242 ./183 generic/236 generic/014 generic/258 ./096 generic/245
Passed all 7 tests

Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Phil White <pwhite@sgi.com>
[rjohnston@sgi.com added TOT changes]
Signed-off-by: Rich Johnston <rjohnston@sgi.com>
11 years agoxfstests: remove 285.full and 286.full
Dave Chinner [Fri, 15 Mar 2013 12:27:55 +0000 (12:27 +0000)]
xfstests: remove 285.full and 286.full

These files are generated by the tests, they don't belong in
the repository.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Phil White <pwhite@sgi.com>
Signed-off-by: Rich Johnston <rjohnston@sgi.com>
11 years agoxfstests: include test subdirectory support
Dave Chinner [Fri, 15 Mar 2013 12:27:54 +0000 (12:27 +0000)]
xfstests: include test subdirectory support

Create a specific tests/ subdirectory to hold all the tests so they
are no longer need to be in the top level directory. This patch does
not move any tests there, however, and that will be done in
subsequent commits.

The tests/ subdir will have it's own subdirectories for different
classes of tests. Initially, there will be a per-FSTYP subdirectory
for filesytsem specific tests, and a generic directory for tests
that span multiple filesystems.

Each class will have it's own group file to indicate what groups the
tests belong to, and these will be parsed appropriately by the high
level check script to build the test list.

The change in parsing results in the test output also emitting the
path to the test as well as the name of the test, instead of just a
raw number. This allows duplicate test names in the sudirecotries to
be unambiguous when the summary is written out.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Phil White <pwhite@sgi.com>
Signed-off-by: Rich Johnston <rjohnston@sgi.com>
11 years agoxfstests: remove undocumented TESTS_REMAINING_LOG
Dave Chinner [Fri, 15 Mar 2013 12:27:53 +0000 (12:27 +0000)]
xfstests: remove undocumented TESTS_REMAINING_LOG

Undocumented and unused, AFAICT. Kill it.

Reviewed-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Phil White <pwhite@sgi.com>
Signed-off-by: Rich Johnston <rjohnston@sgi.com>
11 years agoxfstests: remove test expunge file support
Dave Chinner [Fri, 15 Mar 2013 12:27:52 +0000 (12:27 +0000)]
xfstests: remove test expunge file support

Check supports an expunge file for tests - a way of marking tests
not to run even if you specify it to run. Use is like this:

$ echo 002 > expunged
test-2:~/src/xfstests-dev$ sudo ./check 001-003
FSTYP         -- xfs (debug)
PLATFORM      -- Linux/x86_64 test-2 3.5.0-rc1-dgc+
MKFS_OPTIONS  -- -f -bsize=4096 /dev/vdb
MOUNT_OPTIONS -- /dev/vdb /mnt/scratch

001 4s ... 4s
002 - expunged
003 0s ... 0s
Ran: 001 002 003
Not run:1
Passed all 2 tests

This is arguably useful(*), but gets in the way of splitting up the
tests into multiple directories. Remove it for now, but such
functionality should be considered for re-implementation at a later
date.

(*) e.g. having a different "expunged" file for each distro release
you have to test to avoid the tests known to fail due to fixes or
features that will never be back ported to older releases....

Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Phil White <pwhite@sgi.com>
Signed-off-by: Rich Johnston <rjohnston@sgi.com>
11 years agoxfstests: kill hangcheck stuff from check
Dave Chinner [Fri, 15 Mar 2013 12:27:51 +0000 (12:27 +0000)]
xfstests: kill hangcheck stuff from check

This is an old script from the auto-qa days back at SGI. It no
longer is in use or, AFAIK, ever been used for xfstests. If anyone
needs it, they can pull it back out of git, so lets remove it to
simplify check.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Phil White <pwhite@sgi.com>
Signed-off-by: Rich Johnston <rjohnston@sgi.com>
11 years agoxfstests: clean up and simply check CLI option parsing
Dave Chinner [Fri, 15 Mar 2013 12:27:50 +0000 (12:27 +0000)]
xfstests: clean up and simply check CLI option parsing

The options are parsed in a messy loop of option parsing and
actions on secondary arguments. Turn it into something much neater
and easy to understand rather than a mess of temporary variables
and tortured logic...

Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Phil White <pwhite@sgi.com>
[rjohnston@sgi.com fixed typos in commit message]
Signed-off-by: Rich Johnston <rjohnston@sgi.com>
11 years agoxfstests: fold common into check
Dave Chinner [Fri, 15 Mar 2013 12:27:49 +0000 (12:27 +0000)]
xfstests: fold common into check

There is only one user of the common file now - check. Fold the two
into one file as the split of functionality is not necessary
anymore.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Phil White <pwhite@sgi.com>
Signed-off-by: Rich Johnston <rjohnston@sgi.com>
11 years agoxfstests: remove stale machine configs
Dave Chinner [Fri, 15 Mar 2013 12:27:48 +0000 (12:27 +0000)]
xfstests: remove stale machine configs

Left over from the days of ASG, all stale. Remove them, leaving just
an simple example that defines all the variables that can be
configured. Also, add a localhost defined config set up for simple
KVM based guest test configs using virtio for their block devices to
simplify test setup in such scenarios..

Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Phil White <pwhite@sgi.com>
Signed-off-by: Rich Johnston <rjohnston@sgi.com>
11 years agoxfstests: kill useless test owner fields
Dave Chinner [Fri, 15 Mar 2013 12:27:47 +0000 (12:27 +0000)]
xfstests: kill useless test owner fields

Back many years ago, the owner field was used to email the test
owner when auto-qa failed that test. It is not needed anymore - if
you want to know who wrote the test, look it up in git....

Script used was:

$ sed -i -e "/^# creator/d" -e "/^owner/d" [0-3][0-9][0-9]

Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Phil White <pwhite@sgi.com>
[rjohnston@sgi.com added TOT changes]
Signed-off-by: Rich Johnston <rjohnston@sgi.com>
11 years agoxfstests: remove bench infrastructure
Dave Chinner [Fri, 15 Mar 2013 12:27:46 +0000 (12:27 +0000)]
xfstests: remove bench infrastructure

The benchmark framework inside xfstests is basically unused,
bitrotted and not very useful. If we need benchmarks, lets use a
real benchmark framework, not xfstests. Kill it to remove
dependencies on common and common.rc.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Phil White <pwhite@sgi.com>
Signed-off-by: Rich Johnston <rjohnston@sgi.com>
11 years agoxfstests: remove remake script
Dave Chinner [Fri, 15 Mar 2013 12:27:45 +0000 (12:27 +0000)]
xfstests: remove remake script

We don't ever do wholesale rebuilds of the output files anymore, so
kill the script that does it to reduce the dependency on common and
common.rc.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Phil White <pwhite@sgi.com>
Signed-off-by: Rich Johnston <rjohnston@sgi.com>
11 years agoxfstests: fix the seq number in README
Zhi Yong Wu [Sat, 23 Mar 2013 13:29:51 +0000 (13:29 +0000)]
xfstests: fix the seq number in README

Although it is one very trivial bug, one patch is worth to
make it perfect.

Signed-off-by: Zhi Yong Wu <wuzhy@linux.vnet.ibm.com>
Reviewed-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Rich Johnston <rjohnston@sgi.com>
11 years agoxfstests 276: use _require_no_large_scratch_dev instead of the removed _require_nobig...
Wang Sheng-Hui [Thu, 21 Mar 2013 06:13:23 +0000 (06:13 +0000)]
xfstests 276: use _require_no_large_scratch_dev instead of the removed _require_nobigloopfs

_require_nobigloopfs has been removed.
We should use _require_no_large_scratch_dev in the test script.

Signed-off-by: Wang Sheng-Hui <shhuiw@gmail.com>
Reviewed-by: Rich Johnston <rjohnston@sgi.com>
Signed-off-by: Rich Johnston <rjohnston@sgi.com>
11 years agoxfstests: count journal size in test 289
Jan Kara [Wed, 20 Mar 2013 10:50:48 +0000 (10:50 +0000)]
xfstests: count journal size in test 289

Test 289 ignored the fact that historically journal is not accounted as
fs overhead in ext3. For larger filesystems it is hidden in 1% tolerance
but for filesystems smaller than 12G the test fails. So make the
counting precise to work everywhere.

CC: Eric Sandeen <sandeen@sandeen.net>
Signed-off-by: Jan Kara <jack@suse.cz>
Reviewed-by: Eric Sandeen <sandeen@redhat.com>
[rjohnston@sgi.com: add lower case units to filter]
Signed-off-by: Rich Johnston <rjohnston@sgi.com>
11 years agoxfstests: add background noise to test 276 (btrfs backref resolving)
Jan Schmidt [Tue, 19 Mar 2013 16:24:20 +0000 (16:24 +0000)]
xfstests: add background noise to test 276 (btrfs backref resolving)

The backref resolver test for btrfs was run on a static file system so far.
Resolving backrefs on a busy file system is what happens in reality and that
is what should be checked by this test.

I added a parameter such that the script can easily be changed to the former
behavior for development purposes.

Furthermore, this increases two constants which make the test simply cycle a
few seconds longer, increasing the chance to hit on something suspicious in
case we broke something.

Signed-off-by: Jan Schmidt <list.btrfs@jan-o-sch.net>
Reviewed-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Rich Johnston <rjohnston@sgi.com>
11 years agoxfstests: correct quota file count for --large-fs
Dave Chinner [Fri, 15 Mar 2013 11:53:31 +0000 (11:53 +0000)]
xfstests: correct quota file count for --large-fs

The files used to fill space when using --large-fs contribute
towards the quota of uid 0. Modify the quota output filter in test
050 to "hide" these files from the test output.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Rich Johnston <rjohnston@sgi.com>
Signed-off-by: Rich Johnston <rjohnston@sgi.com>
11 years agoxfstests: filter files in 019 for --large-fs
Dave Chinner [Fri, 15 Mar 2013 11:53:30 +0000 (11:53 +0000)]
xfstests: filter files in 019 for --large-fs

Make sure that the .use_space files don't appear in the files dumped
to the output files.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Rich Johnston <rjohnston@sgi.com>
Signed-off-by: Rich Johnston <rjohnston@sgi.com>
11 years agoxfstests: exclude largefs fill files from dump tests
Dave Chinner [Fri, 15 Mar 2013 11:53:29 +0000 (11:53 +0000)]
xfstests: exclude largefs fill files from dump tests

The xfsdump/restore tests will see the space filling files and may
try to back them up and restore them, consuming huge amounts of time
to do (especially when diffing the results). Exclude the space
filling files by setting the no dump attributes on them and ensure
that xfsdump runs with the -e flag to exclude such files.

This also needs a dump filter addition to remove the output that
files were skipped, and to decrement the count of files processed by
xfsrestore because the inventory still includes excluded files.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Rich Johnston <rjohnston@sgi.com>
Signed-off-by: Rich Johnston <rjohnston@sgi.com>
11 years agoxfstests: disable tests that typically fail on large filesystems
Dave Chinner [Fri, 15 Mar 2013 11:53:28 +0000 (11:53 +0000)]
xfstests: disable tests that typically fail on large filesystems

Test 017 typically fails due to the OOM killer kicking in and
killing everything but xfs_db so panics the machine.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Rich Johnston <rjohnston@sgi.com>
Signed-off-by: Rich Johnston <rjohnston@sgi.com>
11 years agoxfstests: enable large fs testing on ext4
Dave Chinner [Fri, 15 Mar 2013 11:53:27 +0000 (11:53 +0000)]
xfstests: enable large fs testing on ext4

Now that setting up large filesystem testing on sparse loopback
devices uses a generic method for filling the filesystem, extent
support to ext4 filesystems.

ext4 is slightly more complex to fill as it does not support files
larger than 16TB. Hence a slightly more complex method of using
multiple smaller files to fill the space is necessary.

WARNING: be prepared for ext4 to take forever to prepare large
filesystems as allocation of large amounts of space (especially as
it approaches ENOSPC) is can take minutes rather than milliseconds

Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Rich Johnston <rjohnston@sgi.com>
Signed-off-by: Rich Johnston <rjohnston@sgi.com>
11 years agoxfstests: always use test option when checking large scratch device
Dave Chinner [Fri, 15 Mar 2013 11:53:26 +0000 (11:53 +0000)]
xfstests: always use test option when checking large scratch device

Some tests call _check_scratch_device directly and when using a
large filesystem this needs to run with a -t option to avoid
consuming large amounts of memory. Make this happen in all cases
that the scratch device is checked.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Rich Johnston <rjohnston@sgi.com>
Signed-off-by: Rich Johnston <rjohnston@sgi.com>
11 years agoxfstest: enable xfs_repair for large filesystem testing
Dave Chinner [Fri, 15 Mar 2013 11:53:25 +0000 (11:53 +0000)]
xfstest: enable xfs_repair for large filesystem testing

Now that large filesystem testing does not play free space games to
fill the space without IO, we can enable xfs_repair when running in
this mode. xfs_repair has had it's scalability problems solved, too,
so this is a safe thing to do.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Rich Johnston <rjohnston@sgi.com>
Signed-off-by: Rich Johnston <rjohnston@sgi.com>
11 years agoxfstests: use command line option for setting extra space
Dave Chinner [Fri, 15 Mar 2013 11:53:24 +0000 (11:53 +0000)]
xfstests: use command line option for setting extra space

Allow the extra free space to leave in large scratch filesystems to
be specified by a command line option rather than just via an
environment variable.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Rich Johnston <rjohnston@sgi.com>
Signed-off-by: Rich Johnston <rjohnston@sgi.com>
11 years agoxfstests: use preallocation for ag-wiper
Dave Chinner [Fri, 15 Mar 2013 11:53:23 +0000 (11:53 +0000)]
xfstests: use preallocation for ag-wiper

To enable sane testing of large scale filesystems, the --large-fs
test option uses xfs_db magic to mark AGs full without doing any IO.
This leaves only a small amount of free space left in the filesystem
to stress the high AGs of the filesystem rather than the low AGs.

This method requires us to have special filesystem check options to
avoid free space checking in xfs_check, and we cannot current run
xfs_repair on such a filesystem at all. As it is, free space
checking on xfs_check does not scale, so we still need to avoid this
checking regardless of how we fill the filesystem.

We can achieve exactly the same fill behavior by preallocating a
single large file in the filesystem immediately after creating it.
This is a filesystem independent manner of filling the filesystem,
and allows us to do large filesystem testing on more than just XFS.

Further, this preallocation method effectively adds a new "very
large file" test. It also enables us to run an unmodified xfs_repair
or filesystem specific fsck program to check the filesystem for
sanity, so we can now do full sanity checking of such large
filesystems.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Rich Johnston <rjohnston@sgi.com>
Signed-off-by: Rich Johnston <rjohnston@sgi.com>
11 years agoxfstests: rename RETAIN_AG_BYTES
Dave Chinner [Fri, 15 Mar 2013 11:53:22 +0000 (11:53 +0000)]
xfstests: rename RETAIN_AG_BYTES

Rename the $RETAIN_AG_BYTES variable to be more generic so that it
reflects the fact that it is designed to retain a certain amount of
extra free space above the default amount in the filesystem when
doing large scratch device testing.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Rich Johnston <rjohnston@sgi.com>
Signed-off-by: Rich Johnston <rjohnston@sgi.com>
11 years agoxfstests: rename USE_BIG_LOOPFS to be more generic
Dave Chinner [Fri, 15 Mar 2013 11:53:21 +0000 (11:53 +0000)]
xfstests: rename USE_BIG_LOOPFS to be more generic

USE_BIG_LOOPFS is really misnamed - it can be used on real devices just as
easily as loop devices. It really means we are testing a large scratch device
and that we should enable the special filesystem filling and checking options
that enable xfstests to be run sanely on large XFS filesystems.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Rich Johnston <rjohnston@sgi.com>
Signed-off-by: Rich Johnston <rjohnston@sgi.com>
11 years agoxfstests: add --largefs check option
Dave Chinner [Fri, 15 Mar 2013 11:53:20 +0000 (11:53 +0000)]
xfstests: add --largefs check option

Make it easier to check large filesystems quickly by adding a
--large-fs option to check to turn on shortcuts for large scratch
device filesystem testing.

Also, reject invalid command line options with a usage message.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Rich Johnston <rjohnston@sgi.com>
Signed-off-by: Rich Johnston <rjohnston@sgi.com>
11 years agoxfstests: filter new repair/mkfs output for CRCs
Dave Chinner [Fri, 15 Mar 2013 11:53:19 +0000 (11:53 +0000)]
xfstests: filter new repair/mkfs output for CRCs

This patch it to ensure that xfstests passes on non-crc filesystems
with a CRC enabled userspace.

Filter out the mkfs/xfs_info CRC line from tests that capture the
output of these commands.

Filter out new error noise from xfs_repair that occurs for
xfs_repair as a result of the CRC changes.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Rich Johnston <rjohnston@sgi.com>
Signed-off-by: Rich Johnston <rjohnston@sgi.com>
11 years agoxfstests: btrfs tests for basic informational commands
Eric Sandeen [Wed, 13 Mar 2013 19:01:58 +0000 (19:01 +0000)]
xfstests: btrfs tests for basic informational commands

Run basic btrfs information commands in various ways, performing
sanity tests of: filesystem show, label, sync, and device stats
(sync is included just because it's simple).  These are mostly
just smoke tests, although for example show by label & UUID
should verify that the correct fs was shown.

This also adds quite a few new filters to accommodate the output
of the new commands.

Cc: linux-btrfs@vger.kernel.org
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Reviewed-by: Stefan Behrens <sbehrens@giantdisaster.de>
Signed-off-by: Rich Johnston <rjohnston@sgi.com>
11 years agoRevert "xfstests: btrfs tests for basic informational commands"
Rich Johnston [Tue, 19 Mar 2013 13:13:12 +0000 (08:13 -0500)]
Revert "xfstests: btrfs tests for basic informational commands"

This reverts commit 2730c49a3e80426167e6f9984b070883dc51d4b6.

Test number was not sequential.

Conflicts:

group

11 years agoxfstests: enable test 032 (mkfs overwrite) for btrfs
Eric Sandeen [Wed, 13 Mar 2013 16:01:00 +0000 (16:01 +0000)]
xfstests: enable test 032 (mkfs overwrite) for btrfs

Now that btrfs has an "-f" arg, we can test that it doesn't
improperly overwrite other filesystems in 032 like we do
for xfs.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Reviewed-by: Rich Johnston <rjohnston@sgi.com>
Signed-off-by: Rich Johnston <rjohnston@sgi.com>
11 years agoxfstests: test writing to device node on an RO filesystem
Eric Sandeen [Fri, 15 Mar 2013 02:37:34 +0000 (02:37 +0000)]
xfstests: test writing to device node on an RO filesystem

We should be able to open device nodes for writing even
if they live on a readonly filesytem.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Rich Johnston <rjohnston@sgi.com>
Signed-off-by: Rich Johnston <rjohnston@sgi.com>
11 years agoxfstests: btrfs tests for basic informational commands
Eric Sandeen [Wed, 13 Mar 2013 19:01:58 +0000 (19:01 +0000)]
xfstests: btrfs tests for basic informational commands

Run basic btrfs information commands in various ways, performing
sanity tests of: filesystem show, label, sync, and device stats
(sync is included just because it's simple).  These are mostly
just smoke tests, although for example show by label & UUID
should verify that the correct fs was shown.

This also adds quite a few new filters to accommodate the output
of the new commands.

Cc: linux-btrfs@vger.kernel.org
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Reviewed-by: Stefan Behrens <sbehrens@giantdisaster.de>
Signed-off-by: <rjohnston@sgi.com>
11 years agoxfstests: keep newlines out of SCRATCH_DEV_POOL
Eric Sandeen [Wed, 13 Mar 2013 14:57:02 +0000 (14:57 +0000)]
xfstests: keep newlines out of SCRATCH_DEV_POOL

SCRATCH_DEV_POOL processing actually takes the first
device out for SCRATCH_DEV and leaves the rest in
SCRATCH_DEV_POOL.

I'm not totally sold on that behavior, but for now,
at least don't populate SCRATCH_DEV_POOL with newlines.

Cc: linux-btrfs@vger.kernel.org
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Reviewed-by: <rjohnston@sgi.com>
Signed-off-by: <rjohnston@sgi.com>
11 years agoxfstests: add 274 to the prealloc group
Eric Sandeen [Wed, 13 Mar 2013 14:57:01 +0000 (14:57 +0000)]
xfstests: add 274 to the prealloc group

test 274 does preallocation tests but is not in the prealloc group.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Reviewed-by: <rjohnston@sgi.com>
Signed-off-by: <rjohnston@sgi.com>
11 years agoxfstests: determine path of logger
David Sterba [Mon, 11 Mar 2013 23:36:52 +0000 (23:36 +0000)]
xfstests: determine path of logger

The path of the syslog writer utility 'logger' is hardcoded and not
always correct, use set_prog_path.

Signed-off-by: David Sterba <dsterba@suse.cz>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Rich Johnston <rjohnston@sgi.com>
11 years agoxfstests, aio-dio-extend-stat.c: fix error reporting
Jeff Moyer [Fri, 18 Jan 2013 22:01:57 +0000 (22:01 +0000)]
xfstests, aio-dio-extend-stat.c: fix error reporting

If we receive an unexpected result from an async write, the error
reporting does not tell the actual number of bytes written.  Fix that,
and also a couple of typos in printf's.

Signed-off-by: Jeff Moyer <jmoyer@redhat.com>
Reviewed-by: Rich Johnston <rjohnston@sgi.com>
Signed-off-by: Rich Johnston <rjohnston@sgi.com>
11 years agoxfstests 273: fix a typo
Wang Sheng-Hui [Wed, 27 Feb 2013 06:47:54 +0000 (06:47 +0000)]
xfstests 273: fix a typo

Make the porter log cp failure into $seq.full by appending, not overwriting,
which can help debug.

Signed-off-by: Wang Sheng-Hui <shhuiw@gmail.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Rich Johnston <rjohnston@sgi.com>
11 years agoRevert "xfstests 273: fix a typo"
Rich Johnston [Thu, 7 Mar 2013 15:21:30 +0000 (09:21 -0600)]
Revert "xfstests 273: fix a typo"

This reverts commit 0c5e67e46e476b70290033efc7feb784f7ecbab1.
Will re-apply the correct patch.

11 years agoxfstests: Fix hang when mkfs.btrfs isn't present
Eric Sandeen [Tue, 5 Mar 2013 22:41:54 +0000 (22:41 +0000)]
xfstests: Fix hang when mkfs.btrfs isn't present

My earlier patch (xfstests: handle new mkfs.btrfs -f option cleanly)
had a flaw in that if set_prog_path mkfs.btrfs returns nothing,
the grep will hang.

Test for that case to avoid it, and just return the empty string
in that case.

Reported-by: Rich Johnston <rjohnston@sgi.com>
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Reviewed-by: Rich Johnston <rjohnston@sgi.com>
Signed-off-by: Rich Johnston <rjohnston@sgi.com>
11 years agoxfstests: make length of diff output configurable
David Sterba [Wed, 23 Jan 2013 11:14:33 +0000 (11:14 +0000)]
xfstests: make length of diff output configurable

In commit 11c1d79414e2571 "xfstests: Change the diff output of failed
tests", the diff output of a failed test was hardcoded to 10 lines to
avoid overly long output and user can get the full output by manually
running the diff. However this is not always possible and convenient,
eg. in repeated automated tests where the required information is lost
after the test round finished. Then the caputred logs do not contain
enough informatin for analysis.

Introduce the DIFF_LENGTH env variable to tune the diff size, keeping it
10 as deafult and 0 to disable the limit.

Signed-off-by: David Sterba <dsterba@suse.cz>
Reviewed-by: Ben Myers <bpm@sgi.com>
Signed-off-by: Rich Johnston <rjohnston@sgi.com>
11 years agoxfstests: handle new mkfs.btrfs -f option cleanly
Eric Sandeen [Tue, 26 Feb 2013 20:42:38 +0000 (20:42 +0000)]
xfstests: handle new mkfs.btrfs -f option cleanly

I added an "-f" option to mkfs.btrfs to force overwrite
of an existing filesystem.  Now on an xfstests run, new
mkfs.btrfs requires it, and old mkfs.btrfs cannot accept
it.

So, add a helper which works out whether -f is needed,
and add it to the MKFS_BTRFS_PROG env. var as necessary,
so that it is an always-included option during the tests.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Reviewed-by: Rich Johnston <rjohnston@sgi.com>
Signed-off-by: Rich Johnston <rjohnston@sgi.com>
11 years agoxfstests: use native definition of O_DIRECT flag
Eric Whitney [Tue, 26 Feb 2013 21:03:22 +0000 (21:03 +0000)]
xfstests: use native definition of O_DIRECT flag

The definition of O_DIRECT in src/trunc.c causes xfstest 125 to fail
when run on a Pandaboard.  On ARM, the value used (0x040000) is
O_DIRECTORY rather than O_DIRECT as it is on x86.  Prefer the platform's
native definition of O_DIRECT supplied by fcntl.h if available.  Also,
fix a couple of error messages to properly reflect their context.

Signed-off-by: Eric Whitney <enwlinux@gmail.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Rich Johnston <rjohnston@sgi.com>
11 years agoxfstests: don't remove trailing zeros from integers
Eric Whitney [Tue, 5 Mar 2013 19:17:48 +0000 (19:17 +0000)]
xfstests: don't remove trailing zeros from integers

_within_tolerance strips trailing zeros from the min and max range
values it outputs.  This leads to damage if the min or max value is
an integer containing trailing zeros rather than a real number with
a fractional part containing trailing zeros. Xfstest 289 can exhibit
this problem when its input is out of range.  Modify the code so it
will only remove trailing zeros found after a decimal point.

V1->V2: Remove decimal points not followed by digits
V2->V3: Per Dave Chinner, simplify by using multiple sed expressions

Signed-off-by: Eric Whitney <enwlinux@gmail.com>
Reviewed-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Rich Johnston <rjohnston@sgi.com>
11 years agoxfstests: don't assume that falloc_punch implies falloc in test 255
Theodore Ts'o [Tue, 5 Mar 2013 17:59:42 +0000 (17:59 +0000)]
xfstests: don't assume that falloc_punch implies falloc in test 255

As of Linux 3.9-rc1, ext4 will support the punch operation on file
systems using indirect blocks, but it can not support the fallocate
operation (since there is no way to mark a block as uninitialized
using indirect block scheme).  This caused test 255 to fail, since it
only used _require_xfS_io_falloc_punch assuming that all file systems
which supported punch can also support fallocate.  Fix this.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Reviewed-by: Rich Johnston <rjohnston@sgi.com>
Signed-off-by: Rich Johnston <rjohnston@sgi.com>
11 years agoxfstests 276: fix error 'FIBMAP: Invalid argument'
Wang Sheng-Hui [Thu, 28 Feb 2013 02:05:56 +0000 (02:05 +0000)]
xfstests 276: fix error 'FIBMAP: Invalid argument'

Commit 05dadc0 ("Btrfs: add fiemap's flag check") added validity
checks to the fiemap flags and hence invalid flags are now being
rejected. Test 276 passes an invalid fiemap flag to btrfs, and so
that test fails since this commit was added.

Btrfs doesn't support FIEMAP_FLAG_XATTR, which is enabled by -x option
of filefrag, and will fail with
'FIBMAP: Invalid argument'
for 'filefrag -vx'. 'filefrag -vx' fails on btrfs with
     'FIEMAP failed with unsupported flags 2'
Remove the '-x' option.

Signed-off-by: Wang Sheng-Hui <shhuiw@gmail.com>
Reviewed-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Rich Johnston <rjohnston@sgi.com>
11 years agoxfstests 273: fix a typo
Wang Sheng-Hui [Wed, 27 Feb 2013 06:47:54 +0000 (06:47 +0000)]
xfstests 273: fix a typo

Make the porter log cp failure into $seq.full by appending, not overwriting,
which can help debug.

Signed-off-by: Wang Sheng-Hui <shhuiw@gmail.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Rich Johnston <rjohnston@sgi.com>
11 years agoxfstests: use right defrag program path
Zheng Liu [Fri, 1 Mar 2013 14:17:13 +0000 (14:17 +0000)]
xfstests: use right defrag program path

In _require_defrag defragmentation command path is fixed.  That will
cause that this test case is skipped in some distributions.

Signed-off-by: Zheng Liu <wenqing.lz@taobao.com>
Reviewed-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Rich Johnston <rjohnston@sgi.com>
11 years agoxfstests: add disk failure simulation test
Dmitry Monakhov [Wed, 20 Feb 2013 10:42:15 +0000 (10:42 +0000)]
xfstests: add disk failure simulation test

There are many situations where disk may fail for example
1) brutal usb dongle unplug
2) iscsi (or any other netbdev) failure due to network issues
In this situation filesystem which use this blockdevice is
expected to fail(force RO remount, abort, etc) but whole system
should still be operational. In other words:
1) Kernel should not panic
2) Memory should not leak
3) Data integrity operations (sync,fsync,fdatasync, directio) should fail
   for affected filesystem
4) It should be possible to umount broken filesystem

Later when disk becomes available again we expect(only for journaled filesystems):
5) It will be possible to mount filesystem w/o explicit fsck (in order to catch
   issues like https://patchwork.kernel.org/patch/1983981/)
6) Filesystem should be operational
7) After mount/umount has being done all errors should be fixed so fsck should
   not spot any issues.

This test use fault injection (CONFIG_FAULT_INJECTION=y,
CONFIG_FAIL_MAKE_REQUEST=y and CONFIG_FAULT_INJECTION_DEBUG_FS=y config
options) to force all new IO requests to fail for a given device. Xfs
already has XFS_IOC_GOINGDOWN ioctl which provides similar behavior, but it
is fs specific and it does it in an easy way because it performs freeze_bdev()
before actual shutdown.

Test run fsstress in background and then force disk failure.
Once disk failed it check that (1)-(4) is true.
Then makes disk available again and check that (5)-(7) is also true

BE CAREFUL!! test known to cause memory corruption for XFS
see: https://gist.github.com/dmonakhov/4953045

Signed-off-by: Dmitry Monakhov <dmonakhov@openvz.org>
Reviewed-by: Rich Johnston <rjohnston@sgi.com>
Signed-off-by: Rich Johnston <rjohnston@sgi.com>
11 years agoxfstest: add defragmentation stress tests for ext4
Dmitry Monakhov [Wed, 20 Feb 2013 10:42:14 +0000 (10:42 +0000)]
xfstest: add defragmentation stress tests for ext4

Perform various regression tests for ext4defrag subsystem

 301'th Test1: Defragment file while other task does direct AIO
 302'th Test2: Perform defragmentation on file under buffered AIO
  while third task does direct AIO to donor file
 303'th Test3: Two defrag tasks use common donor file.
 304'th Test4: Stress defragmentation. Several threads perform
  fragmentation at random position use inplace=1 will
allocate and free blocks inside defrag event improve
load pressure.

This tests are considered dangerous because 302'th and 303'th are known
to trigger OOPS on recent kernels see:https://gist.github.com/dmonakhov/4770294

Signed-off-by: Dmitry Monakhov <dmonakhov@openvz.org>
Reviewed-by: Rich Johnston <rjohnston@sgi.com>
Signed-off-by: Rich Johnston <rjohnston@sgi.com>
11 years agoxfstest: add fallocate/punch_hole vs AIO/DIO stress test
Dmitry Monakhov [Wed, 20 Feb 2013 10:42:13 +0000 (10:42 +0000)]
xfstest: add fallocate/punch_hole vs AIO/DIO stress test

Run random AIO/DIO activity (fio's job:direct_aio_raicer)
random fallocate activity(fio's job:falloc_raicer)
and random punch_hole activity(punch_hole_raicer) on a common
file in parallel. If a race exists, old dio request may rewrite
punched block after it was allocated to another file, we will
catch that by verifier fio's job: "aio-dio-verifier".

Signed-off-by: Dmitry Monakhov <dmonakhov@openvz.org>
Reviewed-by: Rich Johnston <rjohnston@sgi.com>
Signed-off-by: Rich Johnston <rjohnston@sgi.com>
11 years agoxfstest: add fallocate/truncate vs AIO/DIO stress test
Dmitry Monakhov [Wed, 20 Feb 2013 10:42:12 +0000 (10:42 +0000)]
xfstest: add fallocate/truncate vs AIO/DIO stress test

Run DIO, fallocate and truncate threads on a common file in parallel.
If a race exists, the old dio request may rewrite blocks after it was
allocated to another file, we will catch that by verifying blocks content.

this patch known to catch deadlock for ext4
http://lists.openwall.net/linux-ext4/2012/09/06/3

Signed-off-by: Dmitry Monakhov <dmonakhov@openvz.org>
Reviewed-by: Rich Johnston <rjohnston@sgi.com>
Signed-off-by: Rich Johnston <rjohnston@sgi.com>
11 years agoxfstest: move run_check to common.rc
Dmitry Monakhov [Wed, 20 Feb 2013 10:42:11 +0000 (10:42 +0000)]
xfstest: move run_check to common.rc

Signed-off-by: Dmitry Monakhov <dmonakhov@openvz.org>
Reviewed-by: Rich Johnston <rjohnston@sgi.com>
Signed-off-by: Rich Johnston <rjohnston@sgi.com>
Move run_check to common.rc.

11 years agoxfstest: allow fsstress to use load factor where appropriate
Dmitry Monakhov [Wed, 20 Feb 2013 10:42:10 +0000 (10:42 +0000)]
xfstest: allow fsstress to use load factor where appropriate

1) Add _scale_fsstress_args function which transform arguments according
   to load factors
2) Let all non deterministic fsstress tests to use scaled arguments

Signed-off-by: Dmitry Monakhov <dmonakhov@openvz.org>
Reviewed-by: Rich Johnston <rjohnston@sgi.com>
Signed-off-by: Rich Johnston <rjohnston@sgi.com>
11 years agoxfstests: hardcode fops for determinable fsstests runs
Dmitry Monakhov [Wed, 20 Feb 2013 10:42:08 +0000 (10:42 +0000)]
xfstests: hardcode fops for determinable fsstests runs

106,107 and 117 are frozen tests which use known seed, it is
reasonable to explicitly hardcode file operations in order to avoid
implicit changes caused by future changes in fsstress.

NOTE: options generated like follows: fsstress -S c $ORIG_ARGS

Signed-off-by: Dmitry Monakhov <dmonakhov@openvz.org>
Reviewed-by: Rich Johnston <rjohnston@sgi.com>
Signed-off-by: Rich Johnston <rjohnston@sgi.com>
11 years agoxfstest: add configurable load factors
Dmitry Monakhov [Wed, 20 Feb 2013 10:42:07 +0000 (10:42 +0000)]
xfstest: add configurable load factors

Most stress test has probable behavior, the longer test run the
larger corner cases will be cover. It is reasonable to allow
user to provide some sort of system load factor.
This patch introduce two global variables
LOAD_FACTOR: Usually means factor number of running tasks
TIME_FACTOR: Usually means factor of run time, or number of operations
If not specified both variables defined to 1, so original behavior
preserved.

TODO: Change all stress tests to use this variables

Signed-off-by: Dmitry Monakhov <dmonakhov@openvz.org>
Reviewed-by: Rich Johnston <rjohnston@sgi.com>
Signed-off-by: Rich Johnston <rjohnston@sgi.com>
11 years agoxfstests: add fio requirement V2
Dmitry Monakhov [Wed, 20 Feb 2013 10:42:06 +0000 (10:42 +0000)]
xfstests: add fio requirement V2

FIO is very flexible io generator, I would call it IO swiss knife.
Currently we have tons of hardcoded application which reproduces
some predefined scenario. This approach has obvious disadvantages
1) Lack of flexibility: one written it is hard to modify it in future
2) Code base is large, many routines written again and again

At the same time add new fio based test, just add simple INI file.
This greatly simplifies code review. I do believe that some day we will
replace most of hardcoded io binaries with fio.

One who is planning to run $FIO_PROG should first check that system
contains appropriate version which is able to handle jobfile
for example:  _require_fio 286-job.fio

Signed-off-by: Dmitry Monakhov <dmonakhov@openvz.org>
Reviewed-by: Rich Johnston <rjohnston@sgi.com>
Signed-off-by: Rich Johnston <rjohnston@sgi.com>
11 years agoxfstests: 298: Test that FS sends discard requests only on free blocks
Tomas Racek [Sun, 3 Feb 2013 10:19:58 +0000 (10:19 +0000)]
xfstests: 298: Test that FS sends discard requests only on free blocks

V1->V2: Change way of testing suggested by Dave Chinner
1. Create image file with FS on it
2. Call fstrim to discard free blocks
3. Check that every punched hole in the image file is in the area
   that is marked as free

Signed-off-by: Tomas Racek <tracek@redhat.com>
Reviewed-by: Rich Johnston <rjohnston@sgi.com>
Signed-off-by: Rich Johnston <rjohnston@sgi.com>
11 years agoxfstests: Add new standard loop handling functions
Tomas Racek [Tue, 12 Feb 2013 09:21:59 +0000 (09:21 +0000)]
xfstests: Add new standard loop handling functions

Add _create_loop_device and _destroy_loop_device to uniformly handle
loopback devices.

V1->V2: Fix possible race

Signed-off-by: Tomas Racek <tracek@redhat.com>
Reviewed-by: Rich Johnston <rjohnston@sgi.com>
Signed-off-by: Rich Johnston <rjohnston@sgi.com>
11 years agoxfstests: Provide dumpe2fs via standard common.config interface
Tomas Racek [Sun, 3 Feb 2013 10:19:56 +0000 (10:19 +0000)]
xfstests: Provide dumpe2fs via standard common.config interface

dumpe2fs can be now accessed via $DUMPE2FS_PROG, tests that require it
can check for its availability by _require_dumpe2fs function.

Signed-off-by: Tomas Racek <tracek@redhat.com>
Reviewed-by: Ben Myers <bpm@sgi.com>
Signed-off-by: Rich Johnston <rjohnston@sgi.com>
11 years agoxfstests 297: test xfs direct IO nested transaction deadlock
Eryu Guan [Tue, 19 Feb 2013 04:15:28 +0000 (12:15 +0800)]
xfstests 297: test xfs direct IO nested transaction deadlock

Regression test case for commit:

437a255 xfs: fix direct IO nested transaction deadlock.

Signed-off-by: Eryu Guan <eguan@redhat.com>
Reviewed-by: Ben Myers <bpm@sgi.com>
Signed-off-by: Ben Myers <bpm@sgi.com>
11 years agoxfstests: Refactor release scripts to conform to using git archive
Andrew Dahl [Mon, 14 Jan 2013 18:17:09 +0000 (12:17 -0600)]
xfstests: Refactor release scripts to conform to using git archive

Refactored release scripts to conform to using git archive

When generating a release, there is a risk of some files being
stale, such as configure and the m4/autotools temp files. This
is fixed with a clean at the beginning of release generation.
In addition, there is no uniformity in the current method of
source tar generation between xfs utilities. Using git archive
solves this issue across all utilities.

Signed-off-by: Andrew Dahl <adahl@sgi.com>
Reviewed-by: Ben Myers <bpm@sgi.com>
Signed-off-by: Ben Myers <bpm@sgi.com>
11 years agoxfstests: test dump/restore of file capabilities
Eric Sandeen [Fri, 4 Jan 2013 00:05:23 +0000 (18:05 -0600)]
xfstests: test dump/restore of file capabilities

xfsrestore isn't properly restoring file capabilities; it restores
them, but then chowns the file, which removes the caps:

Call Trace:
 [<ffffffffa028de68>] xfs_xattr_set+0x118/0x120 [xfs]
 [<ffffffff8119a8c0>] generic_removexattr+0x80/0x90
 [<ffffffff8120b408>] cap_inode_killpriv+0x28/0x30
 [<ffffffff8120c666>] security_inode_killpriv+0x16/0x20
 [<ffffffff81192edf>] notify_change+0x18f/0x330
 [<ffffffff81176b70>] chown_common+0x60/0xa0
 [<ffffffff81176c30>] sys_fchown+0x80/0xd0
 [<ffffffff81537c59>] system_call_fastpath+0x16/0x1b

This test demonstrates the problem.

Reported-by: fugazzi® <fugazzi99@gmail.com>
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Reviewed-by: Ben Myers <bpm@sgi.com>
Signed-off-by: Ben Myers <bpm@sgi.com>
11 years agoxfstests: SGI license update for looptest.c
Andrew Dahl [Tue, 8 Jan 2013 18:23:08 +0000 (12:23 -0600)]
xfstests: SGI license update for looptest.c

Updated SGI license in looptest.c

Signed-off-by: Andrew Dahl <adahl@sgi.com>
Reviewed-by: Ben Myers <bpm@sgi.com>
Signed-off-by: Ben Myers <bpm@sgi.com>
11 years agoxfstests: test multiply-logged inodes & continued transactions
Eric Sandeen [Wed, 2 Jan 2013 22:28:32 +0000 (16:28 -0600)]
xfstests: test multiply-logged inodes & continued transactions

New test for 2 xfs_logprint error cases:

As xlog_print_trans_inode() stands today, it will error
out if more than one flag is set on f->ilf_fields:

xlog_print_trans_inode: illegal inode type

but this is a perfectly valid case, to have i.e. a data and
an attr flag set.

and:

xlog_print_trans_inode() has a special case for 2
specific op_head->oh_len lengths.  If it matches
sizeof(xfs_inode_log_format_32_t) or
sizeof(xfs_inode_log_format_64_t), it assumes that
it's got an inode, and attempts to convert it and
print it accordingly.

However, if we arrive here via an op header which
is continued, then the length is simply a continuation
of the previous op, and it might *randomly* match the
size of one of the inode log formats, and thus get parsed
incorrectly.

Test both of these cases.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Reviewed-by: Ben Myers <bpm@sgi.com>
Signed-off-by: Ben Myers <bpm@sgi.com>
11 years agoxfstests: Change the interpreter of ltp/runtest.sh to bash
Satoru Takeuchi [Sun, 9 Dec 2012 23:37:41 +0000 (08:37 +0900)]
xfstests: Change the interpreter of ltp/runtest.sh to bash

In some environment, Running 080 fails with many errors.

It happens because ltp/rwtest.sh assumes /bin/sh is `bash' and it's not
always true (ex. /bin/sh is `dash' in Debian.) This script should
explicitly declare that its interpreter is `bash'.

Signed-off-by: Satoru Takeuchi <takeuchi_satoru@jp.fujitsu.com>
Reviewed-by: Ben Myers <bpm@sgi.com>
Signed-off-by: Ben Myers <bpm@sgi.com>
11 years agoxfstests: fix 284 ENOENT error
Liu Bo [Sun, 6 Jan 2013 14:30:38 +0000 (22:30 +0800)]
xfstests: fix 284 ENOENT error

284 misses a 'mkdir' operation.

Signed-off-by: Liu Bo <liub.liubo@gmail.com>
Reviewed-by: Ben Myers <bpm@sgi.com>
Signed-off-by: Ben Myers <bpm@sgi.com>
11 years agoxfstests: test EROFS vs. EEXIST when creating on an RO filesystem
Eric Sandeen [Wed, 9 Jan 2013 16:17:59 +0000 (10:17 -0600)]
xfstests: test EROFS vs. EEXIST when creating on an RO filesystem

TBH, I don't know if this is posix-specified, but I found out the
hard way that when trying to re-create existing files on a readonly
filesystem, some apps expect/handle EEXIST, but fail on EROFS.

This will test mkdir, mknod, and symlinks for that behavior.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Ben Myers <bpm@sgi.com>
11 years agoxfstests: move _filter_ln to common.filter
Eric Sandeen [Wed, 9 Jan 2013 16:13:26 +0000 (10:13 -0600)]
xfstests: move _filter_ln to common.filter

Move test 103's _filter_ln to common.filter and make
it more generic (not depending on 103's pathnames).

TBH I've lost my children's treasury of ln failure
messages, so I'm not sure this catches all variants;
it's hard to work backwards from the existing sed script
to what the various outputs were.  This works for me
but might need more tweaking on other systems.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Ben Myers <bpm@sgi.com>
11 years agoxfstests: Change the diff output of failed tests
Lukas Czerner [Tue, 10 Apr 2012 08:38:33 +0000 (10:38 +0200)]
xfstests: Change the diff output of failed tests

Currently the entire diff is printed to the stdout in the case that the
test output template differs from the actual test run. However in some
cases the diff can be _very_ long. This commit changes it so that we
print only first 10 lines of the diff.

Also indent the diff output from the left by four spaces for better
output readability.

Signed-off-by: Lukas Czerner <lczerner@redhat.com>
Reviewed-by: Ben Myers <bpm@sgi.com>
Signed-off-by: Ben Myers <bpm@sgi.com>
11 years agoxfstests: ensure all xfs_io commands are documented in the manpage
Eric Sandeen [Sat, 8 Dec 2012 20:58:55 +0000 (20:58 +0000)]
xfstests: ensure all xfs_io commands are documented in the manpage

Ensure that all commands listed in "xfs_io -c help" are
documented in the xfs_io(8) manpage.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Reviewed-by: Mark Tinguely <tinguely@sgi.com>
Signed-off-by: Mark Tinguely <tinguely@sgi.com>
11 years agoxfstests: Ensure cmdline geometry puts mkfs.xfs into multidisk mode
Eric Sandeen [Thu, 6 Dec 2012 22:02:16 +0000 (16:02 -0600)]
xfstests: Ensure cmdline geometry puts mkfs.xfs into multidisk mode

Ensure that when mkfs.xfs is invoked with commandline geometry, it
triggers multidisk mode and creates more AGs.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Ben Myers <bpm@sgi.com>
11 years agoxfstests: Use qa_user and qa_group for test 219
Jan Kara [Tue, 18 Dec 2012 10:35:50 +0000 (11:35 +0100)]
xfstests: Use qa_user and qa_group for test 219

Test 219 requires a special user. Use $qa_user and $qa_group (added in this
patch) for that purpose instead of hardcoded uid & gid. This also fixes
a false failure when repquota does not report quota for users not in passwd.

Signed-off-by: Jan Kara <jack@suse.cz>
Reviewed-by: Ben Myers <bpm@sgi.com>
Signed-off-by: Ben Myers <bpm@sgi.com>