]> www.infradead.org Git - users/hch/xfstests-dev.git/commitdiff
generic: check that destination timestamps are not updated on dedupe
authorChristoph Hellwig <hch@lst.de>
Fri, 3 Feb 2017 09:58:39 +0000 (10:58 +0100)
committerEryu Guan <eguan@redhat.com>
Sat, 4 Feb 2017 06:16:43 +0000 (14:16 +0800)
Signed-off-by: Christoph Hellwig <hch@lst.de
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
tests/generic/408 [new file with mode: 0644]
tests/generic/408.out [new file with mode: 0644]
tests/generic/group

diff --git a/tests/generic/408 b/tests/generic/408
new file mode 100644 (file)
index 0000000..dd78de5
--- /dev/null
@@ -0,0 +1,84 @@
+#! /bin/bash
+# FS QA Test No. 408
+#
+# Verify that mtime is not updated when deduping files.
+#
+#-----------------------------------------------------------------------
+#
+# Copyright (c) 2017 Christoph Hellwig.  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`
+status=0
+trap "_cleanup; exit \$status" 0 1 2 3 15
+
+_cleanup()
+{
+       cd /
+       rm -f $sourcefile
+       rm -f $destfile
+}
+
+# get standard environment, filters and checks
+. ./common/rc
+. ./common/filter
+. ./common/reflink
+
+# real QA test starts here
+_supported_fs generic
+_supported_os Linux
+
+_require_test
+_require_test_dedupe
+
+echo "Silence is golden."
+rm -f $seqres.full
+
+# pattern the files.
+sourcefile=$TEST_DIR/dedup_mtime_sourcefile
+$XFS_IO_PROG -f -c "pwrite 0 4k" -c fsync $sourcefile >> $seqres.full
+
+destfile=$TEST_DIR/dedup_mtime_destfile
+$XFS_IO_PROG -f -c "pwrite 0 4k" -c fsync $destfile >> $seqres.full
+
+# sample timestamps.
+mtime1=`stat -c %Y $destfile`
+ctime1=`stat -c %Z $destfile`
+echo "before dedup: $mtime1 $ctime1" >> $seqres.full
+
+# dedup to trigger timestamp change
+sleep 1
+_dedupe_range $sourcefile 0 $destfile 0 "4k" >> $seqres.full
+
+# sample and verify that timestamps have changed.
+mtime2=`stat -c %Y $destfile`
+ctime2=`stat -c %Z $destfile`
+echo "after dedup : $mtime2 $ctime2" >> $seqres.full
+
+if [ "$mtime1" != "$mtime2" ]; then
+       echo "mtime updated"
+       let status=$status+1
+fi
+if [ "$ctime1" != "$ctime2" ]; then
+       echo "ctime updated"
+       let status=$status+1
+fi
+
+exit
diff --git a/tests/generic/408.out b/tests/generic/408.out
new file mode 100644 (file)
index 0000000..29ec47a
--- /dev/null
@@ -0,0 +1,2 @@
+QA output created by 408
+Silence is golden.
index 0015c12dd47b0dd8b68816b7244e7fa9ce793b91..d0bc47de699578e55f316ea5420d09ef2ae47eae 100644 (file)
 405 auto mkfs
 406 auto quick dangerous
 407 auto quick clone metadata
+408 auto quick clone dedupe metadata