xfstests-dev.git
12 years agoxfstests: delay before dumps for incremental tests
Bill Kendall [Mon, 31 Oct 2011 15:02:57 +0000 (10:02 -0500)]
xfstests: delay before dumps for incremental tests

To get reproducible results when testing incremental backups, files
contained in a backup should not have the same timestamp (at second
resolution) as the backup itself. If they do, those files will also
be included in the incremental backup, and this will likely cause
issues in the expected output of the test. This patch adds a sleep
to test 024 prior to doing the level 0 backup. The other incremental
tests already include similar delays.

Signed-off-by: Bill Kendall <wkendall@sgi.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
12 years agoxfstests: add test 266 for testing xfsdump -D
Bill Kendall [Thu, 3 Nov 2011 10:10:20 +0000 (10:10 +0000)]
xfstests: add test 266 for testing xfsdump -D

Add a test for xfsdump -D, which skips unchanged directories during
an incremental backup. After doing an initial backup, a new file is
added to one directory (to verify that changed directories are
backed up) and several files are appended to. Then an incremental
backup is done with -D set. The test verifies the original and
restored filesystems match after applying the base and incremental
backups, and that the incremental restore output indicates that only
the one changed directory was backed up.

Signed-off-by: Bill Kendall <wkendall@sgi.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
12 years agoxfstests: fsstress should kill children tasks before exit
Dmitry Monakhov [Sat, 29 Oct 2011 00:48:12 +0000 (04:48 +0400)]
xfstests: fsstress should kill children tasks before exit

It is very hard to predict runtime for fsstress. In many cases it
is useful to give test to run a reasonable time, and then kill it.
But currently there is no reliable way to kill test without leaving
running children.
This patch add sanity cleanup logic which looks follow:
 - On sigterm received by parent, it resend signal to it's children
 - Wait for each child to terminates
 - EXTRA_SANITY: Even if parent was killed by other signal, children
   will be terminated with SIGKILL to preven staled children.

So now one can simply run fsstress like this:
./fsstress -p 1000 -n999999999 -d $TEST_DIR &
PID=$!
sleep 300
kill $PID
wait $PID

Signed-off-by: Dmitry Monakhov <dmonakhov@openvz.org>
Signed-off-by: Christoph Hellwig <hch@lst.de>
12 years agoxfstests: add different logging option to fsstress
Dmitry Monakhov [Sat, 29 Oct 2011 00:48:11 +0000 (04:48 +0400)]
xfstests: add different logging option to fsstress

Currently the only way to log fsstress's output is to redirect it's shared
stdout to pipe which is very painfull because:

1) Pipe writers are serialized via i_mutex so we waste cpu-cores power on stupid
   sinchronization for loging purpose, instead of hunting real race conditions,
   and bugs inside file system.
2) Usually output is corrupted due to luck of sychronization on shared stdout.

Since fsstress's children operate on independend paths, let's just open didicated
log file for each child and simply avoid useless sycnhronization.

Signed-off-by: Dmitry Monakhov <dmonakhov@openvz.org>
Signed-off-by: Christoph Hellwig <hch@lst.de>
12 years agoxfstests: fsstress dump inode info when possible
Dmitry Monakhov [Sat, 29 Oct 2011 00:48:10 +0000 (04:48 +0400)]
xfstests: fsstress dump inode info when possible

Fsstress exec behaviour is not completely determinated in case of
low resources mode due to ENOMEM, ENOSPC, etc. In some places we
call stat(2). This information may be halpfull for future
investigations purposes. Let's dump stat info where possible.

Signed-off-by: Dmitry Monakhov <dmonakhov@openvz.org>
Signed-off-by: Christoph Hellwig <hch@lst.de>
12 years ago_populate_fs should use OPTIND when getopts is used
Anand Jain [Thu, 20 Oct 2011 15:41:22 +0000 (23:41 +0800)]
_populate_fs should use OPTIND when getopts is used

Signed-off-by: Anand Jain <Anand.Jain@oracle.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
12 years ago265: Functional test case for the btrfs raid operations
Anand Jain [Thu, 20 Oct 2011 15:41:21 +0000 (23:41 +0800)]
265: Functional test case for the btrfs raid operations

This will verify the various raid features in btrfs and device
replacement functionality.

Signed-off-by: Anand Jain <Anand.Jain@oracle.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
12 years ago264: Functional test case for the btrfs snapshot
Anand Jain [Thu, 20 Oct 2011 15:41:20 +0000 (23:41 +0800)]
264: Functional test case for the btrfs snapshot

Create snapshots in various ways, modify the data around the block and
file boundaries and verify the data integrity.

Signed-off-by: Anand Jain <Anand.Jain@oracle.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
12 years agoAdded SCRATCH_DEV_POOL to specify multiple disks for the btrfs RAID
Anand Jain [Thu, 20 Oct 2011 15:41:19 +0000 (23:41 +0800)]
Added SCRATCH_DEV_POOL to specify multiple disks for the btrfs RAID

SCRATCH_DEV takes single disk as the scratch place for testing. New
SCRATCH_DEV_POOL can used to specify multiple disks for the scratch
btrfs filesystem.

Using SCRATCH_DEV and or SCRATCH_DEV_POOL will follow the following logic.
  btrfs FS OR any FS
    SCRATCH_DEV_POOL is unset and SCRATCH_DEV is set
     . test-case with _require_scratch_dev_pool will not run
     . test-case without _require_scratch_dev_pool will run

    SCRATCH_DEV_POOL is set and SCRATCH_DEV is unset
     . test-case with _require_scratch_dev_pool
         - runs only if FSTYP=btrfs
     . test-case without _require_scratch_dev_pool will run using first
       dev in the SCRATCH_DEV_POOL as a SCRATCH_DEV
         - if FSTYP=btrfs it includes SCRATCH_DEV_POOL disks to the FS
         - if FSTYP=non-btrfs SCRATCH_DEV_POOL is ignored

    SCRATCH_DEV_POOL is set and SCRATCH_DEV is set
     . reports error in the config

    SCRATCH_DEV_POOL is unset and SCRATCH_DEV is unset
     . no change

Signed-off-by: Anand Jain <Anand.Jain@oracle.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
12 years agofill files with random data
Anand Jain [Thu, 20 Oct 2011 15:41:18 +0000 (23:41 +0800)]
fill files with random data

snapshot data integrity test-case needs filesystem with random data.

Signed-off-by: Anand Jain <Anand.Jain@oracle.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
12 years agoxfstests: add missing binaries to .gitignore
Bill Kendall [Fri, 28 Oct 2011 14:53:25 +0000 (09:53 -0500)]
xfstests: add missing binaries to .gitignore

A clean checkout of xfstests followed by a build resulted in a long list
of untracked files. The current .gitignore ignores most binaries, but
the "dmapi" subdir was missed as were some binaries from the "src"
subdir.

Also ".libs" and ".ltdep" appear under a "dmapi" subdir, not just under
the top-level "libs" directory, so ignore those regardless of the
directory they are in.

Signed-off-by: Bill Kendall <wkendall@sgi.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
12 years agoxfstests: 075 112 redirect stderr of fsx to /dev/null too
Eryu Guan [Sun, 30 Oct 2011 02:25:55 +0000 (10:25 +0800)]
xfstests: 075 112 redirect stderr of fsx to /dev/null too

In commit c18bf42de9d5d5fa05025754df1ff63f2147bd12 a warning message
will be printed to stderr if filesystem doesn't support fallocate(2).
The warning message will fail these tests though fsx returns SUCCESS.

