xfstests-dev.git
11 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>
11 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>
11 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>
11 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>
11 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>
11 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>
11 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>
11 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>
11 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>
11 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>
11 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>
11 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>
11 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>
11 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>
11 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>
11 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>
11 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>
11 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>
11 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>
11 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>
11 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>
11 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>
11 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>
11 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>
11 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>
11 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>
11 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>
11 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>
11 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>
11 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>
11 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>
11 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>
11 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>
11 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>
11 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>
11 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>
11 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>
11 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>
11 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>
11 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>
11 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>
11 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>
11 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>
11 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>
11 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>
11 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>
11 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>
11 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>
11 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>
11 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>
11 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>
11 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>
11 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>
11 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>
11 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>
11 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>
11 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>
11 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>
11 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>
11 years ago164: write a multiple of 4k instead of 512
Jeff Moyer [Mon, 14 Feb 2011 16:58:00 +0000 (11:58 -0500)]
164: write a multiple of 4k instead of 512

When running test 164 against a 4k sector device, the initial file write
of 50K fails with EINVAL, since it isn't a multiple of the device sector
size.  I fixed this by bumping the amount written to 52K.

Signed-off-by: Jeff Moyer <jmoyer@redhat.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
11 years ago091: fix up output when pagesize == sectorsize
Jeff Moyer [Mon, 14 Feb 2011 16:44:25 +0000 (11:44 -0500)]
091: fix up output when pagesize == sectorsize

It looks like test 091 is supposed to work on 2.4 kernels, but there's
no way it will.  Checking the actual blocksize and pagesize in the
run_fsx routine, and substituting them for BSIZE and PSIZE is error
prone when the two hold the same value.  This is also a problem for 4k
sector devices.  It's better to pass in what we want (PSIZE or BSIZE)
and then convert that to the command line options that fsx wants in the
run_fsx routine.  This gets rid of the bogus test failure in my
environment.  Also, the setting of bsize for linux-2.6 was redundant, so
I got rid of it.

Signed-off-by: Jeff Moyer <jmoyer@redhat.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
11 years ago089: fix error caused by weird stdout buffer handling
Lukas Czerner [Wed, 2 Feb 2011 15:52:59 +0000 (16:52 +0100)]
089: fix error caused by weird stdout buffer handling

We have hit the error while running 089.

FSTYP         -- ext3
PLATFORM      -- Linux/x86_64 localhost 2.6.32-109.el6.x86_64

...
...
 completed 50 iterations
 completed 50 iterations
 completed 50 iterations
-completed 50 iterations
 completed 10000 iterations
 directory entries:
 t_mtab
Ran: 089
Failures: 089
Failed 1 of 1 tests

This is not very easily reproducible, however one can hit it
eventually when running 089 in the loop. The problem is apparently, that
the output might get lost, probably due to some stdio buffer weirdness.

This commit workaround the issue by adding an optional argument to the
t_mtab to specify output file. The t_mtab output is then appended to a
file which content is then printed to the stdout as it would if no
output file is used.

With this commit applied the problem is no longer reproducible.

Signed-off-by: Lukas Czerner <lczerner@redhat.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
11 years agoxfstests: conditionalise allocsize option in 014
Dave Chinner [Mon, 14 Feb 2011 00:23:29 +0000 (11:23 +1100)]
xfstests: conditionalise allocsize option in 014

allocsize is an XFS specific mount option, and hence causes the test
to fail on other filesystems. Only set the mount option on xfs
filesystems.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Josef Bacik <josef@redhat.com>
11 years agoxfstests: Speed up test 042
Dave Chinner [Mon, 14 Feb 2011 00:22:07 +0000 (11:22 +1100)]
xfstests: Speed up test 042

test 042 generates a worst-case fragmented filesystem and uses it to
test xfs_fsr. It uses small 4k files to generate the hole-space-hole
pattern that fragments free space badly. It is much faster to
generate the same pattern by creating a single large file and
punching holes in it.  Also, instead of writing large files to
create unfragmented space, just use preallocation so we don't have
to write the data to disk.

