[PATCH v2 5/5] generic: cross-device copy_file_range test

Amir Goldstein
2019-05-26T08:45:50Z

Old kernels do not support cross-device copy_file_range.
A new patch set is aimed at allowing cross-device copy_file_range
using the default in-kernel copy implementation.

[Amir] Split out cross-device copy_range test to a new test.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Amir Goldstein <amir73il@gmail.com>
---
tests/generic/991 | 56 +++++++++++++++++++++++++++++++++++++++++++
tests/generic/991.out | 4 ++++
tests/generic/group | 1 +
3 files changed, 61 insertions(+)
create mode 100755 tests/generic/991
create mode 100644 tests/generic/991.out

diff --git a/tests/generic/991 b/tests/generic/991
new file mode 100755
index 00000000..94266e89
--- /dev/null
+++ b/tests/generic/991
@@ -0,0 +1,56 @@
+#! /bin/bash
+# SPDX-License-Identifier: GPL-2.0
+# Copyright (c) 2018 Red Hat, Inc. All Rights Reserved.
+#
+# FS QA Test No. 991
+#
+# Exercise copy_file_range() across devices
+#
+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 7 15
+
+_cleanup()
+{
+ cd /
+ rm -rf $tmp.*
+}
+
+# get standard environment, filters and checks
+. ./common/rc
+. ./common/filter
+
+# real QA test starts here
+_supported_os Linux
+_supported_fs generic
+
+rm -f $seqres.full
+
+_require_test
+_require_scratch
+_require_xfs_io_command "copy_range"
+
+_scratch_mkfs 2>&1 >> $seqres.full
+_scratch_mount
+
+
+testdir=$TEST_DIR/test-$seq
+rm -rf $testdir
+mkdir $testdir
+rm -f $seqres.full
+
+$XFS_IO_PROG -f -c "pwrite -S 0x61 0 128k" $testdir/file >> $seqres.full 2>&1
+
+$XFS_IO_PROG -f -c "copy_range -l 128k $testdir/file" $SCRATCH_MNT/copy
+cmp $testdir/file $SCRATCH_MNT/copy
+echo "md5sums after xdev copy:"
+md5sum $testdir/file $SCRATCH_MNT/copy | _filter_test_dir | _filter_scratch
+
+# success, all done
+status=0
+exit
diff --git a/tests/generic/991.out b/tests/generic/991.out
new file mode 100644
index 00000000..19c22dfe
--- /dev/null
+++ b/tests/generic/991.out
@@ -0,0 +1,4 @@
+QA output created by 991
+md5sums after xdev copy:
+81615449a98aaaad8dc179b3bec87f38 TEST_DIR/test-991/file
+81615449a98aaaad8dc179b3bec87f38 SCRATCH_MNT/copy
diff --git a/tests/generic/group b/tests/generic/group
index 86802d54..bc5dac3b 100644
--- a/tests/generic/group
+++ b/tests/generic/group
@@ -553,3 +553,4 @@
988 auto quick copy_range
989 auto quick copy_range swap
990 auto quick copy_range
+991 auto quick copy_range
--
2.17.1