]> git.apps.os.sepia.ceph.com Git - xfstests-dev.git/commitdiff
generic: add test for dedupe on an active swapfile
authorOmar Sandoval <osandov@fb.com>
Wed, 16 May 2018 20:38:47 +0000 (13:38 -0700)
committerEryu Guan <guaneryu@gmail.com>
Wed, 23 May 2018 02:53:04 +0000 (10:53 +0800)
Similar to generic/356 that makes sure we can't dedupe an active
swapfile.

Signed-off-by: Omar Sandoval <osandov@fb.com>
Reviewed-by: Eryu Guan <guaneryu@gmail.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
tests/generic/493 [new file with mode: 0755]
tests/generic/493.out [new file with mode: 0644]
tests/generic/group

diff --git a/tests/generic/493 b/tests/generic/493
new file mode 100755 (executable)
index 0000000..7351ced
--- /dev/null
@@ -0,0 +1,76 @@
+#! /bin/bash
+# FS QA Test 493
+#
+# Check that we can't dedupe a swapfile.
+#
+#-----------------------------------------------------------------------
+# Copyright (c) 2018 Facebook.  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 -f $tmp.*
+}
+
+. ./common/rc
+. ./common/filter
+. ./common/reflink
+
+rm -f $seqres.full
+
+_supported_fs generic
+_supported_os Linux
+_require_scratch_swapfile
+_require_scratch_dedupe
+
+echo "Format and mount"
+_scratch_mkfs > $seqres.full 2>&1
+_scratch_mount >> $seqres.full 2>&1
+
+testdir="$SCRATCH_MNT/test-$seq"
+mkdir "$testdir"
+
+blocks=160
+blksz=65536
+
+echo "Initialize file"
+_format_swapfile "$testdir/file1" $((blocks * blksz))
+swapon "$testdir/file1"
+
+touch "$testdir/file2"
+$CHATTR_PROG +C "$testdir/file2" >/dev/null 2>&1
+
+echo "Try to dedupe"
+cp "$testdir/file1" "$testdir/file2"
+_dedupe_range "$testdir/file1" 0 "$testdir/file2" 0 $((blocks * blksz))
+_dedupe_range "$testdir/file2" 0 "$testdir/file1" 0 $((blocks * blksz))
+
+echo "Tear it down"
+swapoff "$testdir/file1"
+
+status=0
+exit
diff --git a/tests/generic/493.out b/tests/generic/493.out
new file mode 100644 (file)
index 0000000..d3426ee
--- /dev/null
@@ -0,0 +1,7 @@
+QA output created by 493
+Format and mount
+Initialize file
+Try to dedupe
+XFS_IOC_FILE_EXTENT_SAME: Text file busy
+XFS_IOC_FILE_EXTENT_SAME: Text file busy
+Tear it down
index 112b6dfb93891ba252743db4c9f8e3548966302a..3d8d1009366b2163978b9cba437feb77c8a906ac 100644 (file)
 490 auto quick rw
 491 auto quick freeze mount
 492 auto quick
+493 auto quick swap