shared,generic: move tests using duperemove to generic/
[xfstests-dev.git] / common / reflink
index 11561a762544157e85a308eec67bb3884d390381..ee60398ed20ae9dab05037fbfc8024beea514cee 100644 (file)
@@ -14,9 +14,14 @@ _require_cp_reflink()
 # Can we reflink between arbitrary file sets?
 # i.e. if we reflink a->b and c->d, can we later share
 # blocks between b & c?
+_supports_arbitrary_fileset_reflink()
+{
+       test "$FSTYP" != "ocfs2"
+}
+
 _require_arbitrary_fileset_reflink()
 {
-       test "$FSTYP" = "ocfs2" && \
+       _supports_arbitrary_fileset_reflink ||
                _notrun "reflink between arbitrary file groups not supported in $FSTYP"
 }
 
@@ -70,6 +75,24 @@ _require_scratch_reflink()
        _scratch_unmount
 }
 
+# this test requires duperemove working for the file system
+_require_scratch_duperemove()
+{
+       _require_scratch
+       _require_command "$DUPEREMOVE_PROG" duperemove
+
+       _scratch_mkfs > /dev/null
+       _scratch_mount
+       dd if=/dev/zero of="$SCRATCH_MNT/file1" bs=128k count=1 >& /dev/null
+       dd if=/dev/zero of="$SCRATCH_MNT/file2" bs=128k count=1 >& /dev/null
+       if ! "$DUPEREMOVE_PROG" -d "$SCRATCH_MNT/file1" \
+           "$SCRATCH_MNT/file2" >& /dev/null ; then
+               _scratch_unmount
+               _notrun "duperemove does not support file system type: $FSTYP"
+       fi
+       _scratch_unmount
+}
+
 # this test requires scratch fs to report explicit SHARED flag
 # e.g.
 #   0         4K         8K