fstests.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] generic/597: test data integrity for rdonly remount
@ 2020-05-19  8:09 Chengguang Xu
  2020-05-20 15:09 ` Filipe Manana
  0 siblings, 1 reply; 4+ messages in thread
From: Chengguang Xu @ 2020-05-19  8:09 UTC (permalink / raw)
  To: guaneryu; +Cc: fstests, linux-unionfs, Chengguang Xu

This test checks data integrity when remounting from
rw to ro mode.

Signed-off-by: Chengguang Xu <cgxu519@mykernel.net>
---
v1->v2:
- Add to shutdown greoup.
- Change case number to 597

 tests/generic/597     | 54 +++++++++++++++++++++++++++++++++++++++++++
 tests/generic/597.out |  2 ++
 tests/generic/group   |  1 +
 3 files changed, 57 insertions(+)
 create mode 100755 tests/generic/597
 create mode 100644 tests/generic/597.out

diff --git a/tests/generic/597 b/tests/generic/597
new file mode 100755
index 00000000..d96e750b
--- /dev/null
+++ b/tests/generic/597
@@ -0,0 +1,54 @@
+#! /bin/bash
+# SPDX-License-Identifier: GPL-2.0
+# Copyright (c) 2020 Chengguang Xu <cgxu519@mykernel.net>.
+# All Rights Reserved.
+#
+# FS QA Test 597
+#
+# Test data integrity for ro remount.
+#
+seq=`basename $0`
+seqres=$RESULT_DIR/$seq
+echo "QA output created by $seq"
+
+here=`pwd`
+tmp=/tmp/$$
+status=0
+trap "_cleanup; exit \$status" 0 1 2 3 15
+
+_cleanup()
+{
+	cd /
+	rm -f $tmp.*
+}
+
+# get standard environment, filters and checks
+. ./common/rc
+. ./common/filter
+
+# remove previous $seqres.full before test
+rm -f $seqres.full
+
+# real QA test starts here
+_supported_fs generic
+_supported_os Linux
+_require_fssum
+_require_scratch
+_require_scratch_shutdown
+
+_scratch_mkfs &>/dev/null
+_scratch_mount
+
+localdir=$SCRATCH_MNT/dir
+mkdir $localdir
+sync
+
+# fssum used for comparing checksum of test file(data & metedata),
+# exclude checking about atime, block structure, open error.
+$FSSUM_PROG -ugomAcdES -f -w $tmp.fssum $localdir
+_scratch_remount ro
+_scratch_shutdown
+_scratch_cycle_mount
+$FSSUM_PROG -r $tmp.fssum $localdir
+
+exit
diff --git a/tests/generic/597.out b/tests/generic/597.out
new file mode 100644
index 00000000..a847cfe2
--- /dev/null
+++ b/tests/generic/597.out
@@ -0,0 +1,2 @@
+QA output created by 597
+OK
diff --git a/tests/generic/group b/tests/generic/group
index e82004e8..d68fee9a 100644
--- a/tests/generic/group
+++ b/tests/generic/group
@@ -599,3 +599,4 @@
 594 auto quick quota
 595 auto quick encrypt
 596 auto quick
+597 auto quick remount shutdown
-- 
2.20.1



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

* Re: [PATCH v2] generic/597: test data integrity for rdonly remount
  2020-05-19  8:09 [PATCH v2] generic/597: test data integrity for rdonly remount Chengguang Xu
@ 2020-05-20 15:09 ` Filipe Manana
  2020-05-25  2:17   ` cgxu
  0 siblings, 1 reply; 4+ messages in thread
From: Filipe Manana @ 2020-05-20 15:09 UTC (permalink / raw)
  To: Chengguang Xu; +Cc: Eryu Guan, fstests, linux-unionfs

On Tue, May 19, 2020 at 9:10 AM Chengguang Xu <cgxu519@mykernel.net> wrote:
>
> This test checks data integrity when remounting from
> rw to ro mode.
>
> Signed-off-by: Chengguang Xu <cgxu519@mykernel.net>
> ---
> v1->v2:
> - Add to shutdown greoup.
> - Change case number to 597
>
>  tests/generic/597     | 54 +++++++++++++++++++++++++++++++++++++++++++
>  tests/generic/597.out |  2 ++
>  tests/generic/group   |  1 +
>  3 files changed, 57 insertions(+)
>  create mode 100755 tests/generic/597
>  create mode 100644 tests/generic/597.out
>
> diff --git a/tests/generic/597 b/tests/generic/597
> new file mode 100755
> index 00000000..d96e750b
> --- /dev/null
> +++ b/tests/generic/597
> @@ -0,0 +1,54 @@
> +#! /bin/bash
> +# SPDX-License-Identifier: GPL-2.0
> +# Copyright (c) 2020 Chengguang Xu <cgxu519@mykernel.net>.
> +# All Rights Reserved.
> +#
> +# FS QA Test 597
> +#
> +# Test data integrity for ro remount.
> +#
> +seq=`basename $0`
> +seqres=$RESULT_DIR/$seq
> +echo "QA output created by $seq"
> +
> +here=`pwd`
> +tmp=/tmp/$$
> +status=0
> +trap "_cleanup; exit \$status" 0 1 2 3 15
> +
> +_cleanup()
> +{
> +       cd /
> +       rm -f $tmp.*
> +}
> +
> +# get standard environment, filters and checks
> +. ./common/rc
> +. ./common/filter
> +
> +# remove previous $seqres.full before test
> +rm -f $seqres.full
> +
> +# real QA test starts here
> +_supported_fs generic
> +_supported_os Linux
> +_require_fssum
> +_require_scratch
> +_require_scratch_shutdown

Couldn't the test be using dm's flakey instead of shutdown?
As shutdown is not implemented by all filesystems (btrfs for example),
it would allow more coverage.

Thanks.

> +
> +_scratch_mkfs &>/dev/null
> +_scratch_mount
> +
> +localdir=$SCRATCH_MNT/dir
> +mkdir $localdir
> +sync
> +
> +# fssum used for comparing checksum of test file(data & metedata),
> +# exclude checking about atime, block structure, open error.
> +$FSSUM_PROG -ugomAcdES -f -w $tmp.fssum $localdir
> +_scratch_remount ro
> +_scratch_shutdown
> +_scratch_cycle_mount
> +$FSSUM_PROG -r $tmp.fssum $localdir
> +
> +exit
> diff --git a/tests/generic/597.out b/tests/generic/597.out
> new file mode 100644
> index 00000000..a847cfe2
> --- /dev/null
> +++ b/tests/generic/597.out
> @@ -0,0 +1,2 @@
> +QA output created by 597
> +OK
> diff --git a/tests/generic/group b/tests/generic/group
> index e82004e8..d68fee9a 100644
> --- a/tests/generic/group
> +++ b/tests/generic/group
> @@ -599,3 +599,4 @@
>  594 auto quick quota
>  595 auto quick encrypt
>  596 auto quick
> +597 auto quick remount shutdown
> --
> 2.20.1
>
>


-- 
Filipe David Manana,

“Whether you think you can, or you think you can't — you're right.”

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

* Re: [PATCH v2] generic/597: test data integrity for rdonly remount
  2020-05-20 15:09 ` Filipe Manana
