Commit Graph

510 Commits

Author SHA1 Message Date
Dave Chinner 2529c9486a xfs: convert tests to SPDX license tags
Fully scripted conversion, see script in initial SPDX license commit
message.

tests/xfs/044 was hand massaged to remove duplicate copyright and
divider lines before running the script.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
2018-06-09 11:35:45 +10:00
Darrick J. Wong 8585efc1e6 xfs: make sure pretty printed geometry output matches
Make sure that all of our commands that can print geometry
information all print the /same/ information.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Eryu Guan <guaneryu@gmail.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
2018-06-08 14:12:25 +08:00
Darrick J. Wong 4609a0009d xfs: abstract xfs_info into $XFS_INFO_PROG
Abstract calls to xfs_info into $XFS_INFO_PROG like we do for all
other xfs utilities.

[Eryu: require xfs_info to be present if FSTYP is xfs]

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Eryu Guan <guaneryu@gmail.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
2018-06-08 14:12:18 +08:00
Darrick J. Wong 0fca2e5233 xfs/310: fix _require_scratch_nocheck ordering
In xfs/310 we have to _require_scratch_nocheck last because anything
else that calls _require_scratch (e.g. _require_xfs_scratch_rmapbt)
will create the "check scratch after test exit" file.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Eryu Guan <guaneryu@gmail.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
2018-06-08 14:12:09 +08:00
Darrick J. Wong 65022a47fc xfs/122: fix sb_fname[XFSLABEL_MAX] in test
We recently redefined sb_fname's array length to use a symbolic
constant instead of a magic number, so update this test accordingly.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Eryu Guan <guaneryu@gmail.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
2018-06-08 14:11:56 +08:00
Darrick J. Wong dcc690e862 xfs/439: don't check filesystem afterwards
We deliberately corrupted the scratch fs, so don't check it afterwards.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Eryu Guan <guaneryu@gmail.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
2018-06-08 14:11:50 +08:00
Xiao Yang f7f040063c xfs: Regression test for vulnerable directory integrity check
If a malicious XFS contains a block+ format directory wherein the
directory inode's core.mode is corrupted, and there are
subdirectories of the corrupted directory, an attempt to traverse up
the directory tree by running xfs_scrub will crash the kernel in
__xfs_dir3_data_check.

Signed-off-by: Xiao Yang <yangx.jy@cn.fujitsu.com>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
2018-06-05 08:44:13 +08:00
Jan Kara 90b383e215 xfs/310: Cleanup
Cleanup couple of things that were objected to when creating test
ext4/033 out of this one.

Use _require_scratch_nocheck instead of recreating scratch fs before
exiting. Avoid needless cleanup of dmhugedev on exit - _cleanup
takes care of that. Use _scratch_unmount where possible.

Signed-off-by: Jan Kara <jack@suse.cz>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
2018-06-03 22:16:15 +08:00
Dave Chinner c4f104cdf4 fstests: get rid of set_prog_path
It's just a one line wrapper that adds complexity, remove it. Move
the couple of calls in tests to common/config, but leave the xfsdump
setup in place and just convert it.

[Eryu: add the missing CHECKBASHISMS_PROG definition, define
mkfs.btrfs and mkfs.f2fs with set_mkfs_prog_path_with_opts]

Signed-off-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Jan Kara <jack@suse.cz>
Reviewed-by: Eryu Guan <guaneryu@gmail.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
2018-06-03 22:16:15 +08:00
Theodore Ts'o 72ec5e2ff7 fstests: update the punch, collapse, insert, and zero groups
Update the group files to annotate those tests which have a
_require_xfs_io_command for punch, collapse, insert, and zero.  This
makes it easier to exclude tests that use one of these fallocate
commands.  Or if you want to specifically test for those fallocate
commands you can do this.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Reviewed-by: Eryu Guan <guaneryu@gmail.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
2018-05-31 23:24:37 +08:00
Eric Sandeen 625515d61c xfs/206: filter/fix for minor geometry reporting changes
The pending common geometry printing function has removed the fiddly
little differences between the various utilities, so now we'll need
to accommodate that in xfs/206, which looks at mkfs & growfs output.

all now print "internal log" vs. just "internal"
ascii-ci now always has a "," after it

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Reviewed-by: Bill O'Donnell <billodo@redhat.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
2018-05-26 23:39:59 +08:00
Darrick J. Wong 8ee4d87d34 xfs/447: fix typo
Fix a trivial typo that keeps barfing up:
./tests/xfs/447: line 60: /dev_null: Read-only file system

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Eryu Guan <guaneryu@gmail.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
2018-05-26 16:59:16 +08:00
Omar Sandoval 39aca573e4 fstests: create swap group
I'm going to add a bunch of tests for swap files, so create a group
for them and add the existing tests.

Signed-off-by: Omar Sandoval <osandov@fb.com>
Reviewed-by: Eryu Guan <guaneryu@gmail.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
2018-05-23 09:58:58 +08:00
Zorro Lang 4b246619a4 common/quota: sort lines of repquota output
The golden image of some cases (e.g: generic/305 generic/326
generic/327 generic/328 xfs/214 xfs/330 and xfs/440) depend on the
output of repquota() function.

When it reports multi-users, we can't control the order of lines,
then always hit failures likes:

  ...
   Create the original files
  -root 3072 0 0
   nobody 0 0 0
   fsgqa 0 0 0
  +root 3072 0 0
  ...