These changes reduce the runtime of the test on a single SATA drive
from 106s to 27s.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Alex Elder <aelder@sgi.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
11 years agoxfstests: make 016 work with delaylog
Dave Chinner [Mon, 14 Feb 2011 00:21:44 +0000 (11:21 +1100)]
xfstests: make 016 work with delaylog

Test 016 fails with delaylog because it measures log traffic to disk
and delaylog writes almost nothing to the log for the given test. TO
make it work, add sync calls to the work loop to cause the log to be
flushed reliably for both delaylog and nodelaylog and hence contain
the same number of log records.

As a result, the log space consumed by the test is not changed by
the delaylog option and the test passes. The test is not
significantly slowed down by the addition of the sync calls (takes
15s to run on a single SATA drive).

Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Alex Elder <aelder@sgi.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
11 years agoxfstests: add test to reproduce bmap btree corruption.
Dave Chinner [Mon, 14 Feb 2011 00:20:00 +0000 (11:20 +1100)]
xfstests: add test to reproduce bmap btree corruption.

The problem was reprted here:

https://bugzilla.redhat.com/show_bug.cgi?id=626244

With the simple test case:

# mkfs.xfs -f -d agsize=16m,size=50g <dev>
# mount <dev> /mnt
# xfs_io -f -c 'resvsp 0 40G' /mnt/foo

Triggering the problem. Turn this into a new xfsqa test so that we
exercise the problem code and prevent future regressions.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Alex Elder <aelder@sgi.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
11 years agoxfstests: add simple splice test
Dave Chinner [Mon, 10 Jan 2011 23:31:33 +0000 (10:31 +1100)]
xfstests: add simple splice test

We don't have any coverage of the splice functionality provided by
the kernel in xfstests. Add a simple test that uses the sendfile
operation built into xfs_io to copy a file ensure we at least
execute the code path in xfstests.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
11 years ago078: xfs_repair should be run against the losetup'd device, not the image file
Jeff Moyer [Fri, 11 Feb 2011 22:04:37 +0000 (17:04 -0500)]
078: xfs_repair should be run against the losetup'd device, not the image file

When running test 078 against a 4k logical block sized disk, it fails in
xfs_repair.  The problem is that xfs_repair is passed the loopback
filename instead of the actual loop device.  This means that it opens
the file O_DIRECT, and tries to do 512 byte aligned I/O to a 4k sector
device.  The loop device, for better or for worse, will do buffered I/O,
and thus does not suffer from the same problem.  So, the attached patch
sets up the loop device and passes that to xfs_repair.  This resolves
the issue on my test system.

Comments are more than welcome.

Signed-off-by: Jeff Moyer <jmoyer@redhat.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
11 years ago240: only run when the file system block size is larger than the disk sector size
Jeff Moyer [Fri, 11 Feb 2011 20:20:02 +0000 (15:20 -0500)]
240: only run when the file system block size is larger than the disk sector size

This test really wants to test partial file-system block I/Os.  Thus, if
the device has a 4K sector size, and the file system has a 4K block
size, there's really no point in running the test.  In the attached
patch, I check that the fs block size is larger than the device's
logical block size, which should cover a 4k device block size with a 16k
fs block size.

I verified that the patched test does not run on my 4k sector device
with a 4k file system.  I also verified that it continues to run on a
512 byte logical sector device with a 4k file system block size.

Signed-off-by: Jeff Moyer <jmoyer@redhat.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
11 years agoaiodio_sparse2: fix up alignment for 4k logical block sized devices
Jeff Moyer [Fri, 11 Feb 2011 19:08:09 +0000 (14:08 -0500)]
aiodio_sparse2: fix up alignment for 4k logical block sized devices

When running xfstests on a 4k logical sector device, I ran into a test
failure in test 198.  The errors were all due to trying to do 512 byte
aligned I/O on a 4k logical sector device.  The attached patch tries to
auto-detect the proper block size if no alignment is specified.  If it
fails for one reason or another, it defaults to 4k alignment.  This
seems to work fine in my test rig.