@ 2020-05-25  2:17   ` cgxu
  2020-05-25  3:40     ` Amir Goldstein
  0 siblings, 1 reply; 4+ messages in thread
From: cgxu @ 2020-05-25  2:17 UTC (permalink / raw)
  To: fdmanana; +Cc: Eryu Guan, fstests, linux-unionfs

On 5/20/20 11:09 PM, Filipe Manana wrote:
> On Tue, May 19, 2020 at 9:10 AM Chengguang Xu <cgxu519@mykernel.net> wrote:
>>
>> This test checks data integrity when remounting from
>> rw to ro mode.
>>
>> Signed-off-by: Chengguang Xu <cgxu519@mykernel.net>
>> ---
>> v1->v2:
>> - Add to shutdown greoup.
>> - Change case number to 597
>>
>>   tests/generic/597     | 54 +++++++++++++++++++++++++++++++++++++++++++
>>   tests/generic/597.out |  2 ++
>>   tests/generic/group   |  1 +
>>   3 files changed, 57 insertions(+)
>>   create mode 100755 tests/generic/597
>>   create mode 100644 tests/generic/597.out
>>
>> diff --git a/tests/generic/597 b/tests/generic/597
>> new file mode 100755
>> index 00000000..d96e750b
>> --- /dev/null
>> +++ b/tests/generic/597
>> @@ -0,0 +1,54 @@
>> +#! /bin/bash
>> +# SPDX-License-Identifier: GPL-2.0
>> +# Copyright (c) 2020 Chengguang Xu <cgxu519@mykernel.net>.
>> +# All Rights Reserved.
>> +#
>> +# FS QA Test 597
>> +#
>> +# Test data integrity for ro remount.
>> +#
>> +seq=`basename $0`
>> +seqres=$RESULT_DIR/$seq
>> +echo "QA output created by $seq"
>> +
>> +here=`pwd`
>> +tmp=/tmp/$$
>> +status=0
>> +trap "_cleanup; exit \$status" 0 1 2 3 15
>> +
>> +_cleanup()
>> +{
>> +       cd /
>> +       rm -f $tmp.*
>> +}
>> +
>> +# get standard environment, filters and checks
>> +. ./common/rc
>> +. ./common/filter
>> +
>> +# remove previous $seqres.full before test
>> +rm -f $seqres.full
>> +
>> +# real QA test starts here
>> +_supported_fs generic
>> +_supported_os Linux
>> +_require_fssum
>> +_require_scratch
>> +_require_scratch_shutdown
> 
> Couldn't the test be using dm's flakey instead of shutdown?
> As shutdown is not implemented by all filesystems (btrfs for example),
> it would allow more coverage.
> 