FSTYP         -- ext3
PLATFORM      -- Linux/i686 debian-dev 3.1.0+
MKFS_OPTIONS  -- /dev/sda3
MOUNT_OPTIONS -- -o acl,user_xattr /dev/sda3 /mnt/sda3

075 12s ... - output mismatch (see 075.out.bad)
--- 075.out     2011-10-28 21:35:41.872573530 +0800
+++ 075.out.bad 2011-10-30 10:31:02.607058029 +0800
@@ -4,6 +4,9 @@
 -----------------------------------------------
 fsx.0 : -d -N numops -S 0
 -----------------------------------------------
+fsx: main: filesystem does not support fallocate, disabling
+: Operation not supported

So redirect stderr of fsx to /dev/null too.

Signed-off-by: Eryu Guan <guaneryu@gmail.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
12 years ago1.1.0 release v1.1.0
Alex Elder [Fri, 14 Oct 2011 13:42:00 +0000 (08:42 -0500)]
1.1.0 release

Signed-off-by: Alex Elder <aelder@sgi.com>
12 years agoxfstests: prepare for marking an initial versioned release
Alex Elder [Thu, 13 Oct 2011 16:31:04 +0000 (16:31 +0000)]
xfstests: prepare for marking an initial versioned release

Add the release script used in the other XFS user space packages.
The version is set to 1.1.0, to differentiate it from the 1.0.0
version that was recorded in the VERSION file.

Signed-off-by: Alex Elder <aelder@sgi.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
12 years agolimit OP_PUNCH_HOLE operations to the file size
Alex Elder [Fri, 7 Oct 2011 22:41:38 +0000 (22:41 +0000)]
limit OP_PUNCH_HOLE operations to the file size

Before punching a hole in a file, TRIM_OFF_LEN() calls
TRIM_OFF_LEN() in order to make sure the offset and size
used are in a reasonable range.  But currently the range
it's limited to is maxfilelen, which allows the offset
(and therefore offset + len) to be beyond EOF.

Later, do_punch_hole() ignores any request that starts beyond
EOF, so we might as well limit requests to the file size.

It appears that a hole punch request that starts within a
file but whose length extends beyond it is treated simply
as a hole punch up to EOF.  So there's no harm in limiting
the end of a hole punch request to the file size either.

Therefore, use TRIM_OFF_LEN() to put both the the offset
and length of a request within the file size for hole
punch requests.

Signed-off-by: Alex Elder <aelder@sgi.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
12 years agosimplify TRIM_OFF_LEN() in "ltp/fsx.c"
Alex Elder [Wed, 21 Sep 2011 20:17:51 +0000 (15:17 -0500)]
simplify TRIM_OFF_LEN() in "ltp/fsx.c"

A recent commit added a TRIM_OFF_LEN() macro in "ltp/fsx.c":
    5843147e xfstests: fsx fallocate support is b0rked
A later commit fixed a problem with that macro:
    c47d7a51 xfstests: fix modulo-by-zero error in fsx

There is an extra flag parameter in that macro that I didn't like
in either version.  When looking at it the second time around I
concluded that there was no need for the flag after all.

Going back to the first commit, the code that TRIM_OFF_LEN()
replaced had one of two forms:
  - For OP_READ and OP_MAP_READ:
if (file_size)
offset %= file_size;
else
offset = 0;
if (offset + size > file_size)
size = file_size - offset;

  - For all other cases (except OP_TRUNCATE):
offset %= maxfilelen;
if (offset + size > maxfilelen)
size = maxfilelen - offset;

There's no harm in ensuring maxfilelen is non-zero (and doing so
is safer than what's done above).  So both of the above can be
generalized this way:
if (SIZE_LIMIT)
offset %= SIZE_LIMIT;
else
offset = 0;
if (offset + size > SIZE_LIMIT)
size = SIZE_LIMIT - offset;

In other words, there is no need for the extra flag in the macro.

The following patch just does away with it.  It uses the value of
the "size" parameter directly in avoiding a divide-by-zero, and in
the process avoids referencing the global "file_size" within the
macro expansion.

Signed-off-by: Alex Elder <aelder@sgi.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
12 years agofix 165 for different block sizes
Dave Chinner [Wed, 12 Oct 2011 23:48:39 +0000 (23:48 +0000)]
fix 165 for different block sizes

xfs_io uses the filesystem block size as the default write buffer
size. 165 does not filter the ops counts out of the golden output,
and hnce causes failures because the ops count doesn't match for a
given sized write. Fix this by changing the filter to the generic
xfs_io no-numbers filter.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Alex Elder <aelder@sgi.com>
12 years agoallow 091 for non-xfs filesystems
Christoph Hellwig [Tue, 11 Oct 2011 14:18:40 +0000 (14:18 +0000)]
allow 091 for non-xfs filesystems

The tests in 091 are entirely generic and pass e.g. on ext4 and jfs.
btrfs fails it, but that looks a like a btrfs-specific issue to me.

Also use _supported_os properly instead of erroring out manually on
IRIX.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Alex Elder <aelder@sgi.com>
12 years agosplit mapped writes vs direct I/O tests from 091
Christoph Hellwig [Mon, 10 Oct 2011 18:22:16 +0000 (18:22 +0000)]
split mapped writes vs direct I/O tests from 091

This effectively reverts

xfstests: add mapped write fsx operations to 091

and adds a new test case for it.  It tests something slightly
different, and regressions in existing tests due to new features
are pretty nasty in a test suite.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Alex Elder <aelder@sgi.com>
12 years agofix 122 for recent xfsprogs
Christoph Hellwig [Mon, 10 Oct 2011 18:21:56 +0000 (18:21 +0000)]
fix 122 for recent xfsprogs

- filter out xfs_alloctype_t, this was an internal emum that got removed
 - filter out xfs_bmbt_rec_32_t, this is a variant of the xfs_bmbt_rec_t
   that had almost no users and was removed
 - filter out xfs_dinode_core_t, the separate dinode core is gone, and just
   checking the size of the full dinode is enough
 - accept xfs_bmbt_rec_t as the new canonical name for xfs_bmbt_rec_64_t,
   and replace the old name with the new one in the output stream.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Alex Elder <aelder@sgi.com>
12 years agomake 203 pass on non-default block size filesystems
Dave Chinner [Mon, 10 Oct 2011 02:14:15 +0000 (02:14 +0000)]
make 203 pass on non-default block size filesystems

The xfs_bmap output in the golden image is filesystem block size
dependent. Make all writes 64k to ensure that the allocation/hole
pattern is consistent across all supported filesystem block sizes.

Also, use the SCRATCH_DEV instead of the TEST_DEV so that we test
according to MKFS_OPTIONS rather than test on whatever setup the
TEST_DEV was created with.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Alex Elder <aelder@sgi.com>
12 years agomake 225 use SCRATCH_DEV
Dave Chinner [Mon, 10 Oct 2011 02:14:14 +0000 (02:14 +0000)]
make 225 use SCRATCH_DEV

Use the scratch device for test 225 so that both custom mkfs and
mount options impact the test (e.g. filesystem block size). This
exposes test failures when using 512 byte block sizes, which
currently not tested unless the test device is specifically created
with a 512 byte block size.

Also clean up the file names to include the test number, and don't
remove the test files after the test has finished so that it leaves
behind a corpse that can be dissected when the test fails.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Alex Elder <aelder@sgi.com>
12 years ago259: convert to use the _math() function
Alex Elder [Fri, 7 Oct 2011 22:42:00 +0000 (22:42 +0000)]
259: convert to use the _math() function

Make test 259 a bit more readable by using the new _math() function.

