Skip to contentSkip to conversation

xfstests: for btrfs publishing/export patchset (v4)

PATCH New Jeff Mahoney 1 participant 4 messages Oct 29, 2013 Btrfs file system

lore
Share & tools
lore
#0 lore raw

cover xfstests: for btrfs publishing/export patchset (v4)

These are the tests that Josef requested accompany the submission of the btrfs publishing/export patchset[1].

021: Test new global metadata reservation ioctl
022: Test new sysfs exporting of allocation and device membership 023: Test new sysfs exporting of feature bits
024: Test setting/clearing feature bits via ioctl
025: Test setting/clearing feature bits via sysfs

As part of the ioctl testing, I added a helper that can be extended easily to export simple information via ioctl. This means that the tests can be independent of btrfsprogs version or its output formatting.

V2:
- Used next numbers in sequence
- Better commit messages
- Fixed handling of the missing feature cases
- Fixed issues raised in Josef's review

V3:
- Fixed missing output in btrfs/023 when the ioctls arent't supported
- Fixed missing umount introduced in V2

V4:
- I was running the tests directly, not through check and didn't catch these:
- Fixed incorrect output from 022 while running under check
- Added tests to group file

-Jeff

[1] http://thread.gmane.org/gmane.comp.file-systems.btrfs/29307

#1 lore raw

PATCH 1/3 xfstests: btrfs/021: test global metadata reservation reporting

Btrfs can now report the size of the global metadata reservation via icotl and sysfs.

This test confirms that we get sane results on an empty file system.

ENOTTY and missing /sys/fs/btrfs/<fsid>/allocation are not considered failures.

---
 common/rc                |    6 +++
 src/Makefile             |    3 +
 src/btrfs_ioctl_helper.c |   90 +++++++++++++++++++++++++++++++++++++++++++++++
 tests/btrfs/021          |   88 +++++++++++++++++++++++++++++++++++++++++++++
 tests/btrfs/021.out      |    2 +
 tests/btrfs/group        |    1 
 6 files changed, 189 insertions(+), 1 deletion(-)
 create mode 100644 src/btrfs_ioctl_helper.c
 create mode 100755 tests/btrfs/021
 create mode 100644 tests/btrfs/021.out
common/rc +6 -0
@@ -65,6 +65,12 @@ _btrfs_get_subvolid()
 	$BTRFS_UTIL_PROG sub list $mnt | grep $name | awk '{ print $2 }'
 }
 