So sort the lines to make sure it won't break the golden image.

Signed-off-by: Zorro Lang <zlang@redhat.com>
Reviewed-by: Eryu Guan <guaneryu@gmail.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
2018-05-21 16:40:54 +08:00
Jan Kara 968ccf32e4 generic: Handle missing [gs]etcap tools
Add proper requires for getcap and setcap tools to tests that need
them.  Also define standard variables GETCAP_PROG and SETCAP_PROG.

Signed-off-by: Jan Kara <jack@suse.cz>
Reviewed-by: Eryu Guan <guaneryu@gmail.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
2018-05-21 16:12:39 +08:00
Dave Chinner 5fc65da0a6 xfs: test mount vs superblock shrinker races
Test case for superblock shrinkers running while the filesystem is
being set up and/or torn down and tripping over inconsistent state.

Signed-Off-By: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Eryu Guan <guaneryu@gmail.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
2018-05-16 10:03:03 +08:00
Zorro Lang a82e9464dd xfs: skip growfs test on large device
When test on large SCRATCH_DEV, growing a small XFS to huge size is
a horrible thing (e.g grow 128M to 500T) and it doesn't add any more
test coverage. So skip this kind of tests if LARGE_SCRATCH_DEV is
yes.

Signed-off-by: Zorro Lang <zlang@redhat.com>
Reviewed-by: Eryu Guan <guaneryu@gmail.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
2018-05-14 23:19:58 +08:00
Darrick J. Wong 331edc6af6 xfs: checkbashisms in all script files
Find all the /bin/sh scripts in xfsprogs and check for bashisms.

Cc: sandeen@sandeen.net
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Eryu Guan <guaneryu@gmail.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
2018-05-11 20:55:35 +08:00
Dave Chinner 272ddcdd19 xfs: test inobt/on disk free state mismatches
Fuzzing has recently uncovered a couple of conditions where we don't
detect corruptions that reallocate already allocated inodes. This
test exercises those cases, and checks that we shut down the
filesystem appropriately when such a corruption occurs.

Signed-Off-By: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Eryu Guan <guaneryu@gmail.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
2018-05-11 18:40:04 +08:00
Dave Chinner f3851ad630 fstests: many dangerous+auto tests are not dangerous anymore
There are a bunch of tests that are run by the auto group that are
marked dangerous. This was done because the test exercised a crash
or other fatal error that has since been fixed. Remove the dangerous
tag from the auto tests that pass on a 4.17-rc3 kernel as they are
not dangerous anymore.

Signed-Off-By: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Eryu Guan <guaneryu@gmail.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
2018-05-11 09:36:26 +08:00
Amir Goldstein 00e3549c65 xfs/132: remove duplicate test
Test description says: "This is the same test as generic/156 except
that we also check the inode reflink flag.", only since commit
f1c3fee ("xfs: remove NOCOW_FL testing from test") it is almost
exactly the same test as generic/156.
almost - because since xfs/132 diverged from generic/156 the change
911efb0 ("reflink: change to relative margins") is only applied to
the original test.

Anyway, there doesn't seem to be a reason to keep this duplicated
test anymore, so remove it.

Signed-off-by: Amir Goldstein <amir73il@gmail.com>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
2018-05-06 01:18:26 +08:00
Darrick J. Wong 0828657542 xfs: fix blocktrash fuzzers
The blocktrash fuzz tests for xfs will try to mount and write to the
filesystem after corrupting it.  However, the mount may not necessarily
succeed, in which case we must not write junk to the root filesystem.
Use the new _try_scratch_mount to guard against that.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Eryu Guan <guaneryu@gmail.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
2018-05-02 16:56:19 +08:00
Darrick J. Wong e2fd1a080e xfs/422: add fsstress to the freeze-and-rmap-repair race test
Add fsstress to the pile of things that we race with rmap repair to
ensure that the rmap repair isolates the filesystem correctly while it
is doing its repairs.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Eryu Guan <guaneryu@gmail.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
2018-05-02 16:45:38 +08:00
Brian Foster 91481af949 xfs: filestream allocator inode use-after-free test
The XFS filestreams allocator caches dir inode -> agno mappings in
an MRU mechanism that holds elements in memory for an amount of time
and then cleans up expired elements in the background. The elements
typically held inode pointers without holding a reference to the
associated inode. This means that if the inode is reclaimed before
an expired entry is cleaned up, the MRU reaper can access freed
memory and cause a panic.

Test for this problem by performing continuous filestreams
allocations under short-lived parent directory inodes. This will
produce KASAN use-after-free splats if enabled during the test.

Signed-off-by: Brian Foster <bfoster@redhat.com>
Reviewed-by: Eryu Guan <guaneryu@gmail.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
2018-04-27 10:05:55 +08:00
yang xu 7ed53b9342 common/xfs: Add require_xfs_db_write_array function
xfsprogs commit 4222d00("db: write via array indexing doesn't
work") fixes a bug that xfs_db write can't support array indexing.
This function will check whether the bug is fixed on the current
xfsprogs.

xfs/444 applies the function, and skips if this bug exists.

Signed-off-by: yang xu <xuyang.jy@cn.fujitsu.com>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
2018-04-22 18:44:17 +08:00