public inbox for fstests@vger.kernel.org
 help / color / mirror / Atom feed
* clone/dedup timestamp tests V2
@ 2017-02-03  9:58 Christoph Hellwig
  2017-02-03  9:58 ` [PATCH 1/2] generic/407: check that destination timestamps are updated on clone Christoph Hellwig
  2017-02-03  9:58 ` [PATCH 2/2] generic/408: check that destination timestamps are not updated on dedupe Christoph Hellwig
  0 siblings, 2 replies; 5+ messages in thread
From: Christoph Hellwig @ 2017-02-03  9:58 UTC (permalink / raw)
  To: fstests

A few fixes to the new 407 test compared to the previous one: only
sleep one second and clean up the test files properly.

A second test for the dedupe timestamps.  While both tests are prretty
trivial the feature checks are different, so we need two.


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 1/2] generic/407: check that destination timestamps are updated on clone
  2017-02-03  9:58 clone/dedup timestamp tests V2 Christoph Hellwig
@ 2017-02-03  9:58 ` Christoph Hellwig
  2017-02-04  4:15   ` Eryu Guan
  2017-02-03  9:58 ` [PATCH 2/2] generic/408: check that destination timestamps are not updated on dedupe Christoph Hellwig
  1 sibling, 1 reply; 5+ messages in thread
From: Christoph Hellwig @ 2017-02-03  9:58 UTC (permalink / raw)
  To: fstests

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 tests/generic/407     | 85 +++++++++++++++++++++++++++++++++++++++++++++++++++
 tests/generic/407.out |  2 ++
 tests/generic/group   |  1 +
 3 files changed, 88 insertions(+)
 create mode 100755 tests/generic/407
 create mode 100644 tests/generic/407.out

diff --git a/tests/generic/407 b/tests/generic/407
new file mode 100755
index 00000000..0fd111ca
--- /dev/null
+++ b/tests/generic/407
@@ -0,0 +1,85 @@
+#! /bin/bash
+# FS QA Test No. 407
+#
+# Verify that mtime is updated when cloning 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_reflink
+_require_cp_reflink
+
+echo "Silence is golden."
+rm -f $seqres.full
+
+# pattern the files.
+sourcefile=$TEST_DIR/clone_mtime_sourcefile
+$XFS_IO_PROG -f -c "pwrite 0 4k" -c fsync $sourcefile >> $seqres.full
+
+destfile=$TEST_DIR/clone_mtime_destfile
+touch $destfile >> $seqres.full
+
+# sample timestamps.
+mtime1=`stat -c %Y $destfile`
+ctime1=`stat -c %Z $destfile`
+echo "before clone: $mtime1 $ctime1" >> $seqres.full
+
+# clone to trigger timestamp change
+sleep 1
+$XFS_IO_PROG -c "reflink $sourcefile " $destfile >> $seqres.full
+
+# sample and verify that timestamps have changed.
+mtime2=`stat -c %Y $destfile`
+ctime2=`stat -c %Z $destfile`
+echo "after clone : $mtime2 $ctime2" >> $seqres.full
+
+if [ "$mtime1" == "$mtime2" ]; then
+	echo "mtime not updated"
+	let status=$status+1
+fi
+if [ "$ctime1" == "$ctime2" ]; then
+	echo "ctime not updated"
+	let status=$status+1
+fi
+
+exit
diff --git a/tests/generic/407.out b/tests/generic/407.out
new file mode 100644
index 00000000..e29fe156
--- /dev/null
+++ b/tests/generic/407.out
@@ -0,0 +1,2 @@
+QA output created by 407
+Silence is golden.
diff --git a/tests/generic/group b/tests/generic/group
index 159d691b..72d6b3cb 100644
--- a/tests/generic/group
+++ b/tests/generic/group
@@ -409,3 +409,4 @@
 404 auto quick insert
 405 auto mkfs
 406 auto quick dangerous
+407 auto quick clone metadata
-- 
2.11.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 2/2] generic/408: check that destination timestamps are not updated on dedupe
  2017-02-03  9:58 clone/dedup timestamp tests V2 Christoph Hellwig
  2017-02-03  9:58 ` [PATCH 1/2] generic/407: check that destination timestamps are updated on clone Christoph Hellwig