Signed-off-by: Jeff Moyer <jmoyer@redhat.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
11 years ago243: remove test files before starting
Eric Sandeen [Tue, 11 Jan 2011 15:38:15 +0000 (15:38 +0000)]
243: remove test files before starting

I found that overwriting existing files hides a bug
in ext4 (since fixed).  Removing the files before
the test reliably reproduces it.

Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Alex Elder <aelder@sgi.com>
11 years agoxfstests 241: run longer
Eric Sandeen [Thu, 6 Jan 2011 17:44:25 +0000 (17:44 +0000)]
xfstests 241: run longer

I ran into a failure on an ext4 backport which should have
been caught by this test, but 30s wasn't long enough to
hit it reliably.  So run a bit longer; it's not in the
quick group anyway.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Alex Elder <aelder@sgi.com>
11 years agoxfstests: 014 takes forever with large preallocation sizes
Dave Chinner [Fri, 7 Jan 2011 12:58:50 +0000 (23:58 +1100)]
xfstests: 014 takes forever with large preallocation sizes

Christoph reported that test 014 went from 7s to 870s runtime with
the dynamic speculative delayed allocation changes. Analysis of test
014 shows that it does this loop 10,000 times:

pwrite(random offset, 512 bytes);
truncate(random offset);

Where the random offset is anywhere in a 256MB file. Hence on
average every second write or truncate extends the file.

If large preallocatione beyond EOF sizes are used each extending
write or truncate will zero large numbers of blocks - tens of
megabytes at a time. The result is that instead of only writing
~10,000 blocks, we write hundreds to thousands of megabytes of zeros
to the file and that is where the difference in runtime is coming
from.

The IO pattern that this test is using does not reflect a common (or
sane!) real-world application IO pattern, so it is really just
exercising the allocation and truncation paths in XFS. To do this,
we don't need large amounts of preallocation beyond EOF that just
slows down the operation, so execute the test with a fixed, small
preallocation size that reflects the previous default.

By specifying the preallocation size via the allocsize mount option,
this also overrides any custom allocsize option provided for the
test, so the test will not revert to extremely long runtimes when
allocsize is provided on the command line.

However, to ensure that we do actually get some coverage of the
zeroing paths, set the allocsize mount option to 64k - this
exercises the EOF zeroing paths, but does not affect the runtime of
the test.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Alex Elder <aelder@sgi.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
11 years agoxfsqa: make hole tests independent of speculative allocation patterns
Dave Chinner [Fri, 7 Jan 2011 12:59:15 +0000 (23:59 +1100)]
xfsqa: make hole tests independent of speculative allocation patterns

Many of the "count-the-holes" tests (008, 012, etc) do writes that extend the
file and hence allocation patterns are dependent on speculative allocation
beyond EOF behaviour. Hence if we change that behaviour, these tests all fail
because there is a different pattern of holes.

Make the tests independent of EOF preallocation behaviour by first truncating
the file to the size the test is defined to use. This prevents speculative
prealocation from occurring, and hence changes in such behaviour will not cause
the tests to fail.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
11 years agoxfstests: ensure uint64_t is defined for <linux/fs.h>
Alex Elder [Mon, 29 Nov 2010 22:14:00 +0000 (22:14 +0000)]
xfstests: ensure uint64_t is defined for <linux/fs.h>

When compiling "fiemap-tester.c" in my environment, I am
getting complaints at the first reference to "uint64_t"
in <linux/fs.h>.  This simple patch resolves that.

Signed-off-by: Alex Elder <aelder@sgi.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
11 years agoxfstests: pwrite hang when writing from mmaped buffer of the same page
Zhong, Xin [Thu, 16 Dec 2010 10:09:39 +0000 (11:09 +0100)]
xfstests: pwrite hang when writing from mmaped buffer of the same page

The problem is found in meego testing on btrfs:
http://bugs.meego.com/show_bug.cgi?id=6672