Thanks for the suggestion, I tried with dmflakey but unfortunately it 
could not work on overlayfs, a possible solution is that move current 
test case to overlay specific directory and create new test case with 
dmflakey for generic purpose.


Test results with dmflakey on xfs, btrfs and overlayfs.

[root@hades xfstests-dev]# ./check  generic/597
FSTYP         -- xfs (non-debug)
PLATFORM      -- Linux/x86_64 hades 5.6.0-rc3+ #31 SMP Fri May 22 
11:27:07 CST 2020
MKFS_OPTIONS  -- -f -bsize=4096 /dev/nvme0n1p8
MOUNT_OPTIONS -- /dev/nvme0n1p8 /mnt/scratch

generic/597 1s ...  0s
Ran: generic/597
Passed all 1 tests


[root@hades xfstests-dev]# ./check generic/597
FSTYP         -- btrfs
PLATFORM      -- Linux/x86_64 hades 5.6.0-rc3+ #31 SMP Fri May 22 
11:27:07 CST 2020
MKFS_OPTIONS  -- /dev/nvme0n1p8
MOUNT_OPTIONS -- /dev/nvme0n1p8 /mnt/scratch

generic/597 0s ...  0s
Ran: generic/597
Passed all 1 tests


[root@hades xfstests-dev]# ./check -overlay generic/597
FSTYP         -- overlay
PLATFORM      -- Linux/x86_64 hades 5.6.0-rc3+ #31 SMP Fri May 22 
11:27:07 CST 2020
MKFS_OPTIONS  -- /mnt/scratch
MOUNT_OPTIONS -- /mnt/scratch /mnt/scratch/ovl-mnt

generic/597 0s ... [not run] require /mnt/scratch to be valid block disk
Ran: generic/597
Not run: generic/597
Passed all 1 tests


Thanks,
cgxu












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