Signed-off-by: Alex Elder <aelder@sgi.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
12 years agoxfstests: make 258 more forgiving of timestamp rounding
Eric Sandeen [Mon, 3 Oct 2011 16:52:33 +0000 (16:52 +0000)]
xfstests: make 258 more forgiving of timestamp rounding

Rather than testing for an exact timestamp, which could vary
due to rounding, just check that it is not positive,
which is the failure case we're looking for.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Alex Elder <aelder@sgi.com>
12 years agoxfstests: 262: verify project quota values aren't doubled
Alex Elder [Wed, 5 Oct 2011 02:06:29 +0000 (02:06 +0000)]
xfstests: 262: verify project quota values aren't doubled

This test checks the project quota values reported by the quota "df"
and "report" subcommands to ensure they match what they should be.
There was a bug (fixed by xfsprogs commit 7cb2d41b) where the values
reported were double what they should have been.

Signed-off-by: Alex Elder <aelder@sgi.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
12 years agoxfstests: 261: test failures caused by bogus mtab entries
Alex Elder [Mon, 3 Oct 2011 23:01:18 +0000 (23:01 +0000)]
xfstests: 261: test failures caused by bogus mtab entries

There is code in libxcmd that sets up a table of mount points and
directories that may be subject to quota enforcement.  If any entry
in the mount table (/proc/self/mounts) is inaccessible or has any
other problems, libxcmd exits.

We have encountered mtab entries that appear to be artifacts from
autoumount that, when parsed for getmntent(), return paths in the
mnt_fsname field that do not exist.  Such entries tend to have the
text " (deleted)" appended to a legitimate pathname (although the
space character is expanded to \040, as documented in getmntent(3)).

The xfs_quota command supports the ability to specify an alternate
mount table file, so this test makes use of that feature to exercise
the problem.  The test simply uses xfs_quota to print the current
set of paths, providing an alternate mount table file.  First it
does so with a copy of the current mount table (which is assumed
OK), then an extra bogus entry (very much like what has been seen
in the wild) is appended to the mount table, and runs the xfs_quota
command again.

It does this with no mount options, as well as with user, group, and
project quota options enabled.  (Given the current state of the code
however, only one of these is required.)

Signed-off-by: Alex Elder <aelder@sgi.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
12 years ago260: Check proper FITRIM argument handling
Lukas Czerner [Mon, 26 Sep 2011 07:14:04 +0000 (07:14 +0000)]
260: Check proper FITRIM argument handling

This test suppose to validate that file systems are using the fitrim
arguments right. It checks that the fstrim returns EINVAl in case that
the start of the range is beyond the end of the file system, and also
that the fstrim works without an error if the length of the range is
bigger than the file system (it should be truncated to the file system
length automatically within the fitrim implementation).

This test should also catch common problem with overflow of start+len.
Some file systems (ext4,xfs) had overflow problems in the past so there
is a specific test for it (for ext4 and xfs) as well as generic test for
other file systems, but it would be nice if other fs can add their
specific checks if this problem does apply to them as well.

[Added call to _require_math. -Alex]

Signed-off-by: Lukas Czerner <lczerner@redhat.com>
Signed-off-by: Alex Elder <aelder@sgi.com>
12 years agocommit.rc: Add helper for math operation using bc
Lukas Czerner [Mon, 26 Sep 2011 18:45:09 +0000 (18:45 +0000)]
commit.rc: Add helper for math operation using bc

Sometimes using bash $(()) math might not be enough due to some
limitation (big numbers), so add helper using 'bc' program. For
now the results are only in perfect numbers (as in bash) since this is
all I need for now.

This commit also adds _require_math() helper which should be called by
every test which uses _math() since it requires "bc" to be installed on
the system.

Signed-off-by: Lukas Czerner <lczerner@redhat.com>
Signed-off-by: Alex Elder <aelder@sgi.com>
12 years agoxfstests: fix test 259
Christoph Hellwig [Mon, 26 Sep 2011 11:44:58 +0000 (11:44 +0000)]
xfstests: fix test 259

Move the assignment of testfile after the sourcing of the common.* files to
make sure TEST_DIR is already defined - without this we end up creating
the file on the root filesystem, which may not support large enough files.

Also add a sync after the mkfs.xfs invocation, as losetup -d might fail
the loop device deletion with -EBUSY otherwise.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Alex Elder <aelder@sgi.com>
12 years ago259: Test xfs fs creation with fs size close to 4 TB
Boris Ranto [Thu, 22 Sep 2011 08:30:29 +0000 (08:30 +0000)]
259: Test xfs fs creation with fs size close to 4 TB

mkfs.xfs failed to create xfs filesystems with 4 TB minus few bytes due
to round up error in mkfs.xfs code.
This test case is a regression test for the fs creation problem.

I've tested the test case with mkfs.xfs patch (in the form posted by
Eric Sandeen) and the test passed (and therefore the patch fixed the
issue for me).

I'm not sure whether bash guarantees at least 64-bit precision
values in its arithmetic operations.  Therefore the values are
computed in advance.

Signed-off-by: Boris Ranto <branto@redhat.com>
Signed-off-by: Alex Elder <aelder@sgi.com>
12 years ago258: test timestamps before the epoch
Eric Sandeen [Mon, 19 Sep 2011 18:39:13 +0000 (18:39 +0000)]
258: test timestamps before the epoch

ext2/3/4 was sign-extending times before the timestamp when read
from disk on 64-bit systems.  This was fixed by:

4d7bf11d649c72621ca31b8ea12b9c94af380e63
ext2/3/4: fix file date underflow on ext2 3 filesystems on 64 bit systems

Here's a generic regression test.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Alex Elder <aelder@sgi.com>
12 years ago257: check getdents64() for duplicates
Gražvydas Ignotas [Fri, 23 Sep 2011 15:56:43 +0000 (10:56 -0500)]
257: check getdents64() for duplicates

The test checks if no duplicate d_off values are returned and that
those values are seekable to the right inodes.

[Fixed typo "histoty" -> "history". -Alex]

Signed-off-by: Gražvydas Ignotas <notasas@gmail.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Alex Elder <aelder@sgi.com>
12 years agofstrim: Use strtoull instead of strtoul
Lukas Czerner [Wed, 7 Sep 2011 15:48:43 +0000 (15:48 +0000)]
fstrim: Use strtoull instead of strtoul

When we are parsing input arguments we should really use stroull to get
unsigned long long numbers, since this is what we can specify on the
command line. With this fix it should parse long numbers on the 32 bit
architecture correctly.

Signed-off-by: Lukas Czerner <lczerner@redhat.com>
Reviewed-by: Alex Elder <aelder@sgi.com>
12 years agoxfstests: setup and run non-generic mkfs for btrfs
David Sterba [Tue, 16 Aug 2011 16:50:23 +0000 (18:50 +0200)]
xfstests: setup and run non-generic mkfs for btrfs

Signed-off-by: David Sterba <dsterba@suse.cz>
Signed-off-by: Christoph Hellwig <hch@lst.de>
12 years agoxfstests: fix loggen compile against recent xfsprogs headers
Christoph Hellwig [Mon, 22 Aug 2011 14:22:56 +0000 (16:22 +0200)]
xfstests: fix loggen compile against recent xfsprogs headers

The XFS_BLI_CANCEL flag got rename to XFS_BLF_CANCEL, allow loggen compile
with both versions.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
12 years agoxfstests 062: Also accept "no such attribute" errors for invalid extended attributes
Eric Sandeen [Fri, 19 Aug 2011 14:57:12 +0000 (09:57 -0500)]
xfstests 062: Also accept "no such attribute" errors for invalid extended attributes