Signed-off-by: Zhong, Xin <xin.zhong@intel.com>
Reviewed-by: Hellwig, Christoph <hch@infradead.org>
Reviewed-by: Chinner, Dave <david@fromorbit.com>
11 years agoxfstests: filter spaces in xfs_quota output in test case 108
Boris Ranto [Wed, 15 Dec 2010 19:10:57 +0000 (20:10 +0100)]
xfstests: filter spaces in xfs_quota output in test case 108

xfs_quota can output different amounts of spaces when it is trying to align
its output. This can cause output mismatch on several systems in test case 108.

Filter all the consecutive spaces in xfs_quota output to just one space,
making the test case independent of the alignment.

Signed-off-by: Boris Ranto <branto@redhat.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
11 years agoxfstests: ignore absolute address in filename in test case 237
Boris Ranto [Tue, 14 Dec 2010 19:17:16 +0000 (20:17 +0100)]
xfstests: ignore absolute address in filename in test case 237

Test case 237 checks for setfacl output. The setfacl can use both
relative address or absolute address for filename.

Following patch ignores the unnecessary part of absolute address and
therefore the test case can pass on systems that output absolute
address.

Signed-off-by: Boris Ranto <branto@redhat.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
11 years agoxfstests: getfacl -n unsupported in older acl package
Boris Ranto [Wed, 1 Dec 2010 14:14:56 +0000 (15:14 +0100)]
xfstests: getfacl -n unsupported in older acl package

Test cases 051 and 067 use getfacl with option -n. This works well on newer systems but older acl package know only its longer version: --numeric.

Signed-off-by: Boris Ranto <branto@redhat.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
11 years agoxfstests: add _scratch_mkfs_sized support for btrfs
Josef Bacik [Tue, 30 Nov 2010 22:22:36 +0000 (23:22 +0100)]
xfstests: add _scratch_mkfs_sized support for btrfs

Signed-off-by: Josef Bacik <josef@redhat.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
11 years agoxfstest 245: accept ENOTEMPTY as a valid error
Josef Bacik [Tue, 30 Nov 2010 22:22:34 +0000 (23:22 +0100)]
xfstest 245: accept ENOTEMPTY as a valid error

Test 245 only checks to see if the rename returned EEXIST, but according to the
rename(2) manpage, ENOTEMPTY is also a valid result, which is in fact what Btrfs
returns.  So just filter the output for ENOTEMPTY so that either EEXIST or
ENOTEMPTY will pass the test.  It's not pretty I know, but I couldn't really
figure out a good way to get an either/or output to compare.  With this fix
Btrfs now passes 245.

Signed-off-by: Josef Bacik <josef@redhat.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
11 years agoxfstests 247: Test for race between direct I/O and mmap
Lachlan McIlroy [Fri, 19 Nov 2010 16:17:34 +0000 (10:17 -0600)]
xfstests 247: Test for race between direct I/O and mmap

A customer reported a problem:

If a process is using mmap to write to a file on an
ext4 filesystem while another process is using direct
I/O to write to the same file the first thread may
receive a SIGBUS during a page fault.

A SIGBUS occurs if the page fault tries to access a
page that is entirely beyond the end of the file but
in this test case that should not be happening.

Signed-off-by: Lachlan McIlroy <lmcilory@redhat.com>
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
11 years agoxfstests: check block truncation after write failure
Christoph Hellwig [Fri, 19 Nov 2010 14:57:05 +0000 (15:57 +0100)]
xfstests: check block truncation after write failure

Extraced from  https://bugzilla.kernel.org/show_bug.cgi?id=22452
"data corruption after mmap()ing a file and writev() some data to another file"

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Eric Sandeen <sandeen@sandeen.net>
Reviewed-by: Dave Chinner <david@fromorbit.com>
11 years agoxfstests 223: reinitialize MKFS_OPTIONS
Boris Ranto [Thu, 18 Nov 2010 02:44:57 +0000 (20:44 -0600)]
xfstests 223: reinitialize MKFS_OPTIONS

Test case 223 constantly fails because the variable carrying mkfs
options is not being reinitialized.

