Commit Graph

3549 Commits

Author SHA1 Message Date
Dave Chinner 99f34d0714 fstests: Add LICENSES directory
In preparation for changing tests over to use SPDX tags, add the
initial licenses needed for the common/ and tests/ changeover to
the LICENSES/ directory. For this initial patch set, only the GPLv2
license text is required.

The tests and other common scripts will be converted to tags via a
script and, if necessary touched up to fix any warts the script
can't handle. The script is run on a target via:

for f in `git grep -l "GNU General" <target>` ; do
	echo $f
	cat $f | awk -f hdr.awk > $f.new
	mv -f $f.new $f
done

This, unfortunately, changes the permissions of the files, so each
patch was post processed to remove the mode change fields from
the patches before they were committed. This preserves the file
modes, even though the files were replaced.

The awk script that dos all the substitution work is as follows:

$ cat hdr.awk
BEGIN {
        hdr = 1
        tag = "GPL-2.0"
	ignore = 0
        str = ""
	cstr = ""
}

/^#[\!#][ ]*\/bin\/bash/ {
	print $0
	next
}

/^#[\!#][ ]*.*\/perl/ {
	print $0
	next
}

/any later version./ {
        tag = "GPL-2.0+"
        next
}

/^#[\-]{65}/ {
	if (hdr == 1 && ignore == 0) {
		ignore = 1
		hdr = 0
	} else if (ignore == 1) {
		# use this to ignore empty comment line after license
		ignore = 2
	}
	next
}

/This program is free software/ {
	if (hdr == 1 && ignore == 0) {
		ignore = 1
		hdr = 0
	}
	next
}

/02110-1301[, ] *USA/ {
	# use this to ignore empty comment line after license
	if (ignore = 1) {
		ignore = 2
	}
	next
}

/^#[ ]*Copyright/ {
	if (cstr != "")
		cstr = cstr "\n"
	cstr = cstr $0
	next
}

// {
	if (ignore == 2) {
		print "# SPDX-License-Identifier: " tag
		print cstr "\n#"
		print str
		str=""
		ignore = 3

	}
	if (ignore == 1) {
		next
	} else if (ignore == 3) {
		# ignore trailing empty comment lines
		if ($0 == "#")
			next
		ignore = 0
	}

	if (str != "")
		str = str "\n"
	str = str $0
}

END {
	print str
}
$

Signed-off-by: Dave Chinner <dchinner@redhat.com>
2018-06-09 11:29:45 +10:00
Darrick J. Wong 25ce974006 generic: test swapfile creation, activation, and deactivation
Test swapfile activation and deactivation.

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:27 +08: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
Amir Goldstein b22c18ca9c generic/401: fix test in case of no filetype support
Xu Huan reported that this test fails on nfs in some setup.
Apparently, the assumptions made about xfs/ext* do not hold
for nfs.

Relax the verification of filetype not supported case to
allow either DT_UNKNOWN or actual file type on all files and
not only on special dir entires "." and "..".

Convert the unknown d_type replacement code from awk to bash
so it is a bit more readable and flexible.