In older Linux kernels, requesting an extended attribute which cannot exist
failed with EPERM.  In version 3.0, this was changed to ENODATA so that
programs can distinguish between missing attributes and permission problems
independent of the file type.

For example, lgetxattr("file", "user.name", NULL, 0) will now return ENODATA if
no such attribute exists even if "file" is a symbolic link.

In test 062, to make it work on kernels before and after 3.0, accept either of
the two error results from getfattr.

Signed-off-by: Andreas Gruenbacher <agruen@kernel.org>
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
12 years agomake t_immutable and 079 filesystem-agnostic
Stefan Behrens [Mon, 1 Aug 2011 10:31:20 +0000 (12:31 +0200)]
make t_immutable and 079 filesystem-agnostic

Changed the test 079 to be generic for all filesystems and to be executed
for all filesystems.  In src/t_immutable.c which is compiled for Linux
only, replace the old style XFS and ext2 specific code for setting the
append-only and immutable flags by generic code that makes use of the
ioctl(FS_IOC_SETFLAGS) and ioctl(FS_IOC_GETFLAGS) and remove the check for
the specific filesystem type.  FS_IOC_GETFLAGS/FS_IOC_SETFLAGS is always
used and placed in an '#ifdef FS_IOC_SETFLAGS' block in order to never fail
compilation.  Without support for FS_IOC_SETFLAGS, the test completes
with _notrun.

Signed-off-by: Stefan Behrens <sbehrens@giantdisaster.de>
Signed-off-by: Christoph Hellwig <hch@lst.de>
12 years agomake more tests generic
Stefan Behrens [Mon, 1 Aug 2011 10:31:19 +0000 (12:31 +0200)]
make more tests generic

Use _scratch_mkfs / _scratch_mkfs_sized instead of _scratch_mkfs_xfs where
possible. Execute 015, 062, 083, 117, 120 and 192 for all filesystems, these
tests used to be XFS specific.

Signed-off-by: Stefan Behrens <sbehrens@giantdisaster.de>
Signed-off-by: Christoph Hellwig <hch@lst.de>
12 years agoadd nfs4 support
Christoph Hellwig [Tue, 2 Aug 2011 10:20:43 +0000 (12:20 +0200)]
add nfs4 support

Signed-off-by: Christoph Hellwig <hch@lst.de>
Tested-by: Jim Rees <rees@umich.edu>
12 years agoadd jfs support
Christoph Hellwig [Tue, 2 Aug 2011 10:19:47 +0000 (12:19 +0200)]
add jfs support

Signed-off-by: Christoph Hellwig <hch@lst.de>
12 years agofix fsx build with newer xfs headers
Christoph Hellwig [Tue, 26 Jul 2011 10:12:47 +0000 (12:12 +0200)]
fix fsx build with newer xfs headers

The libxfs resync brought in a new round_up macro that conflicts with the
round_up function in fsx.  Rename the latter to allow building against the
new headers.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
12 years agodmapi: fix build failure if libdm is provided via -ldm
Theodore Ts'o [Thu, 21 Jul 2011 23:52:04 +0000 (19:52 -0400)]
dmapi: fix build failure if libdm is provided via -ldm

The value of $(LIBDM) may be a linker specification -ldm, and not a
file.  So it's not OK to add this to the dependency, since make will
then complain that it doesn't know how to make the target -ldm.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Signed-off-by: Christoph Hellwig <hch@lst.de>
12 years agoconfigure.in: declare a requirement for at least autoconf 2.50
Theodore Ts'o [Thu, 21 Jul 2011 23:52:02 +0000 (19:52 -0400)]
configure.in: declare a requirement for at least autoconf 2.50

On Debian/Ubuntu systems, if autoconf version 2.13 is installed,
autoconf will try to automatically figure out whether autoconf 2.13 or
something more modern is required (since the autoconf maintainers,
curses be upon them, didn't bother to maintain compatibility between
autoconf 2.13 and 2.50).  Unfortunately, the hueristics aren't
perfect, and although the configure.in file looks superficially like
it will be compatible with autoconf 2.13, it isn't.  You will end up
with a number of very subtle compilation failures if you use autoconf
2.13.

So declare a requirement for autoconf 2.50 using AC_PREREQ(2.50).

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Signed-off-by: Christoph Hellwig <hch@lst.de>
12 years agoxfstests: Improve test 219 to work with different filesystems
Jan Kara [Wed, 29 Jun 2011 16:04:40 +0000 (16:04 +0000)]
xfstests: Improve test 219 to work with different filesystems

Different filesystems account different amount of metadata in quota.
Thus it is impractical to check for a particular amount of space
occupied by a file because there is no right value. Change the test
to verify whether the amount of space is between the expected amount
of space and the expected amount +5%.  The number of files is
checked exactly as previously.

Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Alex Elder <aelder@sgi.com>
12 years agoxfstests: Add ENOSPC Hole Punch Test
Allison Henderson [Tue, 28 Jun 2011 14:45:01 +0000 (14:45 +0000)]
xfstests: Add ENOSPC Hole Punch Test

This patch adds a new test 256 that tests that a hole can be punched
even when the disk is full.  Reserved blocks should be used to allow
a punch hole to proceed even when there is not enough blocks to
further fragment the file. To test this, the file system is
fragmented by punching holes in regular intervals and filling the
file system between punches. This will eventually force the file
system to use reserved blocks to proceed with the punch hole
operation.

The work in this patch is a continuation from a previous patch set
that has been partially accepted.

Signed-off-by: Allison Henderson <achender@linux.vnet.ibm.com>
Signed-off-by: Alex Elder <aelder@sgi.com>
12 years agoxfstests: ENOSPC Punch Hole: Move su routines in 123 to common.rc
Allison Henderson [Tue, 28 Jun 2011 14:45:00 +0000 (14:45 +0000)]
xfstests: ENOSPC Punch Hole: Move su routines in 123 to common.rc

This patch moves the su routines in test 123 to common.rc so that
they can also be used in the new test 256

Signed-off-by: Allison Henderson <achender@linux.vnet.ibm.com>
Signed-off-by: Alex Elder <aelder@sgi.com>
12 years agoxfstests: Correct extent flag parsing for punch hole tests
Allison Henderson [Fri, 15 Jul 2011 03:52:13 +0000 (03:52 +0000)]
xfstests: Correct extent flag parsing for punch hole tests

The fiemap filters used in the punch hole tests parse the extent
flags in the fiemap to determine the extent type.  They are
currently parsing them as decimal values, but they should be parsing
hex values.

Signed-off-by: Allison Henderson <achender@linux.vnet.ibm.com>
Signed-off-by: Alex Elder <aelder@sgi.com>
12 years agoxfstests: fix modulo-by-zero error in fsx
Dave Chinner [Tue, 19 Jul 2011 22:43:41 +0000 (08:43 +1000)]
xfstests: fix modulo-by-zero error in fsx

The recent fsx fixes has a logic error in the offset trimming code.
If a read is done when the file size is zero, then the logic error
causes a offset % 0 opertaion to occur. This causes fsx to get a
SIGFPE and die.

This was not discovered during my testing because I was using a
random seed that didn't trip this condition. Changing the seed to
that which test 091 uses (the default of 1) causes such an operation
to occur....

Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
12 years agoxfstests: don't hard code the shell binary
Dave Chinner [Sun, 17 Jul 2011 01:46:56 +0000 (11:46 +1000)]
xfstests: don't hard code the shell binary

Recent changes to debian unstable user space have caused the
xfstests build to break as certain shell functionality is being
assumed by libtool and friends.  The configure scripts test and
select the correct shell, but the input files ignore this and hard
code the shell to use and hence now break.