Test calls function _scratch_mkfs_geom repeatedly in for loop without
cleaning the MKFS_OPTIONS variable. Since _scratch_mkfs_geom only
appends options to the variable, MKFS_OPTIONS looks like this in 5th
iteration:
MKFS_OPTIONS="-bsize=4096-b size=4096 -d su=8192,sw=4-b size=4096 -d
su=16384,sw=4-b size=4096 -d su=32768,sw=4-b size=4096 -d
su=65536,sw=4-b size=4096 -d su=131072,sw=4"

It is also easy to see that _scratch_mkfs_geom does not append leading
space when it appends the variable.

Following patch fixes the issue for me and based on my testing does not
break any other test case:

Signed-off-by: Boris Ranto <branto@redhat.com>
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Reviewed-by: Eric Sandeen <sandeen@redhat.com>
11 years agoxfstests: add test for renaming over non-empty directories
Christoph Hellwig [Tue, 9 Nov 2010 13:53:39 +0000 (14:53 +0100)]
xfstests: add test for renaming over non-empty directories

Per Posix renames over non-empty directories should fail, but hfsplus used to
allow this (and corrupt the filesystem while doing so).

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
11 years agoxfstests: add _require_sparse_files
Christoph Hellwig [Tue, 9 Nov 2010 13:53:36 +0000 (14:53 +0100)]
xfstests: add _require_sparse_files

Add a helper to check if the filesystem supports sparse files.  This is
used to guard tests that exercise sparse file functionality and would
take forever on filesystems that have to zero all blocks on extending
truncates.

Unfortunately there's no good way to autodetect this functionality, so
just implement it as a blacklist for now.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
11 years agoxfstests: do not call attr/getfattr/setfattr direcly
Christoph Hellwig [Thu, 21 Oct 2010 20:07:31 +0000 (20:07 +0000)]
xfstests: do not call attr/getfattr/setfattr direcly

always use the full path set up in common.attr.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Alex Elder <aelder@sgi.com>
11 years agoxfstests: remove dead code in test 062
Christoph Hellwig [Thu, 21 Oct 2010 20:07:12 +0000 (20:07 +0000)]
xfstests: remove dead code in test 062

The _linux_attr_calls function is never called, remove it.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Alex Elder <aelder@sgi.com>
11 years agoxfstests: use a common _filter_test_dir function
Alex Elder [Fri, 22 Oct 2010 14:09:24 +0000 (14:09 +0000)]
xfstests: use a common _filter_test_dir function

Christoph Hellwig suggested that a function similar to the common
"_filter_scratch" function ought to be created to handle filtering
of the TEST_DIR and TEST_DEV variables.  This patch implements that.

The name "_filter_test" seems like it might suggest it does
something different, so I'm calling this one "_filter_test_dir".
This unfortunately makes the "test" and "scratch" functions have
different naming conventions, but I guess we should be accustomed to
that by now (consider "TEST_DIR" and "SCRATCH_MNT").

Signed-off-by: Alex Elder <aelder@sgi.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
11 years agoxfstests: use a common _filter_scratch function
Alex Elder [Thu, 21 Oct 2010 19:00:08 +0000 (19:00 +0000)]
xfstests: use a common _filter_scratch function

There are a number of tests that use a shell function called
"filter_scratch" or "_filter_scratch" in order to have the actual
scratch device or mount point show up in test output with a symbolic
name.  There are two sets, each following a slightly different
convention.  Put a common _filter_scratch function definition in
"common.filter" and have all test scripts use that instead.
Choosing one of the two conventions meant that a few test output
files had to be changed.

In addition, add a call to _filter_scratch to test 185, and update
its output accordingly.

Signed-off-by: Alex Elder <aelder@sgi.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
11 years agoxfstests: handle filesystems without FIEMAP support
Christoph Hellwig [Thu, 21 Oct 2010 19:12:04 +0000 (21:12 +0200)]
xfstests: handle filesystems without FIEMAP support

Do a _notrun in 225 if we get EOPNOSUPP back from FIEMAP instead
of failing the test.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
11 years agoxfstests: add _require_attrs
Christoph Hellwig [Thu, 21 Oct 2010 19:11:48 +0000 (21:11 +0200)]
xfstests: add _require_attrs