Reported-by: Xu Huan <xuhuan.fnst@cn.fujitsu.com>
Signed-off-by: Amir Goldstein <amir73il@gmail.com>
Tested-by: Xu Huan <xuhuan.fnst@cn.fujitsu.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
2018-06-07 18:41:10 +08:00
Amir Goldstein 668a411a73 overlay: nicer report when features are not supported
Commit ea7ad43 ("fstests: implement require of multiple overlayfs
features") changed the message when tests are not run due to missing
overlayfs feature.

Restore the check for existing module param before trying to mount
which restores the old message format, e.g.:

[not run] feature 'metacopy' not supported by overlay

Signed-off-by: Amir Goldstein <amir73il@gmail.com>
Reviewed-by: Eryu Guan <guaneryu@gmail.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
2018-06-07 16:58:37 +08:00
xiaoli feng b96c9912a7 common/rc: skip atime related tests on CIFS
From the feedback of cifs developer, the behaviour of atime/noatime
for cifs is basically noatime always. So the atime related mount
options have no effect on cifs mounts. And Skip these tests on CIFS.

Signed-off-by: xiaoli feng <xifeng@redhat.com>
Acked-by: Steve French <smfrench@gmail.com>
Acked-by: Ronnie Sahlberg <lsahlber@redhat.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
2018-06-07 13:42:38 +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
Xiao Yang f99695e4da common/rc: Fix _require_xfs_io_command for scrub probe
Currently, xfs_io scrub command doesn't allow the probe function
to have any parameter, so we remove the invalid parameter.

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:43:16 +08:00
Dave Chinner 06dc7f12ad check: fail tests if check/dmesg are not clean
Currently a test appears to pass even if it leaves a corrupt
filesystem behind, or a splat in the system logs that should not be
there. While the test is internally tracked as failed (and the
summary reports it as failed) the per-test output exits with a
success and so emits a completion time before the post-test checks
are run by the test harness.  Rework the check code to report
post-test check failures as specific test failures rather than as
separate failure line items in the overall harness output.

Reworking where we emit the errors this also allows us to include
the post-test filesystem checking in the test runtime. This is
currently not accounted to the test and can be substantial. Hence
the real elapsed time of each test is not accurately reflected in
the time stats being reported and so regressions in filesystem
checking performance go unnoticed.

Changing the output reporting requires a complete reworking of the
main test check loop. It's a bunch of spaghetti at the moment
because it has post test reporting code at the end of the loop which
must run regardless of the test result.  By moving the post test
reporting to the start of the next loop iteration, we can clean up
the code substantially by using continue directives where
appropriate.

Also, for cases where we haven't run the test or it's already been
marked as failed, don't bother running the filesystem/dmesg checks
for failure as we're already going to report the test as failed.

This touches almost all of the loop, so get rid of the remaining
4 space indents inside the loop while moving all this code around.

[Eryu: fixed wrong test seq name issue in xUnit report when test hit
"continue" in the check loop, e.g. notrun, with Dave ACKing the fix]

Signed-Off-By: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Eryu Guan <guaneryu@gmail.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
2018-06-04 13:04:22 +08:00
Vivek Goyal 5dff991a52 overlay: Add tests for overlay metadata only copy up feature
Add tests for metadata only copy up feature.

Signed-off-by: Vivek Goyal <vgoyal@redhat.com>
Reviewed-by: Amir Goldstein <amir73il@gmail.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
2018-06-03 22:24:05 +08:00
Anand Jain 144c8463d3 btrfs: introduce btrfs/volume group
The btrfs/volume group represent a set of btrfs test-cases, which
shall intend to verify the relevant btrfs volume operations.

Under this new group all the existing btrfs/replace group would come
under, and also the device operations test cases which does not have
any group as of now. This group is helpful to verify the btrfs
volume related changes.

Run as
  ./check -g btrfs/volume

Signed-off-by: Anand Jain <anand.jain@oracle.com>
Reviewed-by: Eryu Guan <guaneryu@gmail.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
2018-06-03 22:16:15 +08:00
Anand Jain f3a33a9dda btrfs: seed device delete test
Test case to verify that a seed device can be deleted

Signed-off-by: Anand Jain <anand.jain@oracle.com>
Reviewed-by: Eryu Guan <guaneryu@gmail.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
2018-06-03 22:16:15 +08:00
Anand Jain a281d39579 btrfs: seed device replace test
Test case to verify that a seed device can be replaced

Signed-off-by: Anand Jain <anand.jain@oracle.com>
Reviewed-by: Eryu Guan <guaneryu@gmail.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
2018-06-03 22:16:15 +08:00
Anand Jain 0eb4d09446 btrfs: nested seed device test
Test case to verify that a sprout device can be a seed device

Signed-off-by: Anand Jain <anand.jain@oracle.com>
Reviewed-by: Eryu Guan <guaneryu@gmail.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
2018-06-03 22:16:15 +08:00
Anand Jain 549016e820 btrfs: add seed sprout functionality test
Create a seed device and add the sprout device to it.

Signed-off-by: Anand Jain <anand.jain@oracle.com>
Reviewed-by: Eryu Guan <guaneryu@gmail.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
2018-06-03 22:16:15 +08:00
Mark Fasheh 2f194e4e82 generic/009: don't run for btrfs if PAGE_SIZE > 4096
Btrfs has the same issue as XFS here in that the extent layout on a
> 4096 page size system will not match what is reflected in the test
output.

Signed-off-by: Mark Fasheh <mfasheh@suse.de>
Reviewed-by: Eryu Guan <guaneryu@gmail.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
2018-06-03 22:16:15 +08:00
Jan Kara 41b0826807 ext4/306: Fixup resize2fs usage
Use $RESIZE2FS_PROG instead of direct name to call program with full
path. Also add an appropriate feature test.

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
Jan Kara 5a111436bb ext4/010: Fixup resize2fs and dumpe2fs usage
Use $RESIZE2FS_PROG and $DUMPE2FS_PROG instead of names directly to
make progs be executed with full path. Also add proper feature test
macros.

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
Jan Kara 042fcd24db ext4/032: Fix up resize2fs usage
The test uses resize2fs(8) without proper feature test macro and
also without specifying full path to it. Fix that.

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
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
Jan Kara 678c3f477d ext4: Test for s_inodes_count overflow during fs resize
Test for overflow of s_inodes_count during filesystem resizing.

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