Fix this by using the shell that the configure scripts decide is the
right one to use.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
12 years agoxfstests: update test 250 and its golden output
Alex Elder [Wed, 13 Jul 2011 20:28:48 +0000 (20:28 +0000)]
xfstests: update test 250 and its golden output

Test 250 actually runs now that it has golden output defined.  The
output the test produces doesn't match the golden output, however.

The main reason seems to be a oversight in the test--the stderr
output of mkfs wasn't being ignored as it should be (likely for
debugging).  Remove the comment character so the stderr does get
ignored.

Doing this still leaves some other output, but since it's filtered
there's no reason to leave it out of the golden output.  So add
the expected result of filtering into the golden output file.

Finally, this test--unlike almost all of the others--specifies the
value of its "tmp" variable as a relative rather than absolute
path.  I'm sure that works in some places, but it produces errors
for me.  Follow the "tmp=/tmp/$$" convention used elsewhere.

Signed-off-by: Alex Elder <aelder@sgi.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
12 years agoxfstests: fix fsx build failure.
Dave Chinner [Thu, 14 Jul 2011 05:40:47 +0000 (15:40 +1000)]
xfstests: fix fsx build failure.

Fix a brown paper bag "build and test the wrong tree" bug.

Reviewed-by: Dave Chinner <dchinner@redhat.com>
12 years agoxfstests: add mapped write fsx operations to 091
Dave Chinner [Thu, 14 Jul 2011 05:27:27 +0000 (15:27 +1000)]
xfstests: add mapped write fsx operations to 091

The recent busted fsx updates caused fsx to execute fsx with direct
IO and mmapped reads and writes on an XFS filesystem. The result
uncovered a direct-IO write vs mmap read bug to do with EOF
sub-block zeroing on the direct IO write.

Hence whiel we do not recommend that pepole mix DIO with mmap on the
same file, we should at least have tests that exercise it as they
often show up other problems like this.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Eric Sandeen <sandeen@redhat.com>
Reviewed-by: Alex Elder <aelder@sgi.com>
12 years agoxfstests: fix brain-o in fallocate log dump
Dave Chinner [Thu, 14 Jul 2011 05:27:16 +0000 (15:27 +1000)]
xfstests: fix brain-o in fallocate log dump

fsx segvs when dumping fallocate log entries. Fix magic string
array index parameters to be zero based rather than one based.

While touching log string related stuff, make the format consistent
with read and write operations so the log dump is easier to look at
with the human eye.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Eric Sandeen <sandeen@redhat.com>
Reviewed-by: Alex Elder <aelder@sgi.com>
12 years agoxfstests: fsx fallocate support is b0rked
Dave Chinner [Thu, 14 Jul 2011 05:27:01 +0000 (15:27 +1000)]
xfstests: fsx fallocate support is b0rked

The recent fallocate/fpunch additions to fsx have not actually be
executing fallocate/fpunch operations. The logic to select what
operation to run is broken in such a way that fsx has been executing
mapped writes and truncates instead of fallocate and fpunch
operations.

Remove all the (b0rken) smarty-pants selection logic from the test()
function. Replace it with a clearly defined set of operations for
each mode and use understandable fallback logic when various
operation types have been disabled. Then use a simple switch
statement to execute each of the different operations, removing the
tortured nesting of if/else statements that only serve to obfuscate
the code.

As a result, fsx uses fallocate/fpunch appropriately during
operations and uses/disableÑ• the operations as defined on the
command line correctly.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Alex Elder <aelder@sgi.com>
12 years agoxfstests: fix fsx fpunch test to actually test for fpunch
Dave Chinner [Thu, 14 Jul 2011 04:07:58 +0000 (14:07 +1000)]
xfstests: fix fsx fpunch test to actually test for fpunch

The operation flags parameter to fallocate is the second parameter,
not the last. Hence the fpunch test is actually testing for falloc
support, not fpunch. Somebody needs a brown paper bag.

Also, add a ftruncate call whenthe fpunch succeeds just in case the
file was not already zero sized. Failing to ensure we start with a
zero length file can cause read ops to fail size checks if they
occur before the file is written to be the main test loop.

While there, observe the quiet flag the same as the falloc test
does and have them both emit the warning at the same error level.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Eric Sandeen <sandeen@redhat.com>
Reviewed-by: Alex Elder <aelder@sgi.com>
12 years agoadd generic hole punch test 255
Allison Henderson [Thu, 30 Jun 2011 05:24:01 +0000 (22:24 -0700)]
add generic hole punch test 255

This patch adds a new test 255 that tests fallocate punch hole,
but is for use by generic filesystems.  It is similar to 252,
but uses a weaker fiemap filter that only displays the location
of the hole, and not the extent types.

Signed-off-by: Allison Henderson <achender@linux.vnet.ibm.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
12 years agomake 252 xfs only, add md5 checksums to hole punch tests
Allison Henderson [Thu, 30 Jun 2011 05:23:58 +0000 (22:23 -0700)]
make 252 xfs only, add md5 checksums to hole punch tests

This patch modifies test 252 to run for only xfs, and also
adds an md5 checksum to each of the punch hole tests

Signed-off-by: Allison Henderson <achender@linux.vnet.ibm.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
12 years agoFix the ltp Makefile to allow for installation of all non-c (scripts) files
Akshay Lal [Fri, 1 Jul 2011 20:52:43 +0000 (13:52 -0700)]
Fix the ltp Makefile to allow for installation of all non-c (scripts) files

Current the Makefile only builds the .c files and installs
them in the $INSTALL path. However, the ltp directory contains a shell script,
which doen't get copied over (installed) when a "make install"is invoked.

This behaviour causes test 080 to fail since it requires rwtest.sh to be
present in the ltp/ directory.

Tested: Updated the Makefile and ran a static build script & test
080.

Signed-off-by: Akshay Lal <akshaylal@google.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
12 years agoxfstesta: update test 242 golden output
Christoph Hellwig [Tue, 21 Jun 2011 07:49:57 +0000 (09:49 +0200)]
xfstesta: update test 242 golden output

Add the golden output for the newly added tests in common.punch.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
12 years agoxfsqa: add mising golden output for 250
Dave Chinner [Mon, 20 Jun 2011 23:53:17 +0000 (09:53 +1000)]
xfsqa: add mising golden output for 250

Was missed from the final commit that was checked in. Add it now.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
12 years agoxfstests: fix hardcoded path in output of 254
David Sterba [Fri, 3 Jun 2011 13:52:42 +0000 (13:52 +0000)]
xfstests: fix hardcoded path in output of 254

Add filters after btrfs commands, else the test would incorrectly
appear failed.

Signed-off-by: David Sterba <dsterba@suse.cz>
Signed-off-by: Alex Elder <aelder@sgi.com>
12 years agoxfstests: limit size of created filesystem in test 202
Chandra Seetharaman [Mon, 13 Jun 2011 16:18:25 +0000 (16:18 +0000)]
xfstests: limit size of created filesystem in test 202

Test 202 fails when the filesystem size is greater than 1TB with
a not so clear message.

Call mkfs with a small enough filesystem size to work even with
older versions of XFS.

Signed-off-by: Chandra Seetharaman <sekharan@us.ibm.com>
Signed-off-by: Alex Elder <aelder@sgi.com>
12 years agoxfstests: Make the requirement of projid32bit explicit in test 244
Chandra Seetharaman [Fri, 17 Jun 2011 15:17:45 +0000 (10:17 -0500)]
xfstests: Make the requirement of projid32bit explicit in test 244

Test 244 depends on projid32bit feature in mkfs.xfs. Not all versions
of xfsprogs provide that feature in mkfs.xfs.

This patch makes it an explicit requirement and avoids running the test
if the feature doesn't exist, instead of failing the test with an obscure
message.

[slightly modified by Eric Sandeen to shorten the _require name]

Signed-Off-By: Chandra Seetharaman <sekharan@us.ibm.com>
Signed-Off-By: Eric Sandeen <sandeen@redhat.com>
12 years agoexpand 252 with more corner case tests
Allison Henderson [Mon, 6 Jun 2011 23:33:50 +0000 (16:33 -0700)]
expand 252 with more corner case tests

This patch adds additional punch hole tests to 252
that were used to test ext4 punch hole. The _test_generic_punch
routine has been modified to accept two new flags:

-k To keep the test file between tests.
   This will test the handling of existing holes

-d To not sync the file between tests.
   This will test the handling of delayed extents

Four new corner cases have also been added to the routine:
14. data -> hole @ EOF
15. data -> hole @ 0
16. data -> cache cold ->hole
17. data -> hole in single block file

Signed-off-by: Allison Henderson <achender@us.ibm.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
12 years agoadd hole punching support to fsx
Allison Henderson [Mon, 6 Jun 2011 23:33:37 +0000 (16:33 -0700)]
add hole punching support to fsx

This patch adds punch hole tests to the fsx stress test.

Signed-off-by: Allison Henderson <achender@us.ibm.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
12 years agotest 032: Run mkfs.xfs only if the prior mkfs.${fs} succeded
Chandra Seetharaman [Thu, 16 Jun 2011 18:01:12 +0000 (20:01 +0200)]
test 032: Run mkfs.xfs only if the prior mkfs.${fs} succeded

This test fails when mkfs of a different filesystem fails, which is not
a failure case for this specific test.

Hence, change the test to run mkfs.xfs only if the prior mkfs.${fs} on
different filesystem succeded.

Signed-off-by: Chandra Seetharaman <sekharan@us.ibm.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
12 years agoxfstests: Make ext2 requirement explicit for test 049
Chandra Seetharaman [Fri, 10 Jun 2011 21:03:41 +0000 (16:03 -0500)]
xfstests: Make ext2 requirement explicit for test 049

Test 049 depends on ext2 module being supported by the kernel.

This patch makes it a explicit, instead of failing the test with
obscure message.

Signed-off-by: Chandra Seetharaman <sekharan@us.ibm.com>
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
12 years agoxfstests: add support for ext4dev FSTYP
Amir Goldstein [Fri, 3 Jun 2011 03:35:18 +0000 (22:35 -0500)]
xfstests: add support for ext4dev FSTYP

blkid knows to identify the ext4dev FSTYP of a partition that was
formatted with mkfs.ext4dev.
quota tools and various util-linux utils are also aware of ext4dev,
so ext4dev shares the same capabilities as ext4.

Tested-by: Sergey Ivanov <sergey57@gmail.com>
Signed-off-by: Amir Goldstein <amir73il@users.sf.net>
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
12 years agofix hardcoded reference to /mnt/test in common.attr
Amir Goldstein [Tue, 31 May 2011 20:25:12 +0000 (05:25 +0900)]
fix hardcoded reference to /mnt/test in common.attr

When trying to run test 70, we encountered several problems.
Sergey has strace'd some of the problems to attempts to
set xattr on the wrong test dir (/mnt/test/), which appears to be
hardcoded in common.attr.

Reported-by: Sergey Ivanov <sergey57@gmail.com>
Signed-off-by: Amir Goldstein <amir73il@users.sf.net>
Signed-off-by: Christoph Hellwig <hch@lst.de>
12 years agoxfstests: add test 254 for testing basic btrfs volume functionality
Josef Bacik [Tue, 24 May 2011 20:26:03 +0000 (16:26 -0400)]
xfstests: add test 254 for testing basic btrfs volume functionality

This test just runs through all of the basic btrfs commands that manipulate our
subvolume stuff.  It creates a snapshot, a subvolume, sets the subvolume as a
default, lists the volumes and deletes the snapshot.  Thanks,

Signed-off-by: Josef Bacik <josef@redhat.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
12 years agoxfstests: fsx: do not print fallocate support warning in quiet mode
Boris Ranto [Wed, 11 May 2011 17:02:24 +0000 (12:02 -0500)]
xfstests: fsx: do not print fallocate support warning in quiet mode

ltp/fsx.c tests whether the filesystem it is run on supports fallocate.
If it is not supported the fsx will print warning to stderr. This leads
to fails of tests 075, 112, 127 for the filesystems that do not support
fallocate. The tests use ltp/fsx but do not filter out stderr. Since
ltp/fsx.c can work without fallocate support I propose to move this
message to stdout unless quiet output is not requested. Previous patch
printed the message even if -q flag was used. This patch honours the flag.

This simple patch fixes the issue for me, tested on all the mentioned tests:

Signed-off-by: Boris Ranto <branto@redhat.com>
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
12 years agoxfstests: support post-udev device mapper nodes
Christoph Hellwig [Wed, 4 May 2011 14:28:32 +0000 (16:28 +0200)]
xfstests: support post-udev device mapper nodes

Because of udevs complaining device mapper now creates /dev/dm-N as the real
device nodes, and just symlinks the /dev/mapper/ names to it.  This would be
easy if everything used the /dev/mapper clear names, but most system utilities
translate them back to the /dev/mapper/ names and thus confuse various test
cases.  Add support to _is_block_dev to read symlinks, and add documentation
on how to run xfstests on device mapper volumes.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Alex Elder <aelder@sgi.com>
12 years agoxfstests: clean up fallocate configuration tests
Eric Sandeen [Wed, 4 May 2011 13:47:22 +0000 (08:47 -0500)]
xfstests: clean up fallocate configuration tests

When I added fallocate support to fsx I inadvertently added
a duplicate fallocate test.

Consolidate them both into one test (the link test, not the
compile test) and make all tests use "true" rather than "yes"
to be more consistent with other tests.

Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
Reviewed-by: Alex Elder <aelder@sgi.com>
12 years agoxfstests: fix error discard test output in 251.out
Tao Ma [Thu, 28 Apr 2011 03:49:11 +0000 (03:49 +0000)]
xfstests: fix error discard test output in 251.out

I don't know why, but discard tests is 251 in xfs, but 251.out has
number of 248 in it, So it fails.  Change it to 251 now.

Cc: Lukas Czerner <lczerner@redhat.com>
Cc: Christoph Hellwig <hch@lst.de>
Cc: Alex Elder <aelder@sgi.com>
Signed-off-by: Tao Ma <boyu.mt@taobao.com>
Signed-off-by: Alex Elder <aelder@sgi.com>
12 years agoxfstests: 253: test the metadump functionality of xfs_db
Alex Elder [Tue, 3 May 2011 18:39:29 +0000 (13:39 -0500)]
xfstests: 253: test the metadump functionality of xfs_db

This patch creates a test that exercises xfs_metadump, with a focus
on its obfuscation of names.  It was created to verify fixes that
avoided a hang condition when running "xfs_metadump" on a directory
containing files having particular bit patterns in their name.
Arkadiusz MiÃ…\9bkiewicz first reported seeing this while attempting
to create a metadump for a filesystem containing a file named
"R\323\257NE".

For now this script checks the following (using only filenames, not
attributes):
- that short names (4 characters or less) aren't obfuscated
- that long names get obfuscated
- that (long) directory names get obfuscated
- that names that are known to produce bit patterns that lead
  to invalid path components still generate obfuscated names
  (this could previously lead to a hang)
- that many names of the same length can still generate new
  obfuscated names (this could previously lead to a hang)
- that neither "lost+found" nor orphaned files stored in it ge
  obfuscated

