These tests exercise the copy_file_range() system call, and check copying
data to both a new file and overwriting data inside an existing file.
Changes since v5:
- Update copyright lines
- Update test numbers
- Make sure tests pass with a variety of filesystems
Thanks,
Anna
Anna Schumaker (5):
generic/429: Add copy to new file test
generic/430: Add small copies to new file test
generic/431: Add copy test that overwrites data
generic/432: Add a copy test for overwriting small amounts of data
generic/433: Add a copy test for invalid input
common/rc | 6 +++
tests/generic/429 | 102 ++++++++++++++++++++++++++++++++++++++++++++++++++
tests/generic/429.out | 25 +++++++++++++
tests/generic/430 | 83 ++++++++++++++++++++++++++++++++++++++++
tests/generic/430.out | 15 ++++++++
tests/generic/431 | 100 +++++++++++++++++++++++++++++++++++++++++++++++++
tests/generic/431.out | 17 +++++++++
tests/generic/432 | 87 ++++++++++++++++++++++++++++++++++++++++++
tests/generic/432.out | 17 +++++++++
tests/generic/433 | 79 ++++++++++++++++++++++++++++++++++++++
tests/generic/433.out | 14 +++++++
tests/generic/group | 5 +++
12 files changed, 550 insertions(+)
create mode 100755 tests/generic/429
create mode 100644 tests/generic/429.out
create mode 100755 tests/generic/430
create mode 100644 tests/generic/430.out
create mode 100755 tests/generic/431
create mode 100644 tests/generic/431.out
create mode 100755 tests/generic/432
create mode 100644 tests/generic/432.out
create mode 100644 tests/generic/433
create mode 100644 tests/generic/433.out
--
2.12.2
This test copies single bytes from a source file into various new files
just to make sure that we can handle very small copies.
Signed-off-by: Anna Schumaker <[email protected]>
---
tests/generic/430 | 83 +++++++++++++++++++++++++++++++++++++++++++++++++++
tests/generic/430.out | 15 ++++++++++
tests/generic/group | 1 +
3 files changed, 99 insertions(+)
create mode 100755 tests/generic/430
create mode 100644 tests/generic/430.out
diff --git a/tests/generic/430 b/tests/generic/430
new file mode 100755
index 00000000..750f8522
--- /dev/null
+++ b/tests/generic/430
@@ -0,0 +1,83 @@
+#!/bin/bash
+# FS QA Test No. 430
+#
+# Tests vfs_copy_file_range():
+# - Copy a small file
+# - Small copies from various points in the original file
+#-----------------------------------------------------------------------
+# Copyright (c) 2017 Netapp, Inc. 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.*
+}
+
+# get standard environment
+. common/rc
+. common/filter
+
+# real QA test starts here
+_supported_fs generic
+_supported_os Linux
+
+_require_xfs_io_command "copy_range"
+_require_test
+
+testdir=$TEST_DIR/test-$seq
+rm -rf $testdir
+mkdir $testdir
+rm -f $seqres.full
+
+echo "Create the original file and then copy"
+echo -n "abcde" > $testdir/file
+$XFS_IO_PROG -f -c "copy_range $testdir/file" "$testdir/copy"
+echo -n "abcde" | cmp $testdir/copy
+echo "Original md5sums:"
+md5sum $testdir/{file,copy} | _filter_test_dir
+
+echo "Small copies from various points in the original file"
+$XFS_IO_PROG -f -c "copy_range -s 0 -l 1 $testdir/file" "$testdir/a" 2>&1
+$XFS_IO_PROG -f -c "copy_range -s 1 -l 1 $testdir/file" "$testdir/b" 2>&1
+$XFS_IO_PROG -f -c "copy_range -s 2 -l 1 $testdir/file" "$testdir/c" 2>&1
+$XFS_IO_PROG -f -c "copy_range -s 3 -l 1 $testdir/file" "$testdir/d" 2>&1
+$XFS_IO_PROG -f -c "copy_range -s 4 -l 1 $testdir/file" "$testdir/e" 2>&1
+$XFS_IO_PROG -f -c "copy_range -s 4 -l 1 -d 1 $testdir/file" "$testdir/f" 2>&1
+$XFS_IO_PROG -f -c "copy_range -s 5 -l 1 $testdir/file" "$testdir/g" 2>&1
+echo -n "a" | cmp $testdir/a
+echo -n "b" | cmp $testdir/b
+echo -n "c" | cmp $testdir/c
+echo -n "d" | cmp $testdir/d
+echo -n "e" | cmp $testdir/e
+echo -en "\0e" | cmp $testdir/f
+echo -n "" | cmp $testdir/g
+echo "md5sums after small copies"
+md5sum $testdir/{file,a,b,c,d,e,f,g} | _filter_test_dir
+
+#success, all done
+status=0
+exit
diff --git a/tests/generic/430.out b/tests/generic/430.out
new file mode 100644
index 00000000..1bdfbf6f
--- /dev/null
+++ b/tests/generic/430.out
@@ -0,0 +1,15 @@
+QA output created by 430
+Create the original file and then copy
+Original md5sums:
+ab56b4d92b40713acc5af89985d4b786 TEST_DIR/test-430/file
+ab56b4d92b40713acc5af89985d4b786 TEST_DIR/test-430/copy
+Small copies from various points in the original file
+md5sums after small copies
+ab56b4d92b40713acc5af89985d4b786 TEST_DIR/test-430/file
+0cc175b9c0f1b6a831c399e269772661 TEST_DIR/test-430/a
+92eb5ffee6ae2fec3ad71c777531578f TEST_DIR/test-430/b
+4a8a08f09d37b73795649038408b5f33 TEST_DIR/test-430/c
+8277e0910d750195b448797616e091ad TEST_DIR/test-430/d
+e1671797c52e15f763380b45e841ec32 TEST_DIR/test-430/e
+2015eb238d706eceefc784742928054f TEST_DIR/test-430/f
+d41d8cd98f00b204e9800998ecf8427e TEST_DIR/test-430/g
diff --git a/tests/generic/group b/tests/generic/group
index 1c0fbb73..b5f115af 100644
--- a/tests/generic/group
+++ b/tests/generic/group
@@ -432,3 +432,4 @@
427 auto quick aio rw
428 auto quick
429 auto quick copy
+430 auto quick copy
--
2.12.2
This test is similar to 345, except that it copies one byte at a time to
make sure that this case works as expected.
Signed-off-by: Anna Schumaker <[email protected]>
---
tests/generic/432 | 87 +++++++++++++++++++++++++++++++++++++++++++++++++++
tests/generic/432.out | 17 ++++++++++
tests/generic/group | 1 +
3 files changed, 105 insertions(+)
create mode 100755 tests/generic/432
create mode 100644 tests/generic/432.out
diff --git a/tests/generic/432 b/tests/generic/432
new file mode 100755
index 00000000..9cd899ce
--- /dev/null
+++ b/tests/generic/432
@@ -0,0 +1,87 @@
+#!/bin/bash
+# FS QA Test No. 432
+#
+# Tests vfs_copy_file_range():
+# - Copy a small file
+# - Use copy to swap data at beginning and end
+# - Use copy to swap data in the middle
+# - Use copy to swap data in a small file
+#-----------------------------------------------------------------------
+# Copyright (c) 2017 Netapp, Inc. 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.*
+}
+
+# get standard environment
+. common/rc
+. common/filter
+
+# real QA test starts here
+_supported_fs generic
+_supported_os Linux
+
+_require_xfs_io_command "copy_range"
+_require_test
+
+testdir=$TEST_DIR/test-$seq
+rm -rf $testdir
+mkdir $testdir
+rm -f $seqres.full
+
+echo "Create the original file and then copy"
+echo -n "abcde" > $testdir/file
+$XFS_IO_PROG -f -c "copy_range $testdir/file" "$testdir/copy" 2>&1
+cmp $testdir/file $testdir/copy
+echo "Original md5sums:"
+md5sum $testdir/{file,copy} | _filter_test_dir
+
+echo "Swap beginning and end of original file"
+$XFS_IO_PROG -f -c "copy_range -s 0 -d 4 -l 1 $testdir/file" "$testdir/copy" 2>&1
+$XFS_IO_PROG -f -c "copy_range -s 4 -d 0 -l 1 $testdir/file" "$testdir/copy" 2>&1
+echo -n "ebcda" | cmp $testdir/copy
+echo "md5sums after swapping beginning and end:"
+md5sum $testdir/{file,copy} | _filter_test_dir
+
+echo "Swap middle parts of original file"
+$XFS_IO_PROG -f -c "copy_range -s 1 -d 3 -l 1 $testdir/file" "$testdir/copy" 2>&1
+$XFS_IO_PROG -f -c "copy_range -s 3 -d 1 -l 1 $testdir/file" "$testdir/copy" 2>&1
+echo -n "edcba" | cmp $testdir/copy
+echo "md5sums after swapping middle:"
+md5sum $testdir/{file,copy} | _filter_test_dir
+
+echo "Copy tail of original file onto copy"
+$XFS_IO_PROG -f -c "copy_range -s 1 -d 3 -l 4 $testdir/file" "$testdir/copy" 2>&1
+echo -n "edcbcde" | cmp $testdir/copy
+echo "md5sums after copying tail:"
+md5sum $testdir/{file,copy} | _filter_test_dir
+
+#success, all done
+status=0
+exit
diff --git a/tests/generic/432.out b/tests/generic/432.out
new file mode 100644
index 00000000..eec84392
--- /dev/null
+++ b/tests/generic/432.out
@@ -0,0 +1,17 @@
+QA output created by 432
+Create the original file and then copy
+Original md5sums:
+ab56b4d92b40713acc5af89985d4b786 TEST_DIR/test-432/file
+ab56b4d92b40713acc5af89985d4b786 TEST_DIR/test-432/copy
+Swap beginning and end of original file
+md5sums after swapping beginning and end:
+ab56b4d92b40713acc5af89985d4b786 TEST_DIR/test-432/file
+32db1f6d06d15f7e38e1ab1c69da498a TEST_DIR/test-432/copy
+Swap middle parts of original file
+md5sums after swapping middle:
+ab56b4d92b40713acc5af89985d4b786 TEST_DIR/test-432/file
+295228f3d82d344bbcf2f0030519c2ea TEST_DIR/test-432/copy
+Copy tail of original file onto copy
+md5sums after copying tail:
+ab56b4d92b40713acc5af89985d4b786 TEST_DIR/test-432/file
+0c4aac952f72fa078e2f8419aca70b28 TEST_DIR/test-432/copy
diff --git a/tests/generic/group b/tests/generic/group
index 608c45b2..43aac9fd 100644
--- a/tests/generic/group
+++ b/tests/generic/group
@@ -434,3 +434,4 @@
429 auto quick copy
430 auto quick copy
431 auto quick copy
+432 auto quick copy
--
2.12.2
This test passes invalid argumnt combinations to the copy_file_range()
system call to test that input is verified before attempting to copy.
Signed-off-by: Anna Schumaker <[email protected]>
---
tests/generic/433 | 79 +++++++++++++++++++++++++++++++++++++++++++++++++++
tests/generic/433.out | 14 +++++++++
tests/generic/group | 1 +
3 files changed, 94 insertions(+)
create mode 100644 tests/generic/433
create mode 100644 tests/generic/433.out
diff --git a/tests/generic/433 b/tests/generic/433
new file mode 100644
index 00000000..11b936eb
--- /dev/null
+++ b/tests/generic/433
@@ -0,0 +1,79 @@
+#!/bin/bash
+# FS QA Test No. 433
+#
+# Tests vfs_copy_file_range() error checking
+#-----------------------------------------------------------------------
+# Copyright (c) 2017 Netapp, Inc. 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.*
+}
+
+# get standard environment
+. common/rc
+. common/filter
+
+# real QA test starts here
+_supported_fs generic
+_supported_os Linux
+
+_require_xfs_io_command "copy_range"
+_require_test
+
+testdir=$TEST_DIR/test-$seq
+rm -rf $testdir
+mkdir $testdir
+rm -f $seqres.full
+
+echo "Create the original files"
+$XFS_IO_PROG -f -c 'pwrite -S 0x61 0 1000' $testdir/file >> $seqres.full 2>&1
+mknod $testdir/dev1 c 1 3
+mkfifo $testdir/fifo
+
+echo "Try to copy when source pos > source size"
+$XFS_IO_PROG -f -c "copy_range -s 1000 -l 100 $testdir/file" "$testdir/copy" 2>&1
+md5sum $testdir/copy | _filter_test_dir
+
+echo "Try to copy to a read-only file"
+$XFS_IO_PROG -r -f -c "copy_range -s 0 -l 100 $testdir/file" "$testdir/copy" 2>&1
+md5sum $testdir/copy | _filter_test_dir
+
+echo "Try to copy to an append-only file"
+$XFS_IO_PROG -a -f -c "copy_range -s 0 -l 100 $testdir/file" "$testdir/copy" 2>&1
+md5sum $testdir/copy | _filter_test_dir
+
+echo "Try to copy to a device"
+$XFS_IO_PROG -a -f -c "copy_range -s 0 -l 100 $testdir/file" "$testdir/dev1" 2>&1
+
+echo "Try to copy to a fifo"
+$XFS_IO_PROG -a -f -c "copy_range -s 0 -l 100 $testdir/file" "$testdir/fifo" 2>&1
+
+#success, all done
+status=0
+exit
diff --git a/tests/generic/433.out b/tests/generic/433.out
new file mode 100644
index 00000000..da6f5e9c
--- /dev/null
+++ b/tests/generic/433.out
@@ -0,0 +1,14 @@
+QA output created by 433
+Create the original files
+Try to copy when source pos > source size
+d41d8cd98f00b204e9800998ecf8427e TEST_DIR/test-433/copy
+Try to copy to a read-only file
+copy_range: Bad file descriptor
+d41d8cd98f00b204e9800998ecf8427e TEST_DIR/test-433/copy
+Try to copy to an append-only file
+copy_range: Bad file descriptor
+d41d8cd98f00b204e9800998ecf8427e TEST_DIR/test-433/copy
+Try to copy to a device
+copy_range: Invalid argument
+Try to copy to a fifo
+copy_range: Invalid argument
diff --git a/tests/generic/group b/tests/generic/group
index 43aac9fd..fc00405f 100644
--- a/tests/generic/group
+++ b/tests/generic/group
@@ -435,3 +435,4 @@
430 auto quick copy
431 auto quick copy
432 auto quick copy
+433 auto quick copy
--
2.12.2
Using copy to overwrite data in the destination file is perfectly valid,
so let's make sure this case works as expected.
Signed-off-by: Anna Schumaker <[email protected]>
---
tests/generic/431 | 100 ++++++++++++++++++++++++++++++++++++++++++++++++++
tests/generic/431.out | 17 +++++++++
tests/generic/group | 1 +
3 files changed, 118 insertions(+)
create mode 100755 tests/generic/431
create mode 100644 tests/generic/431.out
diff --git a/tests/generic/431 b/tests/generic/431
new file mode 100755
index 00000000..413aa8d2
--- /dev/null
+++ b/tests/generic/431
@@ -0,0 +1,100 @@
+#!/bin/bash
+# FS QA Test No. 431
+#
+# Tests vfs_copy_file_range():
+# - Copy a file
+# - Use copy to swap data at beginning and end
+# - Use copy to swap data in the middle
+# - Use copy to simultaneously overwrite and append to destination file
+#-----------------------------------------------------------------------
+# Copyright (c) 2017 Netapp, Inc. 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.*
+}
+
+# get standard environment
+. common/rc
+. common/filter
+
+# real QA test starts here
+_supported_fs generic
+_supported_os Linux
+
+_require_xfs_io_command "copy_range"
+_require_test
+
+testdir=$TEST_DIR/test-$seq
+rm -rf $testdir
+mkdir $testdir
+rm -f $seqres.full
+
+echo "Create the original file and then copy"
+$XFS_IO_PROG -f -c 'pwrite -S 0x61 0 1000' $testdir/file >> $seqres.full 2>&1
+$XFS_IO_PROG -f -c 'pwrite -S 0x62 1000 1000' $testdir/file >> $seqres.full 2>&1
+$XFS_IO_PROG -f -c 'pwrite -S 0x63 2000 1000' $testdir/file >> $seqres.full 2>&1
+$XFS_IO_PROG -f -c 'pwrite -S 0x64 3000 1000' $testdir/file >> $seqres.full 2>&1
+$XFS_IO_PROG -f -c 'pwrite -S 0x65 4000 1000' $testdir/file >> $seqres.full 2>&1
+$XFS_IO_PROG -f -c "copy_range $testdir/file" "$testdir/copy"
+cmp $testdir/file $testdir/copy
+echo "Original md5sums:"
+md5sum $testdir/{file,copy} | _filter_test_dir
+
+echo "Swap beginning and end of original file"
+$XFS_IO_PROG -f -c "copy_range -s 4000 -l 1000 $testdir/file" "$testdir/copy" 2>&1
+$XFS_IO_PROG -f -c "copy_range -d 4000 -l 1000 $testdir/file" "$testdir/copy" 2>&1
+cmp -n 1000 $testdir/file $testdir/copy 4000
+cmp -n 3000 $testdir/file $testdir/copy 1000 1000
+cmp -n 1000 $testdir/file $testdir/copy 0 4000
+echo "md5sums after swapping beginning and end:"
+md5sum $testdir/{file,copy} | _filter_test_dir
+
+echo "Swap middle parts of original file"
+$XFS_IO_PROG -f -c "copy_range -s 1000 -d 3000 -l 1000 $testdir/file" "$testdir/copy" 2>&1
+$XFS_IO_PROG -f -c "copy_range -s 3000 -d 1000 -l 1000 $testdir/file" "$testdir/copy" 2>&1
+cmp -n 1000 $testdir/file $testdir/copy 4000
+cmp -n 1000 $testdir/file $testdir/copy 3000 1000
+cmp -n 1000 $testdir/file $testdir/copy 2000 2000
+cmp -n 1000 $testdir/file $testdir/copy 1000 3000
+cmp -n 1000 $testdir/file $testdir/copy 0 4000
+echo "md5sums after swapping middle:"
+md5sum $testdir/{file,copy} | _filter_test_dir
+
+echo "Copy tail of original file onto copy"
+$XFS_IO_PROG -f -c "copy_range -s 1000 -d 3000 -l 4000 $testdir/file" "$testdir/copy" 2>&1
+cmp -n 1000 $testdir/file $testdir/copy 4000
+cmp -n 1000 $testdir/file $testdir/copy 3000 1000
+cmp -n 1000 $testdir/file $testdir/copy 2000 2000
+cmp -n 4000 $testdir/file $testdir/copy 1000 3000
+echo "md5sums after copying tail:"
+md5sum $testdir/{file,copy} | _filter_test_dir
+
+#success, all done
+status=0
+exit
diff --git a/tests/generic/431.out b/tests/generic/431.out
new file mode 100644
index 00000000..175fbdf1
--- /dev/null
+++ b/tests/generic/431.out
@@ -0,0 +1,17 @@
+QA output created by 431
+Create the original file and then copy
+Original md5sums:
+e11fbace556cba26bf0076e74cab90a3 TEST_DIR/test-431/file
+e11fbace556cba26bf0076e74cab90a3 TEST_DIR/test-431/copy
+Swap beginning and end of original file
+md5sums after swapping beginning and end:
+e11fbace556cba26bf0076e74cab90a3 TEST_DIR/test-431/file
+5f4e111811dd9a810143c9db9bec6d80 TEST_DIR/test-431/copy
+Swap middle parts of original file
+md5sums after swapping middle:
+e11fbace556cba26bf0076e74cab90a3 TEST_DIR/test-431/file
+8c81889a5a50b311197110bcf769a695 TEST_DIR/test-431/copy
+Copy tail of original file onto copy
+md5sums after copying tail:
+e11fbace556cba26bf0076e74cab90a3 TEST_DIR/test-431/file
+e5fbacd993eaa5e80ebc2b14b969887d TEST_DIR/test-431/copy
diff --git a/tests/generic/group b/tests/generic/group
index b5f115af..608c45b2 100644
--- a/tests/generic/group
+++ b/tests/generic/group
@@ -433,3 +433,4 @@
428 auto quick
429 auto quick copy
430 auto quick copy
+431 auto quick copy
--
2.12.2
This test copies data from various points in a source file to a new
file. This is useful for testing the basics of copy_file_range().
Signed-off-by: Anna Schumaker <[email protected]>
---
common/rc | 6 +++
tests/generic/429 | 102 ++++++++++++++++++++++++++++++++++++++++++++++++++
tests/generic/429.out | 25 +++++++++++++
tests/generic/group | 1 +
4 files changed, 134 insertions(+)
create mode 100755 tests/generic/429
create mode 100644 tests/generic/429.out
diff --git a/common/rc b/common/rc
index 8dafd4bc..816d06a6 100644
--- a/common/rc
+++ b/common/rc
@@ -2047,6 +2047,12 @@ _require_xfs_io_command()
"chproj")
testio=`$XFS_IO_PROG -F -f -c "chproj 0" $testfile 2>&1`
;;
+ "copy_range")
+ testcopy=$TEST_DIR/$$.copy.xfs_io
+ $XFS_IO_PROG -F -f -c "pwrite 0 4k" $testfile 2>&1 > /dev/null
+ testio=`$XFS_IO_PROG -F -f -c "copy_range $testfile" $testcopy 2>&1`
+ rm -f $testcopy 2>&1 > /dev/null
+ ;;
"falloc" )
testio=`$XFS_IO_PROG -F -f -c "falloc $param 0 1m" $testfile 2>&1`
;;
diff --git a/tests/generic/429 b/tests/generic/429
new file mode 100755
index 00000000..fb52df8b
--- /dev/null
+++ b/tests/generic/429
@@ -0,0 +1,102 @@
+#!/bin/bash
+# FS QA Test No. 429
+#
+# Tests vfs_copy_file_range():
+# - Copy a file
+# - Copy beginning of original to new file
+# - Copy middle of original to a new file
+# - Copy end of original to new file
+# - Copy middle of original to a new file, creating a hole
+#-----------------------------------------------------------------------
+# Copyright (c) 2017 Netapp, Inc. 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.*
+}
+
+# get standard environment
+. common/rc
+. common/filter
+
+# real QA test starts here
+_supported_fs generic
+_supported_os Linux
+
+_require_xfs_io_command "copy_range"
+_require_test
+
+testdir=$TEST_DIR/test-$seq
+rm -rf $testdir
+mkdir $testdir
+rm -f $seqres.full
+
+echo "Create the original file and then copy"
+$XFS_IO_PROG -f -c 'pwrite -S 0x61 0 1000' $testdir/file >> $seqres.full 2>&1
+$XFS_IO_PROG -f -c 'pwrite -S 0x62 1000 1000' $testdir/file >> $seqres.full 2>&1
+$XFS_IO_PROG -f -c 'pwrite -S 0x63 2000 1000' $testdir/file >> $seqres.full 2>&1
+$XFS_IO_PROG -f -c 'pwrite -S 0x64 3000 1000' $testdir/file >> $seqres.full 2>&1
+$XFS_IO_PROG -f -c 'pwrite -S 0x65 4000 1000' $testdir/file >> $seqres.full 2>&1
+$XFS_IO_PROG -f -c "copy_range $testdir/file" "$testdir/copy"
+cmp $testdir/file $testdir/copy
+echo "Original md5sums:"
+md5sum $testdir/{file,copy} | _filter_test_dir
+
+echo "Copy beginning of original file"
+$XFS_IO_PROG -f -c "copy_range -l 1000 $testdir/file" "$testdir/beginning" 2>&1
+cmp -n 1000 $testdir/file $testdir/beginning
+echo "md5sums after copying beginning:"
+md5sum $testdir/{file,beginning} | _filter_test_dir
+
+echo "Copy middle of original file"
+$XFS_IO_PROG -f -c "copy_range -s 1000 -l 3000 $testdir/file" "$testdir/middle" 2>&1
+cmp -n 3000 $testdir/file $testdir/middle 1000
+echo "md5sums after copying middle:"
+md5sum $testdir/{file,middle} | _filter_test_dir
+
+echo "Copy end of original file"
+$XFS_IO_PROG -f -c "copy_range -s 4000 -l 1000 $testdir/file" "$testdir/end" 2>&1
+cmp -n 1000 $testdir/file $testdir/end 4000
+echo "md5sums after copying end:"
+md5sum $testdir/{file,end} | _filter_test_dir
+
+echo "Copy beyond end of original file"
+$XFS_IO_PROG -f -c "copy_range -s 4000 -l 2000 $testdir/file" "$testdir/beyond" 2>&1
+cmp -n 1000 $testdir/file $testdir/end 4000
+echo "md5sums after copying beyond:"
+md5sum $testdir/{file,beyond} | _filter_test_dir
+
+echo "Copy creates hole in target file"
+$XFS_IO_PROG -f -c "copy_range -s 1000 -l 3000 -d 1000 $testdir/file" "$testdir/hole" 2>&1
+cmp -n 3000 $testdir/file $testdir/hole 1000 1000
+echo "md5sums after creating hole:"
+md5sum $testdir/{file,hole} | _filter_test_dir
+
+#success, all done
+status=0
+exit
diff --git a/tests/generic/429.out b/tests/generic/429.out
new file mode 100644
index 00000000..8de90a44
--- /dev/null
+++ b/tests/generic/429.out
@@ -0,0 +1,25 @@
+QA output created by 429
+Create the original file and then copy
+Original md5sums:
+e11fbace556cba26bf0076e74cab90a3 TEST_DIR/test-429/file
+e11fbace556cba26bf0076e74cab90a3 TEST_DIR/test-429/copy
+Copy beginning of original file
+md5sums after copying beginning:
+e11fbace556cba26bf0076e74cab90a3 TEST_DIR/test-429/file
+cabe45dcc9ae5b66ba86600cca6b8ba8 TEST_DIR/test-429/beginning
+Copy middle of original file
+md5sums after copying middle:
+e11fbace556cba26bf0076e74cab90a3 TEST_DIR/test-429/file
+4197de9da5badfc302715486b82bcdf1 TEST_DIR/test-429/middle
+Copy end of original file
+md5sums after copying end:
+e11fbace556cba26bf0076e74cab90a3 TEST_DIR/test-429/file
+e68d4a150c4e42f4f9ea3ffe4c9cf4ed TEST_DIR/test-429/end
+Copy beyond end of original file
+md5sums after copying beyond:
+e11fbace556cba26bf0076e74cab90a3 TEST_DIR/test-429/file
+e68d4a150c4e42f4f9ea3ffe4c9cf4ed TEST_DIR/test-429/beyond
+Copy creates hole in target file
+md5sums after creating hole:
+e11fbace556cba26bf0076e74cab90a3 TEST_DIR/test-429/file
+3ae9aef0992f8cb51c90c9a0ff2dd9d2 TEST_DIR/test-429/hole
diff --git a/tests/generic/group b/tests/generic/group
index b3051752..1c0fbb73 100644
--- a/tests/generic/group
+++ b/tests/generic/group
@@ -431,3 +431,4 @@
426 auto quick exportfs
427 auto quick aio rw
428 auto quick
+429 auto quick copy
--
2.12.2
On Wed, May 10, 2017 at 01:46:27PM -0400, Anna Schumaker wrote:
> This test is similar to 345, except that it copies one byte at a time to
345? Or is that now 431? Perhaps amend the commit message to "This
test is similar to the previous one, except..."?
Otherwise, the tests run ok on xfs and ext4 and look ok, so for the whole set
Reviewed-by: Darrick J. Wong <[email protected]>
--D
> make sure that this case works as expected.
>
> Signed-off-by: Anna Schumaker <[email protected]>
> ---
> tests/generic/432 | 87 +++++++++++++++++++++++++++++++++++++++++++++++++++
> tests/generic/432.out | 17 ++++++++++
> tests/generic/group | 1 +
> 3 files changed, 105 insertions(+)
> create mode 100755 tests/generic/432
> create mode 100644 tests/generic/432.out
>
> diff --git a/tests/generic/432 b/tests/generic/432
> new file mode 100755
> index 00000000..9cd899ce
> --- /dev/null
> +++ b/tests/generic/432
> @@ -0,0 +1,87 @@
> +#!/bin/bash
> +# FS QA Test No. 432
> +#
> +# Tests vfs_copy_file_range():
> +# - Copy a small file
> +# - Use copy to swap data at beginning and end
> +# - Use copy to swap data in the middle
> +# - Use copy to swap data in a small file
> +#-----------------------------------------------------------------------
> +# Copyright (c) 2017 Netapp, Inc. 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.*
> +}
> +
> +# get standard environment
> +. common/rc
> +. common/filter
> +
> +# real QA test starts here
> +_supported_fs generic
> +_supported_os Linux
> +
> +_require_xfs_io_command "copy_range"
> +_require_test
> +
> +testdir=$TEST_DIR/test-$seq
> +rm -rf $testdir
> +mkdir $testdir
> +rm -f $seqres.full
> +
> +echo "Create the original file and then copy"
> +echo -n "abcde" > $testdir/file
> +$XFS_IO_PROG -f -c "copy_range $testdir/file" "$testdir/copy" 2>&1
> +cmp $testdir/file $testdir/copy
> +echo "Original md5sums:"
> +md5sum $testdir/{file,copy} | _filter_test_dir
> +
> +echo "Swap beginning and end of original file"
> +$XFS_IO_PROG -f -c "copy_range -s 0 -d 4 -l 1 $testdir/file" "$testdir/copy" 2>&1
> +$XFS_IO_PROG -f -c "copy_range -s 4 -d 0 -l 1 $testdir/file" "$testdir/copy" 2>&1
> +echo -n "ebcda" | cmp $testdir/copy
> +echo "md5sums after swapping beginning and end:"
> +md5sum $testdir/{file,copy} | _filter_test_dir
> +
> +echo "Swap middle parts of original file"
> +$XFS_IO_PROG -f -c "copy_range -s 1 -d 3 -l 1 $testdir/file" "$testdir/copy" 2>&1
> +$XFS_IO_PROG -f -c "copy_range -s 3 -d 1 -l 1 $testdir/file" "$testdir/copy" 2>&1
> +echo -n "edcba" | cmp $testdir/copy
> +echo "md5sums after swapping middle:"
> +md5sum $testdir/{file,copy} | _filter_test_dir
> +
> +echo "Copy tail of original file onto copy"
> +$XFS_IO_PROG -f -c "copy_range -s 1 -d 3 -l 4 $testdir/file" "$testdir/copy" 2>&1
> +echo -n "edcbcde" | cmp $testdir/copy
> +echo "md5sums after copying tail:"
> +md5sum $testdir/{file,copy} | _filter_test_dir
> +
> +#success, all done
> +status=0
> +exit
> diff --git a/tests/generic/432.out b/tests/generic/432.out
> new file mode 100644
> index 00000000..eec84392
> --- /dev/null
> +++ b/tests/generic/432.out
> @@ -0,0 +1,17 @@
> +QA output created by 432
> +Create the original file and then copy
> +Original md5sums:
> +ab56b4d92b40713acc5af89985d4b786 TEST_DIR/test-432/file
> +ab56b4d92b40713acc5af89985d4b786 TEST_DIR/test-432/copy
> +Swap beginning and end of original file
> +md5sums after swapping beginning and end:
> +ab56b4d92b40713acc5af89985d4b786 TEST_DIR/test-432/file
> +32db1f6d06d15f7e38e1ab1c69da498a TEST_DIR/test-432/copy
> +Swap middle parts of original file
> +md5sums after swapping middle:
> +ab56b4d92b40713acc5af89985d4b786 TEST_DIR/test-432/file
> +295228f3d82d344bbcf2f0030519c2ea TEST_DIR/test-432/copy
> +Copy tail of original file onto copy
> +md5sums after copying tail:
> +ab56b4d92b40713acc5af89985d4b786 TEST_DIR/test-432/file
> +0c4aac952f72fa078e2f8419aca70b28 TEST_DIR/test-432/copy
> diff --git a/tests/generic/group b/tests/generic/group
> index 608c45b2..43aac9fd 100644
> --- a/tests/generic/group
> +++ b/tests/generic/group
> @@ -434,3 +434,4 @@
> 429 auto quick copy
> 430 auto quick copy
> 431 auto quick copy
> +432 auto quick copy
> --
> 2.12.2
>
> --
> To unsubscribe from this list: send the line "unsubscribe fstests" in
> the body of a message to [email protected]
> More majordomo info at http://vger.kernel.org/majordomo-info.html
On 05/10/2017 02:37 PM, Darrick J. Wong wrote:
> On Wed, May 10, 2017 at 01:46:27PM -0400, Anna Schumaker wrote:
>> This test is similar to 345, except that it copies one byte at a time to
>
> 345? Or is that now 431? Perhaps amend the commit message to "This
> test is similar to the previous one, except..."?
Yeah, I forgot to update that :( It's supposed to be for the previous test, so that's probably the best wording to use.
Anna
>
> Otherwise, the tests run ok on xfs and ext4 and look ok, so for the whole set
> Reviewed-by: Darrick J. Wong <[email protected]>
>
> --D
>
>> make sure that this case works as expected.
>>
>> Signed-off-by: Anna Schumaker <[email protected]>
>> ---
>> tests/generic/432 | 87 +++++++++++++++++++++++++++++++++++++++++++++++++++
>> tests/generic/432.out | 17 ++++++++++
>> tests/generic/group | 1 +
>> 3 files changed, 105 insertions(+)
>> create mode 100755 tests/generic/432
>> create mode 100644 tests/generic/432.out
>>
>> diff --git a/tests/generic/432 b/tests/generic/432
>> new file mode 100755
>> index 00000000..9cd899ce
>> --- /dev/null
>> +++ b/tests/generic/432
>> @@ -0,0 +1,87 @@
>> +#!/bin/bash
>> +# FS QA Test No. 432
>> +#
>> +# Tests vfs_copy_file_range():
>> +# - Copy a small file
>> +# - Use copy to swap data at beginning and end
>> +# - Use copy to swap data in the middle
>> +# - Use copy to swap data in a small file
>> +#-----------------------------------------------------------------------
>> +# Copyright (c) 2017 Netapp, Inc. 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.*
>> +}
>> +
>> +# get standard environment
>> +. common/rc
>> +. common/filter
>> +
>> +# real QA test starts here
>> +_supported_fs generic
>> +_supported_os Linux
>> +
>> +_require_xfs_io_command "copy_range"
>> +_require_test
>> +
>> +testdir=$TEST_DIR/test-$seq
>> +rm -rf $testdir
>> +mkdir $testdir
>> +rm -f $seqres.full
>> +
>> +echo "Create the original file and then copy"
>> +echo -n "abcde" > $testdir/file
>> +$XFS_IO_PROG -f -c "copy_range $testdir/file" "$testdir/copy" 2>&1
>> +cmp $testdir/file $testdir/copy
>> +echo "Original md5sums:"
>> +md5sum $testdir/{file,copy} | _filter_test_dir
>> +
>> +echo "Swap beginning and end of original file"
>> +$XFS_IO_PROG -f -c "copy_range -s 0 -d 4 -l 1 $testdir/file" "$testdir/copy" 2>&1
>> +$XFS_IO_PROG -f -c "copy_range -s 4 -d 0 -l 1 $testdir/file" "$testdir/copy" 2>&1
>> +echo -n "ebcda" | cmp $testdir/copy
>> +echo "md5sums after swapping beginning and end:"
>> +md5sum $testdir/{file,copy} | _filter_test_dir
>> +
>> +echo "Swap middle parts of original file"
>> +$XFS_IO_PROG -f -c "copy_range -s 1 -d 3 -l 1 $testdir/file" "$testdir/copy" 2>&1
>> +$XFS_IO_PROG -f -c "copy_range -s 3 -d 1 -l 1 $testdir/file" "$testdir/copy" 2>&1
>> +echo -n "edcba" | cmp $testdir/copy
>> +echo "md5sums after swapping middle:"
>> +md5sum $testdir/{file,copy} | _filter_test_dir
>> +
>> +echo "Copy tail of original file onto copy"
>> +$XFS_IO_PROG -f -c "copy_range -s 1 -d 3 -l 4 $testdir/file" "$testdir/copy" 2>&1
>> +echo -n "edcbcde" | cmp $testdir/copy
>> +echo "md5sums after copying tail:"
>> +md5sum $testdir/{file,copy} | _filter_test_dir
>> +
>> +#success, all done
>> +status=0
>> +exit
>> diff --git a/tests/generic/432.out b/tests/generic/432.out
>> new file mode 100644
>> index 00000000..eec84392
>> --- /dev/null
>> +++ b/tests/generic/432.out
>> @@ -0,0 +1,17 @@
>> +QA output created by 432
>> +Create the original file and then copy
>> +Original md5sums:
>> +ab56b4d92b40713acc5af89985d4b786 TEST_DIR/test-432/file
>> +ab56b4d92b40713acc5af89985d4b786 TEST_DIR/test-432/copy
>> +Swap beginning and end of original file
>> +md5sums after swapping beginning and end:
>> +ab56b4d92b40713acc5af89985d4b786 TEST_DIR/test-432/file
>> +32db1f6d06d15f7e38e1ab1c69da498a TEST_DIR/test-432/copy
>> +Swap middle parts of original file
>> +md5sums after swapping middle:
>> +ab56b4d92b40713acc5af89985d4b786 TEST_DIR/test-432/file
>> +295228f3d82d344bbcf2f0030519c2ea TEST_DIR/test-432/copy
>> +Copy tail of original file onto copy
>> +md5sums after copying tail:
>> +ab56b4d92b40713acc5af89985d4b786 TEST_DIR/test-432/file
>> +0c4aac952f72fa078e2f8419aca70b28 TEST_DIR/test-432/copy
>> diff --git a/tests/generic/group b/tests/generic/group
>> index 608c45b2..43aac9fd 100644
>> --- a/tests/generic/group
>> +++ b/tests/generic/group
>> @@ -434,3 +434,4 @@
>> 429 auto quick copy
>> 430 auto quick copy
>> 431 auto quick copy
>> +432 auto quick copy
>> --
>> 2.12.2
>>
>> --
>> To unsubscribe from this list: send the line "unsubscribe fstests" in
>> the body of a message to [email protected]
>> More majordomo info at http://vger.kernel.org/majordomo-info.html
On Wed, May 10, 2017 at 02:39:46PM -0400, Anna Schumaker wrote:
>
>
> On 05/10/2017 02:37 PM, Darrick J. Wong wrote:
> > On Wed, May 10, 2017 at 01:46:27PM -0400, Anna Schumaker wrote:
> >> This test is similar to 345, except that it copies one byte at a time to
> >
> > 345? Or is that now 431? Perhaps amend the commit message to "This
> > test is similar to the previous one, except..."?
>
> Yeah, I forgot to update that :( It's supposed to be for the previous test, so that's probably the best wording to use.
I can fix it at commit time. Thanks for the tests! And thanks Darrick
for reviewing!
BTW, seq number should be dropped in summary line too, tests are always
re-numberd on commit anyway, "generic: Add copy to new file test" should
be fine :)
Thanks,
Eryu
On Wed, May 10, 2017 at 01:46:24PM -0400, Anna Schumaker wrote:
> This test copies data from various points in a source file to a new
> file. This is useful for testing the basics of copy_file_range().
>
> Signed-off-by: Anna Schumaker <[email protected]>
> ---
> common/rc | 6 +++
> tests/generic/429 | 102 ++++++++++++++++++++++++++++++++++++++++++++++++++
> tests/generic/429.out | 25 +++++++++++++
> tests/generic/group | 1 +
> 4 files changed, 134 insertions(+)
> create mode 100755 tests/generic/429
> create mode 100644 tests/generic/429.out
>
> diff --git a/common/rc b/common/rc
> index 8dafd4bc..816d06a6 100644
> --- a/common/rc
> +++ b/common/rc
> @@ -2047,6 +2047,12 @@ _require_xfs_io_command()
> "chproj")
> testio=`$XFS_IO_PROG -F -f -c "chproj 0" $testfile 2>&1`
> ;;
> + "copy_range")
> + testcopy=$TEST_DIR/$$.copy.xfs_io
> + $XFS_IO_PROG -F -f -c "pwrite 0 4k" $testfile 2>&1 > /dev/null
> + testio=`$XFS_IO_PROG -F -f -c "copy_range $testfile" $testcopy 2>&1`
> + rm -f $testcopy 2>&1 > /dev/null
> + ;;
> "falloc" )
> testio=`$XFS_IO_PROG -F -f -c "falloc $param 0 1m" $testfile 2>&1`
> ;;
> diff --git a/tests/generic/429 b/tests/generic/429
> new file mode 100755
> index 00000000..fb52df8b
> --- /dev/null
> +++ b/tests/generic/429
> @@ -0,0 +1,102 @@
> +#!/bin/bash
> +# FS QA Test No. 429
> +#
> +# Tests vfs_copy_file_range():
> +# - Copy a file
> +# - Copy beginning of original to new file
> +# - Copy middle of original to a new file
> +# - Copy end of original to new file
> +# - Copy middle of original to a new file, creating a hole
> +#-----------------------------------------------------------------------
> +# Copyright (c) 2017 Netapp, Inc. 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.*
> +}
> +
> +# get standard environment
> +. common/rc
> +. common/filter
> +
> +# real QA test starts here
> +_supported_fs generic
> +_supported_os Linux
> +
> +_require_xfs_io_command "copy_range"
> +_require_test
> +
> +testdir=$TEST_DIR/test-$seq
> +rm -rf $testdir
> +mkdir $testdir
> +rm -f $seqres.full
> +
> +echo "Create the original file and then copy"
> +$XFS_IO_PROG -f -c 'pwrite -S 0x61 0 1000' $testdir/file >> $seqres.full 2>&1
> +$XFS_IO_PROG -f -c 'pwrite -S 0x62 1000 1000' $testdir/file >> $seqres.full 2>&1
> +$XFS_IO_PROG -f -c 'pwrite -S 0x63 2000 1000' $testdir/file >> $seqres.full 2>&1
> +$XFS_IO_PROG -f -c 'pwrite -S 0x64 3000 1000' $testdir/file >> $seqres.full 2>&1
> +$XFS_IO_PROG -f -c 'pwrite -S 0x65 4000 1000' $testdir/file >> $seqres.full 2>&1
> +$XFS_IO_PROG -f -c "copy_range $testdir/file" "$testdir/copy"
> +cmp $testdir/file $testdir/copy
> +echo "Original md5sums:"
> +md5sum $testdir/{file,copy} | _filter_test_dir
> +
> +echo "Copy beginning of original file"
> +$XFS_IO_PROG -f -c "copy_range -l 1000 $testdir/file" "$testdir/beginning" 2>&1
I just noticed these "2>&1" redirection of all the copy_range calls. The
test harness could save both stdout and stderr for golden output diff,
so the redirections are not needed.
I'll update all these tests to remove the redirections.
Thanks,
Eryu
> +cmp -n 1000 $testdir/file $testdir/beginning
> +echo "md5sums after copying beginning:"
> +md5sum $testdir/{file,beginning} | _filter_test_dir
> +
> +echo "Copy middle of original file"
> +$XFS_IO_PROG -f -c "copy_range -s 1000 -l 3000 $testdir/file" "$testdir/middle" 2>&1
> +cmp -n 3000 $testdir/file $testdir/middle 1000
> +echo "md5sums after copying middle:"
> +md5sum $testdir/{file,middle} | _filter_test_dir
> +
> +echo "Copy end of original file"
> +$XFS_IO_PROG -f -c "copy_range -s 4000 -l 1000 $testdir/file" "$testdir/end" 2>&1
> +cmp -n 1000 $testdir/file $testdir/end 4000
> +echo "md5sums after copying end:"
> +md5sum $testdir/{file,end} | _filter_test_dir
> +
> +echo "Copy beyond end of original file"
> +$XFS_IO_PROG -f -c "copy_range -s 4000 -l 2000 $testdir/file" "$testdir/beyond" 2>&1
> +cmp -n 1000 $testdir/file $testdir/end 4000
> +echo "md5sums after copying beyond:"
> +md5sum $testdir/{file,beyond} | _filter_test_dir
> +
> +echo "Copy creates hole in target file"
> +$XFS_IO_PROG -f -c "copy_range -s 1000 -l 3000 -d 1000 $testdir/file" "$testdir/hole" 2>&1
> +cmp -n 3000 $testdir/file $testdir/hole 1000 1000
> +echo "md5sums after creating hole:"
> +md5sum $testdir/{file,hole} | _filter_test_dir
> +
> +#success, all done
> +status=0
> +exit
> diff --git a/tests/generic/429.out b/tests/generic/429.out
> new file mode 100644
> index 00000000..8de90a44
> --- /dev/null
> +++ b/tests/generic/429.out
> @@ -0,0 +1,25 @@
> +QA output created by 429
> +Create the original file and then copy
> +Original md5sums:
> +e11fbace556cba26bf0076e74cab90a3 TEST_DIR/test-429/file
> +e11fbace556cba26bf0076e74cab90a3 TEST_DIR/test-429/copy
> +Copy beginning of original file
> +md5sums after copying beginning:
> +e11fbace556cba26bf0076e74cab90a3 TEST_DIR/test-429/file
> +cabe45dcc9ae5b66ba86600cca6b8ba8 TEST_DIR/test-429/beginning
> +Copy middle of original file
> +md5sums after copying middle:
> +e11fbace556cba26bf0076e74cab90a3 TEST_DIR/test-429/file
> +4197de9da5badfc302715486b82bcdf1 TEST_DIR/test-429/middle
> +Copy end of original file
> +md5sums after copying end:
> +e11fbace556cba26bf0076e74cab90a3 TEST_DIR/test-429/file
> +e68d4a150c4e42f4f9ea3ffe4c9cf4ed TEST_DIR/test-429/end
> +Copy beyond end of original file
> +md5sums after copying beyond:
> +e11fbace556cba26bf0076e74cab90a3 TEST_DIR/test-429/file
> +e68d4a150c4e42f4f9ea3ffe4c9cf4ed TEST_DIR/test-429/beyond
> +Copy creates hole in target file
> +md5sums after creating hole:
> +e11fbace556cba26bf0076e74cab90a3 TEST_DIR/test-429/file
> +3ae9aef0992f8cb51c90c9a0ff2dd9d2 TEST_DIR/test-429/hole
> diff --git a/tests/generic/group b/tests/generic/group
> index b3051752..1c0fbb73 100644
> --- a/tests/generic/group
> +++ b/tests/generic/group
> @@ -431,3 +431,4 @@
> 426 auto quick exportfs
> 427 auto quick aio rw
> 428 auto quick
> +429 auto quick copy
> --
> 2.12.2
>
> --
> To unsubscribe from this list: send the line "unsubscribe fstests" in
> the body of a message to [email protected]
> More majordomo info at http://vger.kernel.org/majordomo-info.html