+_btrfs_get_fsid()
+{
+	local dev=$1
+	$BTRFS_UTIL_PROG filesystem show $dev|awk '/uuid:/ {print $NF}'
+}
+
 # Prints the md5 checksum of a given file
 _md5_checksum()
 {
src/Makefile +2 -1
@@ -18,7 +18,8 @@ LINUX_TARGETS = xfsctl bstat t_mtab getd
 	locktest unwritten_mmap bulkstat_unlink_test t_stripealign \
 	bulkstat_unlink_test_modified t_dir_offset t_futimens t_immutable \
 	stale_handle pwrite_mmap_blocked t_dir_offset2 seek_sanity_test \
-	seek_copy_test t_readdir_1 t_readdir_2 fsync-tester nsexec
+	seek_copy_test t_readdir_1 t_readdir_2 fsync-tester nsexec \
+	btrfs_ioctl_helper
 
 SUBDIRS =
 
src/btrfs_ioctl_helper.c new file +90 -0

90 lines not on this page · raw message

tests/btrfs/021 new file +88 -0

88 lines not on this page · raw message

tests/btrfs/021.out new file +2 -0
@@ -0,0 +1,2 @@
+== QA output created by 021
+Silence is golden
tests/btrfs/group +1 -0
@@ -23,3 +23,4 @@
 018 auto quick
 019 auto quick
 020 auto quick
+021 auto quick
#2 lore raw

PATCH 2/3 xfstests: btrfs/022: test sysfs exports of allocation and device membership info

In reply to Jeff Mahoney

This tests the sysfs publishing for btrfs allocation and device membership info under a number of different layouts, similar to the btrfs replace test. We test the allocation files only for existence and that they contain numerical values. We test the device membership by mapping the devices used to create the file system to sysfs paths and matching them against the paths used for the device membership symlinks.

Since this is a new feature, it passes on kernels without a /sys/fs/btrfs/<fsid> directory.

---
 common/config       |    1 
 tests/btrfs/022     |  190 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 tests/btrfs/022.out |    2 
 tests/btrfs/group   |    1 
 4 files changed, 194 insertions(+)
 create mode 100755 tests/btrfs/022
 create mode 100644 tests/btrfs/022.out
common/config +1 -0
@@ -209,6 +209,7 @@ case "$HOSTOS" in
         export MKFS_UDF_PROG="`set_prog_path mkudffs`"
         export MKFS_BTRFS_PROG="`set_btrfs_mkfs_prog_path_with_opts`"
         export BTRFS_UTIL_PROG="`set_prog_path btrfs`"
+        export UDEVADM_PROG="`set_prog_path udevadm`"
         export BTRFS_SHOW_SUPER_PROG="`set_prog_path btrfs-show-super`"
         export XFS_FSR_PROG="`set_prog_path xfs_fsr`"
         export MKFS_NFS_PROG="false"
tests/btrfs/022 new file +190 -0

190 lines not on this page · raw message

tests/btrfs/022.out new file +2 -0
@@ -0,0 +1,2 @@
+== QA output created by 022
+Silence is golden
tests/btrfs/group +1 -0
@@ -24,3 +24,4 @@
 019 auto quick
 020 auto quick
 021 auto quick
+022 auto
#3 lore raw

PATCH 3/3 xfstests: btrfs/023,024,025: test feature ioctl and sysfs interfaces

In reply to Jeff Mahoney

This tests the exporting of feature information from the kernel via sysfs and ioctl. The first test works whether the sysfs permissions are correct, if the information exported via sysfs matches what the ioctls are reporting, and if they both match the on-disk superblock's version of the feature sets. The second and third tests test online setting and clearing of feature bits via the sysfs and ioctl interfaces, checking whether they match the on-disk super on each cycle.

In every case, if the features are not present, it is not considered a failure and a message indicating that will be dumped to the $num.full file.

---
 common/rc                |    7 +
 src/btrfs_ioctl_helper.c |   89 +++++++++++++++
 tests/btrfs/023          |  269 +++++++++++++++++++++++++++++++++++++++++++++++
 tests/btrfs/023.out      |    2 
 tests/btrfs/024          |  185 ++++++++++++++++++++++++++++++++
 tests/btrfs/024.out      |    2 
 tests/btrfs/025          |  178 +++++++++++++++++++++++++++++++
 tests/btrfs/025.out      |    2 
 tests/btrfs/group        |    3 
 9 files changed, 737 insertions(+)
 create mode 100755 tests/btrfs/023
 create mode 100644 tests/btrfs/023.out
 create mode 100755 tests/btrfs/024
 create mode 100644 tests/btrfs/024.out
 create mode 100755 tests/btrfs/025
 create mode 100644 tests/btrfs/025.out
common/rc +7 -0
@@ -71,6 +71,13 @@ _btrfs_get_fsid()
 	$BTRFS_UTIL_PROG filesystem show $dev|awk '/uuid:/ {print $NF}'
 }
 
+_btrfs_get_feature_flags()
+{
+	local dev=$1
+	local class=$2
+	$BTRFS_SHOW_SUPER_PROG $dev | grep ^${class}_flags | awk '{print $NF}'
+}
+
 # Prints the md5 checksum of a given file
 _md5_checksum()
 {
src/btrfs_ioctl_helper.c +89 -0

113 lines not on this page · raw message

tests/btrfs/023 new file +269 -0

269 lines not on this page · raw message

tests/btrfs/023.out new file +2 -0
@@ -0,0 +1,2 @@
+== QA output created by 023
+Silence is golden
tests/btrfs/024 new file +185 -0

185 lines not on this page · raw message

tests/btrfs/024.out new file +2 -0
@@ -0,0 +1,2 @@
+== QA output created by 024
+Silence is golden
tests/btrfs/025 new file +178 -0

178 lines not on this page · raw message

tests/btrfs/025.out new file +2 -0
@@ -0,0 +1,2 @@
+== QA output created by 025
+Silence is golden
tests/btrfs/group +3 -0
@@ -25,3 +25,6 @@
 020 auto quick
 021 auto quick
 022 auto
+023 auto quick
+024 auto quick
+025 auto quick