Right now there are two sets of "ls" commands executed (one before
and one after obfuscation).  This produces repeatable results for
me on one filesystem, but on a different filesystem I expect the
inode numbers to change (and random number generation might change
the output too).  I'm interested in suggestions on how to filter
the output so the results can be verified.  If nothing else, the
test serves its purpose if I simply comment out those commands,
and will do that if there's not a better suggstion.

Signed-off-by: Alex Elder <aelder@sgi.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
12 years agoxfstests: coalesce contiguous extents in extent map output
Alex Elder [Thu, 21 Apr 2011 16:42:38 +0000 (11:42 -0500)]
xfstests: coalesce contiguous extents in extent map output

The specific set of extent sizes allocated to a file is not always
deterministic.  In particular, sometimes a range of unwritten blocks
is covered by a single extent, while in other cases it might be
represented by multiple consecutive unwritten extents.  This can
result in spurious errors being reported in tests that check file
extent maps.

Add a filter that finds adjacent extents in what gets produced for
fiemap and bmap output and coalesces them as if all consective
extents of the same time were really just one extent.  (Note that
as implemented here this applies to all extent types, not just
unwritten extents.)

Update the golden output for test 242 to reflect the change.

Signed-off-by: Alex Elder <aelder@sgi.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
12 years agoxfstests: make a few recently-added tests executable
Alex Elder [Thu, 21 Apr 2011 21:46:10 +0000 (16:46 -0500)]
xfstests: make a few recently-added tests executable

By convention all of the tests in the xfstests suite have mode 0755.
A few have recently committed without the execute bit set.

Signed-off-by: Alex Elder <aelder@sgi.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
12 years agoxfstests: drop "Mount point match" from 028 and 047 golden output
Alex Elder [Wed, 2 Mar 2011 04:49:27 +0000 (04:49 +0000)]
xfstests: drop "Mount point match" from 028 and 047 golden output

Bill Kendall's latest update to xfsdump dropped a line of output
that served no real purpose.  This change updates the golden output
for the two tests that included that line of output.

Updated to filter out that line from dump output also, so old
versions of the code will still produce the same output (suggested
by Dave Chinner).

Signed-off-by: Alex Elder <aelder@sgi.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
12 years agoxfstests: eliminate warnings under dmapi/src/suite2/src
Alex Elder [Fri, 4 Mar 2011 19:38:17 +0000 (19:38 +0000)]
xfstests: eliminate warnings under dmapi/src/suite2/src

Eliminate build warnings reported on files located under
dmapi/src/suite2/src/.

Signed-off-by: Alex Elder <aelder@sgi.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
12 years agoxfstests: eliminate warnings under dmapi/src/suite1/cmd (3)
Alex Elder [Fri, 4 Mar 2011 19:38:12 +0000 (19:38 +0000)]
xfstests: eliminate warnings under dmapi/src/suite1/cmd (3)

Eliminate build warnings reported on files located under
dmapi/src/suite1/cmd/ (third of three).

Signed-off-by: Alex Elder <aelder@sgi.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
12 years agoxfstests: eliminate warnings under dmapi/src/suite1/cmd (2)
Alex Elder [Fri, 4 Mar 2011 19:38:07 +0000 (19:38 +0000)]
xfstests: eliminate warnings under dmapi/src/suite1/cmd (2)

Eliminate build warnings reported on files located under
dmapi/src/suite1/cmd/ (second of three).

Signed-off-by: Alex Elder <aelder@sgi.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
12 years agoxfstests: eliminate warnings under dmapi/src/suite1/cmd (1)
Alex Elder [Fri, 4 Mar 2011 19:38:01 +0000 (19:38 +0000)]
xfstests: eliminate warnings under dmapi/src/suite1/cmd (1)

Eliminate build warnings reported on files located under
dmapi/src/suite1/cmd/ (first of three).

Signed-off-by: Alex Elder <aelder@sgi.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
12 years agoxfstests: eliminate some warnings under dmapi/src
Alex Elder [Fri, 4 Mar 2011 19:37:56 +0000 (19:37 +0000)]
xfstests: eliminate some warnings under dmapi/src

Eliminate build warnings reported on files located under these
subdirectories:
    dmapi/src/common/cmd/
    dmapi/src/common/lib/
    dmapi/src/sample_hsm/
    dmapi/src/simple/

Signed-off-by: Alex Elder <aelder@sgi.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
13 years agoxfstests 252: add test for fallocate with hole punching
Josef Bacik [Fri, 15 Apr 2011 19:19:59 +0000 (15:19 -0400)]
xfstests 252: add test for fallocate with hole punching

Move the major test meat of 242 into common.punch, and reuse it for
a new testcase the exercises the new fallocate implementation

Signed-off-by: Josef Bacik <josef@redhat.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
13 years agoxfsqa: reduce error output on 229
Dave Chinner [Fri, 15 Apr 2011 06:48:32 +0000 (16:48 +1000)]
xfsqa: reduce error output on 229

Once we get one short write, we know the test has failed. We don't
ened to keep writing and getting more short writes and spewing
thousands of errors to the console.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Eric Sandeen <sandeen@redhat.com>
13 years agoxfstests: allow deeper symlink recursion in 005
Christoph Hellwig [Mon, 11 Apr 2011 18:20:37 +0000 (11:20 -0700)]
xfstests: allow deeper symlink recursion in 005

Recent kernels allow more than 40 nested symlinks, so up the limit
to still reproduce a failure.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
13 years agoxfstests: ensure selinux xattrs don't interfere with quota tests
Eric Sandeen [Mon, 4 Apr 2011 18:49:19 +0000 (13:49 -0500)]
xfstests: ensure selinux xattrs don't interfere with quota tests

219 and 235 were failing on ext3 with selinux, because the extra
xattrs upped the quota usage.

Do the same trick we've used in the past to mount with an selinux
global context when doing quota tests.

Note the gross hack for remount,ro, though.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Alex Elder <aelder@sgi.com>
13 years agoxfstests 249: use -F option for xfs_io
Eric Sandeen [Mon, 4 Apr 2011 18:46:10 +0000 (13:46 -0500)]
xfstests 249: use -F option for xfs_io

Test 249 was appearing to pass on ext4, but it wasn't really
exercising the test due to lack of "-F" in the xfs_io arguments.

Without -F the files were created (oddly enough); neither pwrite
nor sendfile were executed, and the diff of the two (empty)
files passed, resulting in a passed test without testing anything.

So add the -F, capture the output, and test the result of each
xfs_io invocation.

Also, when it fails, the diff output is huge.  Make diff silent,
but describe the diff failure and exit.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
13 years agoxfstests: rework "dmapi" subtree build mechanism
Alex Elder [Fri, 4 Mar 2011 20:00:22 +0000 (20:00 +0000)]
xfstests: rework "dmapi" subtree build mechanism

The "dmapi" subtree was developed separate from and sort of wedged
into the rest of the "xfstests" code.  As a result, it has a lot of
build infrastructure that's just different from the unified way used
for everything else.

This patch changes all that, making the "dmapi" subtree be a more
normal component of "xfstests" with respect to its build process.

This involves removing all the cruft needed and used by the dmapi
"configure" script, and replacing each "Makefile.am" file with a
proper "Makefile" that includes a simple set of rules that are
compatible with the broader "xfstests" build.

The result is a much cleaner, consistent build.  It also deletes
a considerable amount of code.

Signed-off-by: Alex Elder <aelder@sgi.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
13 years agoxfstests: some refinements on "make depend"
Alex Elder [Fri, 4 Mar 2011 19:37:41 +0000 (19:37 +0000)]
xfstests: some refinements on "make depend"

Make it so "make depend" is a generic target, like "make clean".

Each Makefile has a "depend" target that indicates whether making
dependencies means creating ".dep" or creating ".ltdep" (or, I
suppose, both, though none do that right now).  Both files get
created even if there are no CFILES to scan (to ensure the target
up-to-date).  The "default" target now depends on "depend" (there is
no "ltdepend" any more).

Remove the "depend" and "ltdepend" definitions from the "buildrules"
file; only the actual generated files (".dep" and ".ltdep") remain
as generic targets.  The "depend' target is still defined as phony.

Do a shell trick when expanding the value of CFILES, to avoid a
problem that occurs if it is created by "make" by concatentating two
empty strings.  The problem was that in that case CFILES will
contain a space, and that wasn't getting treated as empty as
desired.

Make the rule for tool/lib dependencies more generic, to reflect the
general desire that "lib" subdirectories need to be built before
things in the "tool" subdirectories.

Signed-off-by: Alex Elder <aelder@sgi.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
13 years agoxfstests: a few fixes to Makefile
Alex Elder [Fri, 4 Mar 2011 19:37:36 +0000 (19:37 +0000)]
xfstests: a few fixes to Makefile

Change the top-level Makefile, to make it clearer just what makes
what, and what depends on what:
- Separate the rules for "configure" and "include/builddefs" into
  two parts, each of which generate one of the files
- Get rid of the rule for include/config.h, and group it with the
  one for include/builddefs (the same command creates both files)

Having done this, we find that having both "include/builddefs" and
"include/config.h" as dependencies for the default target results in
a parallel invocation of "make" spawning two concurrent attempts to
do the configure step--and that doesn't work.

Creating one of those two will result in the other getting created,
so just list one of them as a dependency for the default rule.

A couple of other small fixes:
- Get rid of the "new", "remake" and "check" dependencies for the
  default rule, which serv no purpose
- Use the $(Q) convention in a few missed spots
- Stop a DMAPI-only comment from getting echoed on default build
- Delete the "

This updated version pulls in the content of a patch previously
posted separately to fix the problem with parallel builds.

Signed-off-by: Alex Elder <aelder@sgi.com>
Reviewed-by: Eric Sandeen <sandeen@sandeen.net>
13 years agoxfstests: fix a few build warnings
Alex Elder [Fri, 4 Mar 2011 19:37:31 +0000 (19:37 +0000)]
xfstests: fix a few build warnings

This patch fixes a few build warnings.  I have built the code using
i386, x86_64, and ia64 architectures and each has ends up with
complaints of one sort or anther.  This gets rid of all of them
*except* those reported by files under the "ltp" (Linux Test
Project) sub-tree.

Signed-off-by: Alex Elder <aelder@sgi.com>
Reviewed-by: Eric Sandeen <sandeen@sandeen.net>
13 years agoxfstests: make 127 and 134 clean up after themselves
Alex Elder [Fri, 4 Mar 2011 20:22:10 +0000 (20:22 +0000)]
xfstests: make 127 and 134 clean up after themselves

Tests 127 and 134 leave temp files around when they complete.
Fix (or enable) their cleanup functions to remedy this.

Signed-off-by: Alex Elder <aelder@sgi.com>
Reviewed-by: Eric Sandeen <sandeen@sandeen.net>
13 years agoxfstests: change directory to / before _cleanup_testdir in test 135
Boris Ranto [Tue, 8 Mar 2011 13:29:20 +0000 (13:29 +0000)]
xfstests: change directory to / before _cleanup_testdir in test 135

Nfs tries to umount $testdir in _cleanup_testdir function. Tests 126
and 135 call the function from directory $SCRATCH_MNT that is equal
to $testdir (at least for nfs). The umount will therefore fail,
causing the test to fail due to the output mismatch.

Test 126 also does double a umount thanks to the call to _cleanup
before exit and the trap command.  So remove the unnecessary call of
the _cleanup function before exit.

Signed-off-by: Boris Ranto <branto@redhat.com>
Signed-off-by: Alex Elder <aelder@sgi.com>
13 years agoAdd fallocate calls to fsx
Eric Sandeen [Wed, 9 Mar 2011 16:35:19 +0000 (10:35 -0600)]
Add fallocate calls to fsx

Add random runtime fallocate calls to fsx (vs. the existing
preallocate file at start of run).

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Reviewed-by: Alex Elder <aelder@sgi.com>
13 years ago225: Run with different random seeds
Eric Sandeen [Wed, 9 Mar 2011 16:30:07 +0000 (10:30 -0600)]
225: Run with different random seeds

Running the fiemap-tester with a unique random seed each time
may uncover some things missed by always using the default.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Reviewed-by: Alex Elder <aelder@sgi.com>
13 years ago225: add additional fiemap-tester run without sync
Eric Sandeen [Tue, 8 Mar 2011 15:16:23 +0000 (09:16 -0600)]
225: add additional fiemap-tester run without sync

Chris Mason pointed out that some filesystems were not doing
the right thing on fiemap, in the face of delalloc extents.

Because test 225 ran with FIEMAP_FLAG_SYNC only, this didn't
get caught.  Add a runtime option, and run it both ways.

Note that this changes defaults for fiemap-tester, so that
it no longer calls with FIEMAP_FLAG_SYNC by default, and
a new option -S is added to do so.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Reviewed-by: Alex Elder <aelder@sgi.com>
13 years agoFix fiemap-tester for fewer extents returned
Eric Sandeen [Tue, 8 Mar 2011 15:09:38 +0000 (09:09 -0600)]
Fix fiemap-tester for fewer extents returned

If the fiemap call returns fewer extents than asked for,
the fiemap tester gets confused.  If this happens, advance,
and call fiemap again for the next offset.

XFS exposed this because if a file is all-delalloc, it was
only returning 1 mapped extent (this is probably also a buglet).

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Reviewed-by: Alex Elder <aelder@sgi.com>
13 years agoNotify via syslog when godown is shutting down fs
Eric Sandeen [Wed, 23 Feb 2011 16:35:07 +0000 (10:35 -0600)]
Notify via syslog when godown is shutting down fs

Just a hint for those perusing logs that the ensuing shutdown is
intentional...

Feb 16 17:06:17 hostname godown: xfstests-induced forced shutdown of /mnt/scratch
Feb 16 17:06:17 hostname kernel: Filesystem "sdb3": xfs_log_force: error 5 returned.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Alex Elder <aelder@sgi.com>
13 years agoAdd test 251: Check filesystem FITRIM implementation
Lukas Czerner [Wed, 9 Feb 2011 16:36:17 +0000 (16:36 +0000)]
Add test 251: Check filesystem FITRIM implementation

FITRIM ioctl  is used on a mounted filesystem to discard (or "trim")
blocks which are not in use by the filesystem.  This is useful for
solid-state drives (SSDs) and thinly-provi-sioned storage. This test
helps to verify filesystem FITRIM implementation to assure that it
does not corrupts data.

This test creates checksums of all files in xfstests directory and
run several processes which clear its working directory on SCRATCH_MNT,
then copy everything from xfstests into its working directory, create
list of files in working directory and its checksums and compare it with the
original list of checksums. Every process works in the loop so it repeat
remove->copy->check, while fstrim tool is running simultaneously.

Fstrim is just a helper tool which uses FITRIM ioctl to actually do the
filesystem discard.

I found this very useful because when the FITRIM is really buggy (thus
data-destroying) the 251 test will notice, because checksums will most
likely change.

Signed-off-by: Lukas Czerner <lczerner@redhat.com>
Signed-off-by: Alex Elder <aelder@sgi.com>