@ 2017-02-03  9:58 ` Christoph Hellwig
  1 sibling, 0 replies; 5+ messages in thread
From: Christoph Hellwig @ 2017-02-03  9:58 UTC (permalink / raw)
  To: fstests; +Cc: Christoph Hellwig

Signed-off-by: Christoph Hellwig <hch@lst.de
---
 tests/generic/408     | 84 +++++++++++++++++++++++++++++++++++++++++++++++++++
 tests/generic/408.out |  2 ++
 tests/generic/group   |  1 +
 3 files changed, 87 insertions(+)
 create mode 100644 tests/generic/408
 create mode 100644 tests/generic/408.out

diff --git a/tests/generic/408 b/tests/generic/408
new file mode 100644
index 00000000..26cfc35e
--- /dev/null
+++ b/tests/generic/408
@@ -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
index 00000000..29ec47a8
--- /dev/null
+++ b/tests/generic/408.out
@@ -0,0 +1,2 @@
+QA output created by 408
+Silence is golden.
diff --git a/tests/generic/group b/tests/generic/group
index 72d6b3cb..740ce45b 100644
--- a/tests/generic/group
+++ b/tests/generic/group
@@ -410,3 +410,4 @@
 405 auto mkfs
 406 auto quick dangerous
 407 auto quick clone metadata
+408 auto quick clone dedupe metadata
-- 
2.11.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH 1/2] generic/407: check that destination timestamps are updated on clone
  2017-02-03  9:58 ` [PATCH 1/2] generic/407: check that destination timestamps are updated on clone Christoph Hellwig
@ 2017-02-04  4:15   ` Eryu Guan
  2017-02-04 10:02     ` Christoph Hellwig
  0 siblings, 1 reply; 5+ messages in thread
From: Eryu Guan @ 2017-02-04  4:15 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: fstests

On Fri, Feb 03, 2017 at 10:58:38AM +0100, Christoph Hellwig wrote:
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> ---
>  tests/generic/407     | 85 +++++++++++++++++++++++++++++++++++++++++++++++++++
>  tests/generic/407.out |  2 ++
>  tests/generic/group   |  1 +
>  3 files changed, 88 insertions(+)
>  create mode 100755 tests/generic/407
>  create mode 100644 tests/generic/407.out
> 
> diff --git a/tests/generic/407 b/tests/generic/407
> new file mode 100755
> index 00000000..0fd111ca
> --- /dev/null
> +++ b/tests/generic/407
> @@ -0,0 +1,85 @@
> +#! /bin/bash
> +# FS QA Test No. 407
> +#
> +# Verify that mtime is updated when cloning 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

For consistency, ". ./common/reflink" looks better.

> +
> +# real QA test starts here
> +_supported_fs generic
> +_supported_os Linux
> +
> +_require_test
> +_require_test_reflink
> +_require_cp_reflink

This seems not necessary, cp is not used and xfs_io reflink command is
checked in _require_test_reflink.

Otherwise looks good to me. I can fix them at commit time.

Thanks,
Eryu

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 1/2] generic/407: check that destination timestamps are updated on clone
  2017-02-04  4:15   ` Eryu Guan
@ 2017-02-04 10:02     ` Christoph Hellwig
  0 siblings, 0 replies; 5+ messages in thread
From: Christoph Hellwig @ 2017-02-04 10:02 UTC (permalink / raw)
  To: Eryu Guan; +Cc: Christoph Hellwig, fstests

On Sat, Feb 04, 2017 at 12:15:26PM +0800, Eryu Guan wrote:
> > +# get standard environment, filters and checks
> > +. ./common/rc
> > +. ./common/filter
> > +. common/reflink
> 
> For consistency, ". ./common/reflink" looks better.

Sure, this was fat fingered anyway :)

> > +
> > +# real QA test starts here
> > +_supported_fs generic
> > +_supported_os Linux
> > +
> > +_require_test
> > +_require_test_reflink
> > +_require_cp_reflink
> 
> This seems not necessary, cp is not used and xfs_io reflink command is
> checked in _require_test_reflink.

Yeah - the first version used cp, but I changed it later so this an be
safely dropped.

> Otherwise looks good to me. I can fix them at commit time.

Please do, thanks a lot!

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2017-02-04 10:02 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-02-03  9:58 clone/dedup timestamp tests V2 Christoph Hellwig
2017-02-03  9:58 ` [PATCH 1/2] generic/407: check that destination timestamps are updated on clone Christoph Hellwig
2017-02-04  4:15   ` Eryu Guan
2017-02-04 10:02     ` Christoph Hellwig
2017-02-03  9:58 ` [PATCH 2/2] generic/408: check that destination timestamps are not updated on dedupe Christoph Hellwig

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox