* [PATCH 1/3] test-scripts: test migration scripts
2015-12-08 6:28 [PATCH v3.4 0/3] xfstests: test the nfs/cifs/btrfs/xfs reflink/dedupe ioctls Darrick J. Wong
@ 2015-12-08 6:28 ` Darrick J. Wong
2015-12-08 6:28 ` [PATCH 2/3] generic/15[78]: fix error messages in the golden output Darrick J. Wong
2015-12-08 6:29 ` [PATCH 3/3] reflink: more tests Darrick J. Wong
2 siblings, 0 replies; 7+ messages in thread
From: Darrick J. Wong @ 2015-12-08 6:28 UTC (permalink / raw)
To: david, darrick.wong
Cc: fstests, xfs, hch, tao.peng, linux-ext4, Anna.Schumaker,
linux-btrfs
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/.
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
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
diff --git a/tools/mvtest b/tools/mvtest
new file mode 100755
index 0000000..af601d6
--- /dev/null
+++ b/tools/mvtest
@@ -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
diff --git a/tools/nextid b/tools/nextid
new file mode 120000
index 0000000..5c31d60
--- /dev/null
+++ b/tools/nextid
@@ -0,0 +1 @@
+sort-group
\ No newline at end of file
diff --git a/tools/sort-group b/tools/sort-group
new file mode 100755
index 0000000..84944ed
--- /dev/null
+++ b/tools/sort-group
@@ -0,0 +1,112 @@
+#!/usr/bin/env python
+import sys
+
+# Sort a group list, carefully preserving comments.
+
+def xfstest_key(key):
+ '''Extract the numeric part of a test name if possible.'''
+ k = 0
+
+ assert type(key) == str
+
+ # No test number at all...
+ if not key[0].isdigit():
+ return key
+
+ # ...otherwise extract as much number as we can.
+ for digit in key:
+ if digit.isdigit():
+ k = k * 10 + int(digit)
+ else:
+ return k
+ return k
+
+def read_group(fd):
+ '''Read the group list, carefully attaching comments to the next test.'''
+ tests = {}
+ comments = None
+
+ for line in fd:
+ sline = line.strip()
+ tokens = sline.split()
+ if len(tokens) == 0 or tokens[0] == '#':
+ if comments == None:
+ comments = []
+ comments.append(sline)
+ else:
+ tests[tokens[0]] = (comments, tokens[1:])
+ comments = None
+ return tests
+
+def sort_keys(keys):
+ '''Separate keys into integer and non-integer tests.'''
+ int_keys = []
+ int_xkeys = []
+ str_keys = []
+
+ # Sort keys into integer(ish) tests and other
+ for key in keys:
+ xkey = xfstest_key(key)
+ if type(xkey) == int:
+ int_keys.append(key)
+ int_xkeys.append(xkey)
+ else:
+ str_keys.append(key)
+ return (int_keys, int_xkeys, str_keys)
+
+def write_sorted(tests, fd):
+ def dump_xkey(xkey):
+ (comments, tokens) = tests[key]
+ if comments:
+ for c in comments:
+ fd.write('%s\n' % c)
+ fd.write('%s %s\n' % (key, ' '.join(tokens)))
+ '''Print tests (and comments) in number order.'''
+
+ (int_keys, ignored, str_keys) = sort_keys(tests.keys())
+ for key in sorted(int_keys, key = xfstest_key):
+ dump_xkey(key)
+ for key in sorted(str_keys):
+ dump_xkey(key)
+
+def sort_main():
+ if '--help' in sys.argv[1:]:
+ print('Usage: %s groupfiles' % sys.argv[0])
+ sys.exit(0)
+
+ for arg in sys.argv[1:]:
+ with open(arg, 'r+') as fd:
+ x = read_group(fd)
+ fd.seek(0, 0)
+ write_sorted(x, fd)
+
+def nextid_main():
+ if '--help' in sys.argv[1:]:
+ print('Usage: %s group[/startid] ' % sys.argv[0])
+ sys.exit(0)
+
+ if len(sys.argv) != 2:
+ print('Specify exactly one group name.')
+ sys.exit(1)
+
+ c = sys.argv[1].split('/')
+ if len(c) > 1:
+ startid = int(c[1])
+ else:
+ startid = 1
+ group = c[0]
+
+ with open('tests/%s/group' % group, 'r') as fd:
+ x = read_group(fd)
+ xkeys = {int(x) for x in sort_keys(x.keys())[1]}
+
+ xid = startid
+ while xid in xkeys:
+ xid += 1
+ print('%s/%d' % (group, xid))
+
+if __name__ == '__main__':
+ if 'nextid' in sys.argv[0]:
+ nextid_main()
+ else:
+ sort_main()
^ permalink raw reply related [flat|nested] 7+ messages in thread* [PATCH 2/3] generic/15[78]: fix error messages in the golden output
2015-12-08 6:28 [PATCH v3.4 0/3] xfstests: test the nfs/cifs/btrfs/xfs reflink/dedupe ioctls Darrick J. Wong
2015-12-08 6:28 ` [PATCH 1/3] test-scripts: test migration scripts Darrick J. Wong
@ 2015-12-08 6:28 ` Darrick J. Wong
2015-12-08 6:29 ` [PATCH 3/3] reflink: more tests Darrick J. Wong
2 siblings, 0 replies; 7+ messages in thread
From: Darrick J. Wong @ 2015-12-08 6:28 UTC (permalink / raw)
To: david, darrick.wong
Cc: fstests, xfs, hch, tao.peng, linux-ext4, Anna.Schumaker,
linux-btrfs
Fix 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.
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
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(-)
diff --git a/tests/generic/157 b/tests/generic/157
index a43fb0d..f68ff52 100755
--- a/tests/generic/157
+++ b/tests/generic/157
@@ -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"
diff --git a/tests/generic/157.out b/tests/generic/157.out
index 177e7f8..ac3c440 100644
--- a/tests/generic/157.out
+++ b/tests/generic/157.out
@@ -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
diff --git a/tests/generic/158 b/tests/generic/158
index a499b21..749b186 100755
--- a/tests/generic/158
+++ b/tests/generic/158
@@ -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"
diff --git a/tests/generic/158.out b/tests/generic/158.out
index 36a3f1f..dff3692 100644
--- a/tests/generic/158.out
+++ b/tests/generic/158.out
@@ -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
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
^ permalink raw reply related [flat|nested] 7+ messages in thread* [PATCH 3/3] reflink: more tests
2015-12-08 6:28 [PATCH v3.4 0/3] xfstests: test the nfs/cifs/btrfs/xfs reflink/dedupe ioctls Darrick J. Wong
2015-12-08 6:28 ` [PATCH 1/3] test-scripts: test migration scripts Darrick J. Wong
2015-12-08 6:28 ` [PATCH 2/3] generic/15[78]: fix error messages in the golden output Darrick J. Wong
@ 2015-12-08 6:29 ` Darrick J. Wong
2015-12-10 16:34 ` Christoph Hellwig
2 siblings, 1 reply; 7+ messages in thread
From: Darrick J. Wong @ 2015-12-08 6:29 UTC (permalink / raw)
To: david, darrick.wong
Cc: fstests, xfs, hch, tao.peng, linux-ext4, Anna.Schumaker,
linux-btrfs
Add 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".
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
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
diff --git a/tests/generic/820 b/tests/generic/820
new file mode 100755
index 0000000..e475f71
--- /dev/null
+++ b/tests/generic/820
@@ -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
diff --git a/tests/generic/820.out b/tests/generic/820.out
new file mode 100644
index 0000000..527617d
--- /dev/null
+++ b/tests/generic/820.out
@@ -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
diff --git a/tests/generic/847 b/tests/generic/847
new file mode 100755
index 0000000..ee8b53b
--- /dev/null
+++ b/tests/generic/847
@@ -0,0 +1,96 @@
+#! /bin/bash
+# FS QA Test No. 847
+#
+# Ensure that unaligned punch-hole steps around reflinked ranges:
+# - Create a reflink clone of a file
+# - Perform an unaligned punch in the middle of the file.
+# - Check that the reflinked areas are still there.
+#
+#-----------------------------------------------------------------------
+# 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
+_pwrite_byte 0x61 0 $((BLKSZ * 3)) "$TESTDIR/file1" >> "$seqres.full"
+
+_cp_reflink "$TESTDIR/file1" "$TESTDIR/file2"
+
+_pwrite_byte 0x61 0 $((BLKSZ * 3)) "$TESTDIR/file2.chk" >> "$seqres.full"
+_pwrite_byte 0x00 $((BLKSZ - 17)) $((BLKSZ + 17)) "$TESTDIR/file2.chk" >> "$seqres.full"
+_test_remount
+
+md5sum "$TESTDIR/file1" | _filter_test_dir
+md5sum "$TESTDIR/file2" | _filter_test_dir
+md5sum "$TESTDIR/file2.chk" | _filter_test_dir
+
+C1="$(_md5_checksum "$TESTDIR/file1")"
+C2="$(_md5_checksum "$TESTDIR/file2")"
+
+test "${C1}" = "${C2}" || echo "file1 and file2 should match"
+
+echo "fpunch files"
+"$XFS_IO_PROG" -f -c "fpunch $((BLKSZ - 17)) $((BLKSZ + 17))" "$TESTDIR/file2"
+_test_remount
+
+echo "Compare files"
+md5sum "$TESTDIR/file1" | _filter_test_dir
+md5sum "$TESTDIR/file2" | _filter_test_dir
+md5sum "$TESTDIR/file2.chk" | _filter_test_dir
+
+C1="$(_md5_checksum "$TESTDIR/file1")"
+C2="$(_md5_checksum "$TESTDIR/file2")"
+
+test "${C1}" != "${C2}" || echo "file1 and file2 should not match"
+
+echo "Compare against check files"
+cmp -s "$TESTDIR/file2" "$TESTDIR/file2.chk" || echo "file2 and file2.chk do not match"
+
+# success, all done
+status=0
+exit
diff --git a/tests/generic/847.out b/tests/generic/847.out
new file mode 100644
index 0000000..8139857
--- /dev/null
+++ b/tests/generic/847.out
@@ -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
diff --git a/tests/generic/848 b/tests/generic/848
new file mode 100755
index 0000000..cb848fb
--- /dev/null
+++ b/tests/generic/848
@@ -0,0 +1,96 @@
+#! /bin/bash
+# FS QA Test No. 848
+#
+# Ensure that unaligned zero-range steps around reflinked ranges:
+# - Create a reflink clone of a file
+# - Perform an unaligned zero-range in the middle of the file.
+# - Check that the reflinked areas are still there.
+#
+#-----------------------------------------------------------------------
+# 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 "fzero"
+
+rm -f "$seqres.full"
+
+TESTDIR="$TEST_DIR/test-$seq"
+rm -rf "$TESTDIR"
+mkdir "$TESTDIR"
+
+echo "Create the original files"
+BLKSZ=65536
+_pwrite_byte 0x61 0 $((BLKSZ * 3)) "$TESTDIR/file1" >> "$seqres.full"
+
+_cp_reflink "$TESTDIR/file1" "$TESTDIR/file2"
+
+_pwrite_byte 0x61 0 $((BLKSZ * 3)) "$TESTDIR/file2.chk" >> "$seqres.full"
+_pwrite_byte 0x00 $((BLKSZ - 17)) $((BLKSZ + 17)) "$TESTDIR/file2.chk" >> "$seqres.full"
+_test_remount
+
+md5sum "$TESTDIR/file1" | _filter_test_dir
+md5sum "$TESTDIR/file2" | _filter_test_dir
+md5sum "$TESTDIR/file2.chk" | _filter_test_dir
+
+C1="$(_md5_checksum "$TESTDIR/file1")"
+C2="$(_md5_checksum "$TESTDIR/file2")"
+
+test "${C1}" = "${C2}" || echo "file1 and file2 should match"
+
+echo "fzero files"
+"$XFS_IO_PROG" -f -c "fzero $((BLKSZ - 17)) $((BLKSZ + 17))" "$TESTDIR/file2"
+_test_remount
+
+echo "Compare files"
+md5sum "$TESTDIR/file1" | _filter_test_dir
+md5sum "$TESTDIR/file2" | _filter_test_dir
+md5sum "$TESTDIR/file2.chk" | _filter_test_dir
+
+C1="$(_md5_checksum "$TESTDIR/file1")"
+C2="$(_md5_checksum "$TESTDIR/file2")"
+
+test "${C1}" != "${C2}" || echo "file1 and file2 should not match"
+
+echo "Compare against check files"
+cmp -s "$TESTDIR/file2" "$TESTDIR/file2.chk" || echo "file2 and file2.chk do not match"
+
+# success, all done
+status=0
+exit
diff --git a/tests/generic/848.out b/tests/generic/848.out
new file mode 100644
index 0000000..94c674b
--- /dev/null
+++ b/tests/generic/848.out
@@ -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
diff --git a/tests/generic/849 b/tests/generic/849
new file mode 100755
index 0000000..76f1e70
--- /dev/null
+++ b/tests/generic/849
@@ -0,0 +1,80 @@
+#! /bin/bash
+# FS QA Test No. 849
+#
+# Test the convention that reflink with length == 0 means "to the end of fileA"
+# - Create a file.
+# - Try to reflink "zero" bytes.
+# - Check that the reflink happened.
+#
+#-----------------------------------------------------------------------
+# 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
+
+rm -f "$seqres.full"
+
+TESTDIR="$TEST_DIR/test-$seq"
+rm -rf "$TESTDIR"
+mkdir "$TESTDIR"
+
+echo "Create the original files"
+BLKSZ=65536
+_pwrite_byte 0x61 0 $((BLKSZ * 256)) "$TESTDIR/file1" >> "$seqres.full"
+_pwrite_byte 0x62 0 $((BLKSZ * 256)) "$TESTDIR/file2" >> "$seqres.full"
+_pwrite_byte 0x62 0 $((BLKSZ * 2)) "$TESTDIR/file2.chk" >> "$seqres.full"
+_pwrite_byte 0x61 $((BLKSZ * 2)) $((BLKSZ * 255)) "$TESTDIR/file2.chk" >> "$seqres.full"
+_reflink_range "$TESTDIR/file1" $BLKSZ "$TESTDIR/file2" $((BLKSZ * 2)) 0 >> "$seqres.full"
+_test_remount
+
+md5sum "$TESTDIR/file1" | _filter_test_dir
+md5sum "$TESTDIR/file2" | _filter_test_dir
+md5sum "$TESTDIR/file2.chk" | _filter_test_dir
+
+C1="$(_md5_checksum "$TESTDIR/file1")"
+C2="$(_md5_checksum "$TESTDIR/file2")"
+
+test "${C1}" != "${C2}" || echo "file1 and file2 should not match"
+
+echo "Compare against check files"
+cmp -s "$TESTDIR/file2" "$TESTDIR/file2.chk" || echo "file2 and file2.chk do not match"
+
+# success, all done
+status=0
+exit
diff --git a/tests/generic/849.out b/tests/generic/849.out
new file mode 100644
index 0000000..159305a
--- /dev/null
+++ b/tests/generic/849.out
@@ -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
diff --git a/tests/generic/850 b/tests/generic/850
new file mode 100755
index 0000000..954d41d
--- /dev/null
+++ b/tests/generic/850
@@ -0,0 +1,117 @@
+#! /bin/bash
+# FS QA Test No. 850
+#
+# Test the convention that reflink with length == 0 means "to the end of fileA"
+# - Create a file.
+# - Try to reflink "zero" bytes (which means reflink to EOF).
+# - Check that the reflink happened.
+#
+#-----------------------------------------------------------------------
+# 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
+
+rm -f "$seqres.full"
+
+TESTDIR="$TEST_DIR/test-$seq"
+rm -rf "$TESTDIR"
+mkdir "$TESTDIR"
+
+echo "Create the original files"
+BLKSZ=65536
+_pwrite_byte 0x61 0 $((BLKSZ * 256)) "$TESTDIR/file1" >> "$seqres.full"
+_pwrite_byte 0x62 0 $((BLKSZ * 257)) "$TESTDIR/file2" >> "$seqres.full"
+_pwrite_byte 0x62 0 $((BLKSZ * 257)) "$TESTDIR/file2.chk" >> "$seqres.full"
+_dedupe_range "$TESTDIR/file1" $BLKSZ "$TESTDIR/file2" $((BLKSZ * 2)) 0 >> "$seqres.full"
+_test_remount
+
+md5sum "$TESTDIR/file1" | _filter_test_dir
+md5sum "$TESTDIR/file2" | _filter_test_dir
+md5sum "$TESTDIR/file2.chk" | _filter_test_dir
+
+C1="$(_md5_checksum "$TESTDIR/file1")"
+C2="$(_md5_checksum "$TESTDIR/file2")"
+
+test "${C1}" != "${C2}" || echo "file1 and file2 should not match"
+
+echo "Compare against check files"
+cmp -s "$TESTDIR/file2" "$TESTDIR/file2.chk" || echo "file2 and file2.chk do not match"
+
+echo "Make the original file almost dedup-able"
+_pwrite_byte 0x61 0 $((BLKSZ * 256)) "$TESTDIR/file1" >> "$seqres.full"
+_pwrite_byte 0x61 0 $((BLKSZ * 256)) "$TESTDIR/file2" >> "$seqres.full"
+_pwrite_byte 0x61 0 $((BLKSZ * 256)) "$TESTDIR/file2.chk" >> "$seqres.full"
+_dedupe_range "$TESTDIR/file1" $BLKSZ "$TESTDIR/file2" $((BLKSZ * 2)) 0 >> "$seqres.full"
+_test_remount
+
+md5sum "$TESTDIR/file1" | _filter_test_dir
+md5sum "$TESTDIR/file2" | _filter_test_dir
+md5sum "$TESTDIR/file2.chk" | _filter_test_dir
+
+C1="$(_md5_checksum "$TESTDIR/file1")"
+C2="$(_md5_checksum "$TESTDIR/file2")"
+
+test "${C1}" != "${C2}" || echo "file1 and file2 should not match"
+
+echo "Compare against check files"
+cmp -s "$TESTDIR/file2" "$TESTDIR/file2.chk" || echo "file2 and file2.chk do not match"
+
+echo "Make the original file dedup-able"
+_pwrite_byte 0x61 0 $((BLKSZ * 256)) "$TESTDIR/file1" >> "$seqres.full"
+_pwrite_byte 0x61 0 $((BLKSZ * 257)) "$TESTDIR/file2" >> "$seqres.full"
+_pwrite_byte 0x61 0 $((BLKSZ * 257)) "$TESTDIR/file2.chk" >> "$seqres.full"
+_dedupe_range "$TESTDIR/file1" $BLKSZ "$TESTDIR/file2" $((BLKSZ * 2)) 0 >> "$seqres.full"
+_test_remount
+
+md5sum "$TESTDIR/file1" | _filter_test_dir
+md5sum "$TESTDIR/file2" | _filter_test_dir
+md5sum "$TESTDIR/file2.chk" | _filter_test_dir
+
+C1="$(_md5_checksum "$TESTDIR/file1")"
+C2="$(_md5_checksum "$TESTDIR/file2")"
+
+test "${C1}" = "${C2}" || echo "file1 and file2 should match"
+
+echo "Compare against check files"
+cmp -s "$TESTDIR/file2" "$TESTDIR/file2.chk" || echo "file2 and file2.chk do not match"
+
+# success, all done
+status=0
+exit
diff --git a/tests/generic/850.out b/tests/generic/850.out
new file mode 100644
index 0000000..126187e
--- /dev/null
+++ b/tests/generic/850.out
@@ -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
diff --git a/tests/generic/group b/tests/generic/group
index 355603f..bf33541 100644
--- a/tests/generic/group
+++ b/tests/generic/group
@@ -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
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
^ permalink raw reply related [flat|nested] 7+ messages in thread