Add a new helper to check if extended attributes are supported.  It
errors out if any of the attr tools are not found, or if a filesystem
does not support setting attributes.

Remove the opencoded checks for the attr tools from various tests
now that we do them in common code.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Alex Elder <aelder@sgi.com>
11 years agoxfstests: fix quota detection
Christoph Hellwig [Thu, 21 Oct 2010 03:55:58 +0000 (05:55 +0200)]
xfstests: fix quota detection

Even if the kernel has quota support built in most filesystems still
don't support it.  As there's no good way to find out if a filesystem
supports quotas hardcode the list of filesystems that do support
quotas.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Alex Elder <aelder@sgi.com>
11 years agoxfstests: fix _require_acl
Christoph Hellwig [Thu, 21 Oct 2010 03:55:11 +0000 (05:55 +0200)]
xfstests: fix _require_acl

Skip ACL tests if we get EOPNOTUPP back from the acl calls.  This is
the error code we get on a kernel that does support the xattr system
calls, but does not support the attributes used to handle Posix ACLs.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Alex Elder <aelder@sgi.com>
11 years agoxfstests: randholes: a few final cleanups
Alex Elder [Thu, 14 Oct 2010 14:51:01 +0000 (14:51 +0000)]
xfstests: randholes: a few final cleanups

Minor bits to wrap up this series.
- Bumped up the number of blocks read at once from 10 to 256
- Shorten remaining long lines
- Re-factor findblock()
- Get rid of global variable "nvalid"
- Add a few more comments
- Give all global symbols static scope
- Update the copyright message
- Various other minor formatting changes.

Signed-off-by: Alex Elder <aelder@sgi.com>
Acked-by: Dave Chinner <david@fromorbit.com>
11 years agoxfstests: randholes: encapsulate argument parsing
Alex Elder [Thu, 14 Oct 2010 14:50:57 +0000 (14:50 +0000)]
xfstests: randholes: encapsulate argument parsing

Move the argument parsing code out of main() and into a separate
parseargs() routine.  The name of the target file for the test
is returned by parseargs() if no error occurs.

Signed-off-by: Alex Elder <aelder@sgi.com>
Acked-by: Dave Chinner <david@fromorbit.com>
11 years agoxfstests: randholes: clean up readblks()
Alex Elder [Thu, 14 Oct 2010 14:50:51 +0000 (14:50 +0000)]
xfstests: randholes: clean up readblks()

Make readblks() a bit more readable by computing a few things
into local variables, and pulling out a few of the comma-separated
expressions that were previously in the for loop headers.

Signed-off-by: Alex Elder <aelder@sgi.com>
Acked-by: Dave Chinner <david@fromorbit.com>
11 years agoxfstests: randholes: encapsulate realtime setup code
Alex Elder [Thu, 14 Oct 2010 14:50:43 +0000 (14:50 +0000)]
xfstests: randholes: encapsulate realtime setup code

Encapsulate the code that sets up the use of files on the realtime
volume.  Using realtime implies direct I/O; move the code that makes
that so into the argument parsing code.

Signed-off-by: Alex Elder <aelder@sgi.com>
Acked-by: Dave Chinner <david@fromorbit.com>
11 years agoxfstests: randholes: use posix_memalign()
Alex Elder [Thu, 14 Oct 2010 14:50:36 +0000 (14:50 +0000)]
xfstests: randholes: use posix_memalign()

Use posix_memalign() rather than memalign() regardless of whether
direct I/O is to be used.  Don't store the dioattr data in a global
variable.

Signed-off-by: Alex Elder <aelder@sgi.com>
Acked-by: Dave Chinner <david@fromorbit.com>
11 years agoxfstests: randholes: encapsulate direct I/O setup code
Alex Elder [Thu, 14 Oct 2010 14:50:27 +0000 (14:50 +0000)]
xfstests: randholes: encapsulate direct I/O setup code

Pull the code used to get alignment information for direct I/O into
a separate function.

Signed-off-by: Alex Elder <aelder@sgi.com>
Acked-by: Dave Chinner <david@fromorbit.com>