xfstests: test the nfs/cifs/btrfs/xfs reflink/dedupe ioctls
cover xfstests: test the nfs/cifs/btrfs/xfs reflink/dedupe ioctls
Hi all,
This is a small patch set against the reflink/dedupe test cases in xfstests. The first patch is a rewrite of the tools to find the lowest vacant ID number and to move a test case. These two programs are useful for staging a lot of new tests at a high number and moving them to lower numbers when the maintainer wants to accept the new tests.
The second patch updates the golden output for the test that examines the results of feeding bad inputs to the two ioctls. The new error values are based on a discussion of how to react to bad file types on the mailing lists and the ongoing work to hoist the ioctls to the VFS level.
The third patch has a few more tests for things that I found while rewriting XFS copy-on-write, and for explicitly testing the ability to reflink/dedupe "to the end of the file" by setting len == 0. These tests are new and need more careful review than the first two patches.
If you're going to start using this mess, you probably ought to just pull from my github trees for kernel[1], xfsprogs[2], xfstests[3], and xfs-docs[4]. They should just work with the btrfs that's in 4.4... and somewhat buggily with the 4.4 XFS patched with [1]. The relevant xfs_io support will be in xfsprogs 4.3 though it still needs a patch to fix len == 0 support. Probably easier just to grab [2] and build that.
Comments and questions are, as always, welcome.
--D
[1] https://github.com/djwong/linux/tree/for-dave
[2] https://github.com/djwong/xfsprogs/tree/for-dave
[3] https://github.com/djwong/xfstests/tree/for-dave
[4] https://github.com/djwong/xfs-documentation/tree/for-dave
PATCH 1/3 test-scripts: test migration scripts
Add two scripts: "nextid" finds the next available test ID number in a group, and "mvtest" relocates a test, fixes the golden output, and moves the group entry for that test.
v2: sorting group files should preserve group order; nextid should use the same algorithm as new; move both tools to tools/.
--- tools/mvtest | 55 +++++++++++++++++++++++++++ tools/nextid | 1 tools/sort-group | 112 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 168 insertions(+) create mode 100755 tools/mvtest create mode 120000 tools/nextid create mode 100755 tools/sort-group
tools/mvtest new file +55 -0
@@ -0,0 +1,55 @@ +#!/bin/sh + +# Renumber a test +dir="$(dirname "$0")" + +if [ -z "$1" ] || [ "$1" = "--help" ]; then + echo "Usage: $0 path_to_test new_path_to_test" + exit 1 +fi + +src="$1" +dest="$2" + +die() { + echo "$@" + exit 1 +} + +append() { + out="$1" + shift + echo "$@" >> "${out}" +} + +test "${src}" != "${dest}" || die "Test \"${src}\" is the same as dest." +test -e "tests/${src}" || die "Test \"${src}\" does not exist." +test ! -e "tests/${dest}" || die "Test \"${src}\" already exists." + +sid="$(basename "${src}")" +did="$(basename "${dest}")" + +sgroup="$(basename "$(dirname "tests/${src}")")" +dgroup="$(basename "$(dirname "tests/${dest}")")" + +sgroupfile="tests/${sgroup}/group" +dgroupfile="tests/${sgroup}/group" + +git mv "tests/${src}" "tests/${dest}" +git mv "tests/${src}.out" "tests/${dest}.out" +sed -e "s/^# FS QA Test No. ${sid}$/# FS QA Test No. ${did}/g" -i "tests/${dest}" +sed -e "s/^QA output created by ${sid}$/QA output created by ${did}/g" -i "tests/${dest}.out" +sed -e "s/test-${sid}/test-${did}/g" -i "tests/${dest}.out" + +grpline="$(grep "^${sid} " "${sgroupfile}")" +newgrpline="$(echo "${grpline}" | sed -e "s/^${sid} /${did} /g")" + +sed -e "/^${sid}.*$/d" -i "${sgroupfile}" +cp "${dgroupfile}" "${dgroupfile}.new" +append "${dgroupfile}.new" "${newgrpline}" +"${dir}/sort-group.py" "${dgroupfile}.new" +mv "${dgroupfile}.new" "${dgroupfile}" + +echo "Moved \"${src}\" to \"${dest}\"." + +exit 0
tools/nextid new file +1 -0
@@ -0,0 +1 @@ +sort-group
tools/sort-group new file +112 -0
112 lines not on this page · raw message
PATCH 2/3 generic/15[78]: fix error messages in the golden output
In reply to Darrick J. WongFix the error messages in the golden output for generic/15[78], which examine the responses to invalid inputs as returned by the clone/clone_range/extent_same ioctls. Also fix a filtering omission.
--- tests/generic/157 | 18 +++++++++++++----- tests/generic/157.out | 6 +++--- tests/generic/158 | 18 +++++++++++++----- tests/generic/158.out | 8 ++++---- 4 files changed, 33 insertions(+), 17 deletions(-)
tests/generic/157 +13 -5
@@ -75,10 +75,18 @@ mkdir "$TESTDIR1/dir1" seq 1 $((2 * BLKSZ / 250)) | while read f; do touch "$TESTDIR1/dir1/$f" done -mknod "$TESTDIR1/dev1" b 8 0 +mknod "$TESTDIR1/dev1" c 1 3 mkfifo "$TESTDIR1/fifo1" sync +_filter_enotty() { + sed -e 's/Inappropriate ioctl for device/Invalid argument/g' +} + +_filter_einval() { + sed -e 's/Invalid argument/Bad file descriptor/g' +} + echo "Try cross-device reflink" _reflink_range "$TESTDIR1/file1" 0 "$TESTDIR2/file1" 0 $BLKSZ
@@ -98,16 +106,16 @@ echo "Try to reflink a device" _reflink_range "$TESTDIR1/dev1" 0 "$TESTDIR1/file2" 0 $BLKSZ echo "Try to reflink to a dir" -_reflink_range "$TESTDIR1/file1" 0 "$TESTDIR1/dir1" 0 $BLKSZ +_reflink_range "$TESTDIR1/file1" 0 "$TESTDIR1/dir1" 0 $BLKSZ 2>&1 | _filter_test_dir echo "Try to reflink to a device" -_reflink_range "$TESTDIR1/file1" 0 "$TESTDIR1/dev1" 0 $BLKSZ +_reflink_range "$TESTDIR1/file1" 0 "$TESTDIR1/dev1" 0 $BLKSZ 2>&1 | _filter_enotty echo "Try to reflink to a fifo" -_reflink_range "$TESTDIR1/file1" 0 "$TESTDIR1/fifo1" 0 $BLKSZ -n +_reflink_range "$TESTDIR1/file1" 0 "$TESTDIR1/fifo1" 0 $BLKSZ -n 2>&1 | _filter_enotty echo "Try to reflink an append-only file" -_reflink_range "$TESTDIR1/file1" 0 "$TESTDIR1/file3" 0 $BLKSZ -a +_reflink_range "$TESTDIR1/file1" 0 "$TESTDIR1/file3" 0 $BLKSZ -a 2>&1 | _filter_einval echo "Reflink two files" _reflink_range "$TESTDIR1/file1" 0 "$TESTDIR1/file2" 0 $BLKSZ >> "$seqres.full"
tests/generic/157.out +3 -3
@@ -14,11 +14,11 @@ XFS_IOC_CLONE_RANGE: Is a directory Try to reflink a device XFS_IOC_CLONE_RANGE: Invalid argument Try to reflink to a dir -/mnt/test-157/dir1: Is a directory +TEST_DIR/test-157/dir1: Is a directory Try to reflink to a device -XFS_IOC_CLONE_RANGE: Operation not supported +XFS_IOC_CLONE_RANGE: Invalid argument Try to reflink to a fifo -XFS_IOC_CLONE_RANGE: Operation not supported +XFS_IOC_CLONE_RANGE: Invalid argument Try to reflink an append-only file XFS_IOC_CLONE_RANGE: Bad file descriptor Reflink two files
tests/generic/158 +13 -5
@@ -76,10 +76,18 @@ mkdir "$TESTDIR1/dir1" seq 1 $((2 * BLKSZ / 250)) | while read f; do touch "$TESTDIR1/dir1/$f" done -mknod "$TESTDIR1/dev1" b 8 0 +mknod "$TESTDIR1/dev1" c 1 3 mkfifo "$TESTDIR1/fifo1" sync +_filter_enotty() { + sed -e 's/Inappropriate ioctl for device/Invalid argument/g' +} + +_filter_eperm() { + sed -e 's/Permission denied/Invalid argument/g' +} + echo "Try cross-device dedupe" _dedupe_range "$TESTDIR1/file1" 0 "$TESTDIR2/file1" 0 $BLKSZ
@@ -96,16 +104,16 @@ echo "Try to dedupe a dir" _dedupe_range "$TESTDIR1/dir1" 0 "$TESTDIR1/file2" 0 $BLKSZ echo "Try to dedupe a device" -_dedupe_range "$TESTDIR1/dev1" 0 "$TESTDIR1/file2" 0 $BLKSZ +_dedupe_range "$TESTDIR1/dev1" 0 "$TESTDIR1/file2" 0 $BLKSZ 2>&1 | _filter_enotty echo "Try to dedupe to a dir" -_dedupe_range "$TESTDIR1/file1" 0 "$TESTDIR1/dir1" 0 $BLKSZ +_dedupe_range "$TESTDIR1/file1" 0 "$TESTDIR1/dir1" 0 $BLKSZ 2>&1 | _filter_test_dir echo "Try to dedupe to a device" -_dedupe_range "$TESTDIR1/file1" 0 "$TESTDIR1/dev1" 0 $BLKSZ +_dedupe_range "$TESTDIR1/file1" 0 "$TESTDIR1/dev1" 0 $BLKSZ 2>&1 | _filter_eperm echo "Try to dedupe to a fifo" -_dedupe_range "$TESTDIR1/file1" 0 "$TESTDIR1/fifo1" 0 $BLKSZ -n +_dedupe_range "$TESTDIR1/file1" 0 "$TESTDIR1/fifo1" 0 $BLKSZ -n 2>&1 | _filter_eperm echo "Try to dedupe an append-only file" _dedupe_range "$TESTDIR1/file1" 0 "$TESTDIR1/file3" 0 $BLKSZ -a >> "$seqres.full"
tests/generic/158.out +4 -4
@@ -12,13 +12,13 @@ dedupe: Invalid argument Try to dedupe a dir XFS_IOC_FILE_EXTENT_SAME: Is a directory Try to dedupe a device -XFS_IOC_FILE_EXTENT_SAME: Permission denied +XFS_IOC_FILE_EXTENT_SAME: Invalid argument Try to dedupe to a dir -/mnt/test-158/dir1: Is a directory +TEST_DIR/test-158/dir1: Is a directory Try to dedupe to a device -dedupe: Permission denied +dedupe: Invalid argument Try to dedupe to a fifo -dedupe: Permission denied +dedupe: Invalid argument Try to dedupe an append-only file Dedupe two files Check scratch fs
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
PATCH 3/3 reflink: more tests
In reply to Darrick J. WongAdd more tests for unaligned copy-on-write things, and explicitly test the ability to pass "len == 0" to mean reflink/dedupe all the way to the end of the file".
--- tests/generic/820 | 77 ++++++++++++++++++++++++++++++++ tests/generic/820.out | 8 +++ tests/generic/847 | 96 ++++++++++++++++++++++++++++++++++++++++ tests/generic/847.out | 11 +++++ tests/generic/848 | 96 ++++++++++++++++++++++++++++++++++++++++ tests/generic/848.out | 11 +++++ tests/generic/849 | 80 ++++++++++++++++++++++++++++++++++ tests/generic/849.out | 6 +++ tests/generic/850 | 117 +++++++++++++++++++++++++++++++++++++++++++++++++ tests/generic/850.out | 17 +++++++ tests/generic/group | 5 ++ 11 files changed, 524 insertions(+) create mode 100755 tests/generic/820 create mode 100644 tests/generic/820.out create mode 100755 tests/generic/847 create mode 100644 tests/generic/847.out create mode 100755 tests/generic/848 create mode 100644 tests/generic/848.out create mode 100755 tests/generic/849 create mode 100644 tests/generic/849.out create mode 100755 tests/generic/850 create mode 100644 tests/generic/850.out
tests/generic/820 new file +77 -0
@@ -0,0 +1,77 @@ +#! /bin/bash +# FS QA Test No. 820 +# +# Ensure that punch-hole doesn't clobber CoW. +# +#----------------------------------------------------------------------- +# Copyright (c) 2015, Oracle and/or its affiliates. All Rights Reserved. +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation. +# +# This program is distributed in the hope that it would be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write the Free Software Foundation, +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +#----------------------------------------------------------------------- + +seq=`basename "$0"` +seqres="$RESULT_DIR/$seq" +echo "QA output created by $seq" + +here=`pwd` +tmp=/tmp/$$ +status=1 # failure is the default! +trap "_cleanup; exit \$status" 0 1 2 3 15 + +_cleanup() +{ + cd / + rm -rf "$tmp".* "$TESTDIR" +} + +# get standard environment, filters and checks +. ./common/rc +. ./common/filter +. ./common/reflink + +# real QA test starts here +_supported_os Linux +_require_test_reflink +_require_cp_reflink +_require_xfs_io_command "fpunch" + +rm -f "$seqres.full" + +TESTDIR="$TEST_DIR/test-$seq" +rm -rf "$TESTDIR" +mkdir "$TESTDIR" + +echo "Create the original files" +BLKSZ=65536 +NR=512 +_pwrite_byte 0x61 0 $((BLKSZ * NR)) "$TESTDIR/file1" >> "$seqres.full" + +_cp_reflink "$TESTDIR/file1" "$TESTDIR/file2" +_test_remount + +md5sum "$TESTDIR/file1" | _filter_test_dir +md5sum "$TESTDIR/file2" | _filter_test_dir + +echo "Write and punch" +_pwrite_byte 0x62 0 $((BLKSZ * 256)) "$TESTDIR/file2" >> "$seqres.full" +"$XFS_IO_PROG" -f -c "fpunch $BLKSZ $((BLKSZ * 254))" "$TESTDIR/file2" +_test_remount + +echo "Compare results" +md5sum "$TESTDIR/file1" | _filter_test_dir +md5sum "$TESTDIR/file2" | _filter_test_dir + +# success, all done +status=0 +exit
tests/generic/820.out new file +8 -0
@@ -0,0 +1,8 @@ +QA output created by 820 +Create the original files +bc3d7c2ff64219e33239f2e13c2d21db TEST_DIR/test-820/file1 +bc3d7c2ff64219e33239f2e13c2d21db TEST_DIR/test-820/file2 +Write and punch +Compare results +bc3d7c2ff64219e33239f2e13c2d21db TEST_DIR/test-820/file1 +95cfd19ce56010430dc2057413d7efc5 TEST_DIR/test-820/file2
tests/generic/847 new file +96 -0
96 lines not on this page · raw message
tests/generic/847.out new file +11 -0
@@ -0,0 +1,11 @@ +QA output created by 847 +Create the original files +998b4ba52f2940dc515001e75926b19f TEST_DIR/test-847/file1 +998b4ba52f2940dc515001e75926b19f TEST_DIR/test-847/file2 +8cdf70c9cfb33bdc7397806b87e7c7ea TEST_DIR/test-847/file2.chk +fpunch files +Compare files +998b4ba52f2940dc515001e75926b19f TEST_DIR/test-847/file1 +8cdf70c9cfb33bdc7397806b87e7c7ea TEST_DIR/test-847/file2 +8cdf70c9cfb33bdc7397806b87e7c7ea TEST_DIR/test-847/file2.chk +Compare against check files
tests/generic/848 new file +96 -0
96 lines not on this page · raw message
tests/generic/848.out new file +11 -0
@@ -0,0 +1,11 @@ +QA output created by 848 +Create the original files +998b4ba52f2940dc515001e75926b19f TEST_DIR/test-848/file1 +998b4ba52f2940dc515001e75926b19f TEST_DIR/test-848/file2 +8cdf70c9cfb33bdc7397806b87e7c7ea TEST_DIR/test-848/file2.chk +fzero files +Compare files +998b4ba52f2940dc515001e75926b19f TEST_DIR/test-848/file1 +8cdf70c9cfb33bdc7397806b87e7c7ea TEST_DIR/test-848/file2 +8cdf70c9cfb33bdc7397806b87e7c7ea TEST_DIR/test-848/file2.chk +Compare against check files
tests/generic/849 new file +80 -0
80 lines not on this page · raw message
tests/generic/849.out new file +6 -0
@@ -0,0 +1,6 @@ +QA output created by 849 +Create the original files +f4820540fc0ac02750739896fe028d56 TEST_DIR/test-849/file1 +dc881c004745c49f7f4e9cc766f57bc8 TEST_DIR/test-849/file2 +dc881c004745c49f7f4e9cc766f57bc8 TEST_DIR/test-849/file2.chk +Compare against check files
tests/generic/850 new file +117 -0
117 lines not on this page · raw message
tests/generic/850.out new file +17 -0
@@ -0,0 +1,17 @@ +QA output created by 850 +Create the original files +f4820540fc0ac02750739896fe028d56 TEST_DIR/test-850/file1 +69ad53078a16243d98e21d9f8704a071 TEST_DIR/test-850/file2 +69ad53078a16243d98e21d9f8704a071 TEST_DIR/test-850/file2.chk +Compare against check files +Make the original file almost dedup-able +f4820540fc0ac02750739896fe028d56 TEST_DIR/test-850/file1 +158d4e3578b94b89cbb44493a2110fb9 TEST_DIR/test-850/file2 +158d4e3578b94b89cbb44493a2110fb9 TEST_DIR/test-850/file2.chk +Compare against check files +Make the original file dedup-able +f4820540fc0ac02750739896fe028d56 TEST_DIR/test-850/file1 +113c7055ffe3d24d2dec27e82ab55abd TEST_DIR/test-850/file2 +113c7055ffe3d24d2dec27e82ab55abd TEST_DIR/test-850/file2.chk +file1 and file2 should match +Compare against check files
tests/generic/group +5 -0
@@ -257,3 +257,8 @@ 323 auto aio stress 324 auto fsr quick 325 auto quick data log +820 auto quick clone +847 auto quick clone +848 auto quick clone +849 auto quick clone +850 auto quick clone
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 3/3] reflink: more tests
The new 849 fails reliably on btrfs, which makes me wonder if either the test is doing something wrong, or the btrfs whole file clone behavior is broken, which wouldn't be very reasuring. I didn't have time to look into why it's failing yet.
Re: [PATCH 3/3] reflink: more tests
Quoted 4 lines · Christoph Hellwig
The new 849 fails reliably on btrfs, which makes me wonder if either the test is doing something wrong, or the btrfs whole file clone behavior is broken, which wouldn't be very reasuring. I didn't have time to look into why it's failing yet.
Huh. Works reliably for /me; could you send me the output from 849?
--D
Quoted 4 lines
--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 3/3] reflink: more tests
Quoted 7 lines · Darrick J. Wong
Quoted 4 lines · Christoph Hellwig
The new 849 fails reliably on btrfs, which makes me wonder if either the test is doing something wrong, or the btrfs whole file clone behavior is broken, which wouldn't be very reasuring. I didn't have time to look into why it's failing yet.
Huh. Works reliably for /me; could you send me the output from 849?
--- tests/generic/849.out 2015-12-09 15:31:50.492879152 +0000
+++ /root/xfstests/results//generic/849.out.bad 2015-12-11
00:02:25.154347175 +0000
@@ -1,6 +1,7 @@
QA output created by 849
Create the original files
f4820540fc0ac02750739896fe028d56 TEST_DIR/test-849/file1 -dc881c004745c49f7f4e9cc766f57bc8 TEST_DIR/test-849/file2 +eb34153e9ed1e774db28cbbe4090a449 TEST_DIR/test-849/file2 dc881c004745c49f7f4e9cc766f57bc8 TEST_DIR/test-849/file2.chk
Compare against check files
+file2 and file2.chk do not match