* Re: [PATCH v2] generic/597: test data integrity for rdonly remount
  2020-05-25  2:17   ` cgxu
@ 2020-05-25  3:40     ` Amir Goldstein
  0 siblings, 0 replies; 4+ messages in thread
From: Amir Goldstein @ 2020-05-25  3:40 UTC (permalink / raw)
  To: cgxu; +Cc: Filipe Manana, Eryu Guan, fstests, overlayfs

On Mon, May 25, 2020 at 5:25 AM cgxu <cgxu519@mykernel.net> wrote:
>
> On 5/20/20 11:09 PM, Filipe Manana wrote:
> > On Tue, May 19, 2020 at 9:10 AM Chengguang Xu <cgxu519@mykernel.net> wrote:
> >>
> >> This test checks data integrity when remounting from
> >> rw to ro mode.
> >>
> >> Signed-off-by: Chengguang Xu <cgxu519@mykernel.net>
> >> ---
> >> v1->v2:
> >> - Add to shutdown greoup.
> >> - Change case number to 597
> >>
> >>   tests/generic/597     | 54 +++++++++++++++++++++++++++++++++++++++++++
> >>   tests/generic/597.out |  2 ++
> >>   tests/generic/group   |  1 +
> >>   3 files changed, 57 insertions(+)
> >>   create mode 100755 tests/generic/597
> >>   create mode 100644 tests/generic/597.out
> >>
> >> diff --git a/tests/generic/597 b/tests/generic/597
> >> new file mode 100755
> >> index 00000000..d96e750b
> >> --- /dev/null
> >> +++ b/tests/generic/597
> >> @@ -0,0 +1,54 @@
> >> +#! /bin/bash
> >> +# SPDX-License-Identifier: GPL-2.0
> >> +# Copyright (c) 2020 Chengguang Xu <cgxu519@mykernel.net>.
> >> +# All Rights Reserved.
> >> +#
> >> +# FS QA Test 597
> >> +#
> >> +# Test data integrity for ro remount.
> >> +#
> >> +seq=`basename $0`
> >> +seqres=$RESULT_DIR/$seq
> >> +echo "QA output created by $seq"
> >> +
> >> +here=`pwd`
> >> +tmp=/tmp/$$
> >> +status=0
> >> +trap "_cleanup; exit \$status" 0 1 2 3 15
> >> +
> >> +_cleanup()
> >> +{
> >> +       cd /
> >> +       rm -f $tmp.*
> >> +}
> >> +
> >> +# get standard environment, filters and checks
> >> +. ./common/rc
> >> +. ./common/filter
> >> +
> >> +# remove previous $seqres.full before test
> >> +rm -f $seqres.full
> >> +
> >> +# real QA test starts here
> >> +_supported_fs generic
> >> +_supported_os Linux
> >> +_require_fssum
> >> +_require_scratch
> >> +_require_scratch_shutdown
> >
> > Couldn't the test be using dm's flakey instead of shutdown?
> > As shutdown is not implemented by all filesystems (btrfs for example),
> > it would allow more coverage.
> >
>
> Thanks for the suggestion, I tried with dmflakey but unfortunately it
> could not work on overlayfs, a possible solution is that move current
> test case to overlay specific directory and create new test case with
> dmflakey for generic purpose.
>

Or you can create an abstraction for shutdown/dmflakey, because
this test doesn't care which one you use:

_require_scratch_drop
_init_scratch_drop
_mount_scratch_drop
_scratch_drop_and_remount
_cleanup_scratch_drop

But IMO, this could also be done after merging test to increase test
coverage.

Thanks,
Amir.

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

end of thread, other threads:[~2020-05-25  3:40 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-19  8:09 [PATCH v2] generic/597: test data integrity for rdonly remount Chengguang Xu
2020-05-20 15:09 ` Filipe Manana
2020-05-25  2:17   ` cgxu
2020-05-25  3:40     ` Amir Goldstein

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).