fstests.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] generic/43{0,1,2,3}: add -t option when create $testdir/copy file
@ 2019-09-05  1:39 Jianhong.Yin
  2019-09-06  1:26 ` Zorro Lang
  0 siblings, 1 reply; 5+ messages in thread
From: Jianhong.Yin @ 2019-09-05  1:39 UTC (permalink / raw)
  To: fstests; +Cc: darrick.wong, jiyin, Jianhong.Yin

to avoid there's already a copy file before run test,
it might break test.

I know now in xfs_io->copy_range there's a hidden truncate action
to do that, but we are taking about remove it, see:
 https://www.spinics.net/lists/linux-xfs/msg31292.html
 https://www.spinics.net/lists/linux-xfs/msg31327.html

Signed-off-by: Jianhong Yin <yin-jianhong@163.com>
---
 tests/generic/430 | 2 +-
 tests/generic/431 | 2 +-
 tests/generic/432 | 2 +-
 tests/generic/433 | 2 +-
 4 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/tests/generic/430 b/tests/generic/430
index 1b11f60d..71c6d438 100755
--- a/tests/generic/430
+++ b/tests/generic/430
@@ -47,7 +47,7 @@ $XFS_IO_PROG -f -c 'pwrite -S 0x62 1000 1000' $testdir/file >> $seqres.full 2>&1
 $XFS_IO_PROG -f -c 'pwrite -S 0x63 2000 1000' $testdir/file >> $seqres.full 2>&1
 $XFS_IO_PROG -f -c 'pwrite -S 0x64 3000 1000' $testdir/file >> $seqres.full 2>&1
 $XFS_IO_PROG -f -c 'pwrite -S 0x65 4000 1000' $testdir/file >> $seqres.full 2>&1
-$XFS_IO_PROG -f -c "copy_range $testdir/file" "$testdir/copy"
+$XFS_IO_PROG -t -f -c "copy_range $testdir/file" "$testdir/copy"
 cmp $testdir/file $testdir/copy
 echo "Original md5sums:"
 md5sum $testdir/{file,copy} | _filter_test_dir
diff --git a/tests/generic/431 b/tests/generic/431
index f04ae215..4b22a8ff 100755
--- a/tests/generic/431
+++ b/tests/generic/431
@@ -40,7 +40,7 @@ rm -f $seqres.full
 
 echo "Create the original file and then copy"
 echo -n "abcde" > $testdir/file
-$XFS_IO_PROG -f -c "copy_range $testdir/file" "$testdir/copy"
+$XFS_IO_PROG -t -f -c "copy_range $testdir/file" "$testdir/copy"
 echo -n "abcde" | cmp $testdir/copy
 echo "Original md5sums:"
 md5sum $testdir/{file,copy} | _filter_test_dir
diff --git a/tests/generic/432 b/tests/generic/432
index 6200af86..a2fecf37 100755
--- a/tests/generic/432
+++ b/tests/generic/432
@@ -46,7 +46,7 @@ $XFS_IO_PROG -f -c 'pwrite -S 0x62 1000 1000' $testdir/file >> $seqres.full 2>&1
 $XFS_IO_PROG -f -c 'pwrite -S 0x63 2000 1000' $testdir/file >> $seqres.full 2>&1
 $XFS_IO_PROG -f -c 'pwrite -S 0x64 3000 1000' $testdir/file >> $seqres.full 2>&1
 $XFS_IO_PROG -f -c 'pwrite -S 0x65 4000 1000' $testdir/file >> $seqres.full 2>&1
-$XFS_IO_PROG -f -c "copy_range $testdir/file" "$testdir/copy"
+$XFS_IO_PROG -t -f -c "copy_range $testdir/file" "$testdir/copy"
 cmp $testdir/file  $testdir/copy
 echo "Original md5sums:"
 md5sum $testdir/{file,copy} | _filter_test_dir
diff --git a/tests/generic/433 b/tests/generic/433
index 1238419a..6204f339 100755
--- a/tests/generic/433
+++ b/tests/generic/433
@@ -42,7 +42,7 @@ rm -f $seqres.full
 
 echo "Create the original file and then copy"
 echo -n "abcde" > $testdir/file
-$XFS_IO_PROG -f -c "copy_range $testdir/file" "$testdir/copy"
+$XFS_IO_PROG -t -f -c "copy_range $testdir/file" "$testdir/copy"
 cmp $testdir/file $testdir/copy
 echo "Original md5sums:"
 md5sum $testdir/{file,copy} | _filter_test_dir
-- 
2.21.0

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

* Re: [PATCH] generic/43{0,1,2,3}: add -t option when create $testdir/copy file
  2019-09-05  1:39 [PATCH] generic/43{0,1,2,3}: add -t option when create $testdir/copy file Jianhong.Yin
@ 2019-09-06  1:26 ` Zorro Lang
  2019-09-06  2:15   ` Jianhong Yin
  0 siblings, 1 reply; 5+ messages in thread
From: Zorro Lang @ 2019-09-06  1:26 UTC (permalink / raw)
  To: Jianhong.Yin; +Cc: fstests, darrick.wong, jiyin

On Thu, Sep 05, 2019 at 09:39:21AM +0800, Jianhong.Yin wrote:
> to avoid there's already a copy file before run test,
> it might break test.
> 
> I know now in xfs_io->copy_range there's a hidden truncate action
> to do that, but we are taking about remove it, see:
>  https://www.spinics.net/lists/linux-xfs/msg31292.html
>  https://www.spinics.net/lists/linux-xfs/msg31327.html
> 
> Signed-off-by: Jianhong Yin <yin-jianhong@163.com>
> ---

Hi,

By checking the code logic of generic/430, I don't think it needs to truncate
the target file before copy_range. To make sure that, I did below test[1], then
nothing fails. I tested with upstream kernel and xfsprogs(with your patches). 

I didn't do more test than that, if I missed something please feel free to
tell me.

Thanks,
Zorro

[1]
# git am $your_patches
# git log --oneline
22c1ab98 (HEAD -> for-next) xfsprogs: copy_range: let = (src_size - src_offset) if len omitted
792d4bfb xfsprogs: copy_range don't truncate dstfile
...
# make -j8 && make -j8 install && make -j8 install-dev
# grep -rsnl copy_range tests/|grep -v .out
tests/generic/group
tests/generic/434
tests/generic/430
tests/generic/431
tests/generic/432
tests/generic/433
tests/generic/553
tests/generic/554
tests/generic/564
tests/generic/565
# ./check generic/430 generic/431 generic/432 generic/433 generic/434 generic/553 generic/554 generic/564 generic/565                                       
FSTYP         -- xfs (debug)
PLATFORM      -- Linux/x86_64 ibm-x3650m4-10 5.3.0-rc6-xfs-for-next #12 SMP Thu Sep 5 07:35:55 EDT 2019
MKFS_OPTIONS  -- -f -bsize=4096 /dev/mapper/xxx-xxx-xxxxx-xfscratch
MOUNT_OPTIONS -- -o context=system_u:object_r:root_t:s0 /dev/mapper/xxx-xxx-xxxx-xfscratch /mnt/scratch                                                                              

generic/430 2s ...  2s
generic/431 3s ...  2s
generic/432 3s ...  3s
generic/433 2s ...  3s
generic/434      2s
generic/553      2s
generic/554      8s
generic/564      3s
generic/565      5s
Ran: generic/430 generic/431 generic/432 generic/433 generic/434 generic/553 generic/554 generic/564 generic/565                                                                              
Passed all 9 tests



>  tests/generic/430 | 2 +-
>  tests/generic/431 | 2 +-
>  tests/generic/432 | 2 +-
>  tests/generic/433 | 2 +-
>  4 files changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/tests/generic/430 b/tests/generic/430
> index 1b11f60d..71c6d438 100755
> --- a/tests/generic/430
> +++ b/tests/generic/430
> @@ -47,7 +47,7 @@ $XFS_IO_PROG -f -c 'pwrite -S 0x62 1000 1000' $testdir/file >> $seqres.full 2>&1
>  $XFS_IO_PROG -f -c 'pwrite -S 0x63 2000 1000' $testdir/file >> $seqres.full 2>&1
>  $XFS_IO_PROG -f -c 'pwrite -S 0x64 3000 1000' $testdir/file >> $seqres.full 2>&1
>  $XFS_IO_PROG -f -c 'pwrite -S 0x65 4000 1000' $testdir/file >> $seqres.full 2>&1
> -$XFS_IO_PROG -f -c "copy_range $testdir/file" "$testdir/copy"
> +$XFS_IO_PROG -t -f -c "copy_range $testdir/file" "$testdir/copy"
>  cmp $testdir/file $testdir/copy
>  echo "Original md5sums:"
>  md5sum $testdir/{file,copy} | _filter_test_dir
> diff --git a/tests/generic/431 b/tests/generic/431
> index f04ae215..4b22a8ff 100755
> --- a/tests/generic/431
> +++ b/tests/generic/431
> @@ -40,7 +40,7 @@ rm -f $seqres.full
>  
>  echo "Create the original file and then copy"
>  echo -n "abcde" > $testdir/file
> -$XFS_IO_PROG -f -c "copy_range $testdir/file" "$testdir/copy"
> +$XFS_IO_PROG -t -f -c "copy_range $testdir/file" "$testdir/copy"
>  echo -n "abcde" | cmp $testdir/copy
>  echo "Original md5sums:"
>  md5sum $testdir/{file,copy} | _filter_test_dir
> diff --git a/tests/generic/432 b/tests/generic/432
> index 6200af86..a2fecf37 100755
> --- a/tests/generic/432
> +++ b/tests/generic/432
> @@ -46,7 +46,7 @@ $XFS_IO_PROG -f -c 'pwrite -S 0x62 1000 1000' $testdir/file >> $seqres.full 2>&1
>  $XFS_IO_PROG -f -c 'pwrite -S 0x63 2000 1000' $testdir/file >> $seqres.full 2>&1
>  $XFS_IO_PROG -f -c 'pwrite -S 0x64 3000 1000' $testdir/file >> $seqres.full 2>&1
>  $XFS_IO_PROG -f -c 'pwrite -S 0x65 4000 1000' $testdir/file >> $seqres.full 2>&1
> -$XFS_IO_PROG -f -c "copy_range $testdir/file" "$testdir/copy"
> +$XFS_IO_PROG -t -f -c "copy_range $testdir/file" "$testdir/copy"
>  cmp $testdir/file  $testdir/copy
>  echo "Original md5sums:"
>  md5sum $testdir/{file,copy} | _filter_test_dir
> diff --git a/tests/generic/433 b/tests/generic/433
> index 1238419a..6204f339 100755
> --- a/tests/generic/433
> +++ b/tests/generic/433
> @@ -42,7 +42,7 @@ rm -f $seqres.full
>  
>  echo "Create the original file and then copy"
>  echo -n "abcde" > $testdir/file
> -$XFS_IO_PROG -f -c "copy_range $testdir/file" "$testdir/copy"
> +$XFS_IO_PROG -t -f -c "copy_range $testdir/file" "$testdir/copy"
>  cmp $testdir/file $testdir/copy
>  echo "Original md5sums:"
>  md5sum $testdir/{file,copy} | _filter_test_dir
> -- 
> 2.21.0
> 

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

* Re: [PATCH] generic/43{0,1,2,3}: add -t option when create $testdir/copy file
  2019-09-06  1:26 ` Zorro Lang
@ 2019-09-06  2:15   ` Jianhong Yin
  2019-09-06  2:34     ` Zorro Lang
  0 siblings, 1 reply; 5+ messages in thread
From: Jianhong Yin @ 2019-09-06  2:15 UTC (permalink / raw)
  To: Zorro Lang; +Cc: Jianhong.Yin, fstests, darrick wong



----- 原始邮件 -----
> 发件人: "Zorro Lang" <zlang@redhat.com>
> 收件人: "Jianhong.Yin" <yin-jianhong@163.com>
> 抄送: fstests@vger.kernel.org, "darrick wong" <darrick.wong@oracle.com>, jiyin@redhat.com
> 发送时间: 星期五, 2019年 9 月 06日 上午 9:26:45
> 主题: Re: [PATCH] generic/43{0,1,2,3}: add -t option when create $testdir/copy file
> 
> On Thu, Sep 05, 2019 at 09:39:21AM +0800, Jianhong.Yin wrote:
> > to avoid there's already a copy file before run test,
> > it might break test.

^^ Hi Zorro, see here.
if there there is already a copy file and it's size > src_file,
test will get fail without truncate

> > 
> > I know now in xfs_io->copy_range there's a hidden truncate action
> > to do that, but we are taking about remove it, see:
> >  https://www.spinics.net/lists/linux-xfs/msg31292.html
> >  https://www.spinics.net/lists/linux-xfs/msg31327.html
> > 
> > Signed-off-by: Jianhong Yin <yin-jianhong@163.com>
> > ---
> 
> Hi,
> 
> By checking the code logic of generic/430, I don't think it needs to truncate
> the target file before copy_range. To make sure that, I did below test[1],
> then
> nothing fails. I tested with upstream kernel and xfsprogs(with your patches).
> 
> I didn't do more test than that, if I missed something please feel free to
> tell me.
> 
> Thanks,
> Zorro
> 
> [1]
> # git am $your_patches
> # git log --oneline
> 22c1ab98 (HEAD -> for-next) xfsprogs: copy_range: let = (src_size -
> src_offset) if len omitted
> 792d4bfb xfsprogs: copy_range don't truncate dstfile
> ...
> # make -j8 && make -j8 install && make -j8 install-dev
> # grep -rsnl copy_range tests/|grep -v .out
> tests/generic/group
> tests/generic/434
> tests/generic/430
> tests/generic/431
> tests/generic/432
> tests/generic/433
> tests/generic/553
> tests/generic/554
> tests/generic/564
> tests/generic/565
> # ./check generic/430 generic/431 generic/432 generic/433 generic/434
> generic/553 generic/554 generic/564 generic/565
> FSTYP         -- xfs (debug)
> PLATFORM      -- Linux/x86_64 ibm-x3650m4-10 5.3.0-rc6-xfs-for-next #12 SMP
> Thu Sep 5 07:35:55 EDT 2019
> MKFS_OPTIONS  -- -f -bsize=4096 /dev/mapper/xxx-xxx-xxxxx-xfscratch
> MOUNT_OPTIONS -- -o context=system_u:object_r:root_t:s0
> /dev/mapper/xxx-xxx-xxxx-xfscratch /mnt/scratch
> 
> generic/430 2s ...  2s
> generic/431 3s ...  2s
> generic/432 3s ...  3s
> generic/433 2s ...  3s
> generic/434      2s
> generic/553      2s
> generic/554      8s
> generic/564      3s
> generic/565      5s
> Ran: generic/430 generic/431 generic/432 generic/433 generic/434 generic/553
> generic/554 generic/564 generic/565
> Passed all 9 tests
> 
> 
> 
> >  tests/generic/430 | 2 +-
> >  tests/generic/431 | 2 +-
> >  tests/generic/432 | 2 +-
> >  tests/generic/433 | 2 +-
> >  4 files changed, 4 insertions(+), 4 deletions(-)
> > 
> > diff --git a/tests/generic/430 b/tests/generic/430
> > index 1b11f60d..71c6d438 100755
> > --- a/tests/generic/430
> > +++ b/tests/generic/430
> > @@ -47,7 +47,7 @@ $XFS_IO_PROG -f -c 'pwrite -S 0x62 1000 1000'
> > $testdir/file >> $seqres.full 2>&1
> >  $XFS_IO_PROG -f -c 'pwrite -S 0x63 2000 1000' $testdir/file >>
> >  $seqres.full 2>&1
> >  $XFS_IO_PROG -f -c 'pwrite -S 0x64 3000 1000' $testdir/file >>
> >  $seqres.full 2>&1
> >  $XFS_IO_PROG -f -c 'pwrite -S 0x65 4000 1000' $testdir/file >>
> >  $seqres.full 2>&1
> > -$XFS_IO_PROG -f -c "copy_range $testdir/file" "$testdir/copy"
> > +$XFS_IO_PROG -t -f -c "copy_range $testdir/file" "$testdir/copy"
> >  cmp $testdir/file $testdir/copy
> >  echo "Original md5sums:"
> >  md5sum $testdir/{file,copy} | _filter_test_dir
> > diff --git a/tests/generic/431 b/tests/generic/431
> > index f04ae215..4b22a8ff 100755
> > --- a/tests/generic/431
> > +++ b/tests/generic/431
> > @@ -40,7 +40,7 @@ rm -f $seqres.full
> >  
> >  echo "Create the original file and then copy"
> >  echo -n "abcde" > $testdir/file
> > -$XFS_IO_PROG -f -c "copy_range $testdir/file" "$testdir/copy"
> > +$XFS_IO_PROG -t -f -c "copy_range $testdir/file" "$testdir/copy"
> >  echo -n "abcde" | cmp $testdir/copy
> >  echo "Original md5sums:"
> >  md5sum $testdir/{file,copy} | _filter_test_dir
> > diff --git a/tests/generic/432 b/tests/generic/432
> > index 6200af86..a2fecf37 100755
> > --- a/tests/generic/432
> > +++ b/tests/generic/432
> > @@ -46,7 +46,7 @@ $XFS_IO_PROG -f -c 'pwrite -S 0x62 1000 1000'
> > $testdir/file >> $seqres.full 2>&1
> >  $XFS_IO_PROG -f -c 'pwrite -S 0x63 2000 1000' $testdir/file >>
> >  $seqres.full 2>&1
> >  $XFS_IO_PROG -f -c 'pwrite -S 0x64 3000 1000' $testdir/file >>
> >  $seqres.full 2>&1
> >  $XFS_IO_PROG -f -c 'pwrite -S 0x65 4000 1000' $testdir/file >>
> >  $seqres.full 2>&1
> > -$XFS_IO_PROG -f -c "copy_range $testdir/file" "$testdir/copy"
> > +$XFS_IO_PROG -t -f -c "copy_range $testdir/file" "$testdir/copy"
> >  cmp $testdir/file  $testdir/copy
> >  echo "Original md5sums:"
> >  md5sum $testdir/{file,copy} | _filter_test_dir
> > diff --git a/tests/generic/433 b/tests/generic/433
> > index 1238419a..6204f339 100755
> > --- a/tests/generic/433
> > +++ b/tests/generic/433
> > @@ -42,7 +42,7 @@ rm -f $seqres.full
> >  
> >  echo "Create the original file and then copy"
> >  echo -n "abcde" > $testdir/file
> > -$XFS_IO_PROG -f -c "copy_range $testdir/file" "$testdir/copy"
> > +$XFS_IO_PROG -t -f -c "copy_range $testdir/file" "$testdir/copy"
> >  cmp $testdir/file $testdir/copy
> >  echo "Original md5sums:"
> >  md5sum $testdir/{file,copy} | _filter_test_dir
> > --
> > 2.21.0
> > 
> 

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

* Re: [PATCH] generic/43{0,1,2,3}: add -t option when create $testdir/copy file
  2019-09-06  2:15   ` Jianhong Yin
@ 2019-09-06  2:34     ` Zorro Lang
  2019-09-06  2:58       ` Jianhong Yin
  0 siblings, 1 reply; 5+ messages in thread
From: Zorro Lang @ 2019-09-06  2:34 UTC (permalink / raw)
  To: Jianhong Yin; +Cc: Jianhong.Yin, fstests, darrick wong

On Thu, Sep 05, 2019 at 10:15:36PM -0400, Jianhong Yin wrote:
> 
> 
> ----- 原始邮件 -----
> > 发件人: "Zorro Lang" <zlang@redhat.com>
> > 收件人: "Jianhong.Yin" <yin-jianhong@163.com>
> > 抄送: fstests@vger.kernel.org, "darrick wong" <darrick.wong@oracle.com>, jiyin@redhat.com
> > 发送时间: 星期五, 2019年 9 月 06日 上午 9:26:45
> > 主题: Re: [PATCH] generic/43{0,1,2,3}: add -t option when create $testdir/copy file
> > 
> > On Thu, Sep 05, 2019 at 09:39:21AM +0800, Jianhong.Yin wrote:
> > > to avoid there's already a copy file before run test,
> > > it might break test.
> 
> ^^ Hi Zorro, see here.
> if there there is already a copy file and it's size > src_file,
> test will get fail without truncate

Yeah, I know what you mean. But the thing is whether or not xfstests can hit
this issue normally? If you think about un-normal situation, you should
truncate(0) all target files, not only $testdir/copy.

For example, generic/430 has more other target file, likes $testdir/beginning,
$testdir/middle, $testdir/end, $testdir/beyond and $testdir/hole. If as you
thought, you should use '-t' to all of them, right? But generally there won't
be an *existed* files at there, anyway if you really care about all unclear test
environment, you should truncate nearly all copy_range's target files before do
the copy.

Thanks,
Zorro

> 
> > > 
> > > I know now in xfs_io->copy_range there's a hidden truncate action
> > > to do that, but we are taking about remove it, see:
> > >  https://www.spinics.net/lists/linux-xfs/msg31292.html
> > >  https://www.spinics.net/lists/linux-xfs/msg31327.html
> > > 
> > > Signed-off-by: Jianhong Yin <yin-jianhong@163.com>
> > > ---
> > 
> > Hi,
> > 
> > By checking the code logic of generic/430, I don't think it needs to truncate
> > the target file before copy_range. To make sure that, I did below test[1],
> > then
> > nothing fails. I tested with upstream kernel and xfsprogs(with your patches).
> > 
> > I didn't do more test than that, if I missed something please feel free to
> > tell me.
> > 
> > Thanks,
> > Zorro
> > 
> > [1]
> > # git am $your_patches
> > # git log --oneline
> > 22c1ab98 (HEAD -> for-next) xfsprogs: copy_range: let = (src_size -
> > src_offset) if len omitted
> > 792d4bfb xfsprogs: copy_range don't truncate dstfile
> > ...
> > # make -j8 && make -j8 install && make -j8 install-dev
> > # grep -rsnl copy_range tests/|grep -v .out
> > tests/generic/group
> > tests/generic/434
> > tests/generic/430
> > tests/generic/431
> > tests/generic/432
> > tests/generic/433
> > tests/generic/553
> > tests/generic/554
> > tests/generic/564
> > tests/generic/565
> > # ./check generic/430 generic/431 generic/432 generic/433 generic/434
> > generic/553 generic/554 generic/564 generic/565
> > FSTYP         -- xfs (debug)
> > PLATFORM      -- Linux/x86_64 ibm-x3650m4-10 5.3.0-rc6-xfs-for-next #12 SMP
> > Thu Sep 5 07:35:55 EDT 2019
> > MKFS_OPTIONS  -- -f -bsize=4096 /dev/mapper/xxx-xxx-xxxxx-xfscratch
> > MOUNT_OPTIONS -- -o context=system_u:object_r:root_t:s0
> > /dev/mapper/xxx-xxx-xxxx-xfscratch /mnt/scratch
> > 
> > generic/430 2s ...  2s
> > generic/431 3s ...  2s
> > generic/432 3s ...  3s
> > generic/433 2s ...  3s
> > generic/434      2s
> > generic/553      2s
> > generic/554      8s
> > generic/564      3s
> > generic/565      5s
> > Ran: generic/430 generic/431 generic/432 generic/433 generic/434 generic/553
> > generic/554 generic/564 generic/565
> > Passed all 9 tests
> > 
> > 
> > 
> > >  tests/generic/430 | 2 +-
> > >  tests/generic/431 | 2 +-
> > >  tests/generic/432 | 2 +-
> > >  tests/generic/433 | 2 +-
> > >  4 files changed, 4 insertions(+), 4 deletions(-)
> > > 
> > > diff --git a/tests/generic/430 b/tests/generic/430
> > > index 1b11f60d..71c6d438 100755
> > > --- a/tests/generic/430
> > > +++ b/tests/generic/430
> > > @@ -47,7 +47,7 @@ $XFS_IO_PROG -f -c 'pwrite -S 0x62 1000 1000'
> > > $testdir/file >> $seqres.full 2>&1
> > >  $XFS_IO_PROG -f -c 'pwrite -S 0x63 2000 1000' $testdir/file >>
> > >  $seqres.full 2>&1
> > >  $XFS_IO_PROG -f -c 'pwrite -S 0x64 3000 1000' $testdir/file >>
> > >  $seqres.full 2>&1
> > >  $XFS_IO_PROG -f -c 'pwrite -S 0x65 4000 1000' $testdir/file >>
> > >  $seqres.full 2>&1
> > > -$XFS_IO_PROG -f -c "copy_range $testdir/file" "$testdir/copy"
> > > +$XFS_IO_PROG -t -f -c "copy_range $testdir/file" "$testdir/copy"
> > >  cmp $testdir/file $testdir/copy
> > >  echo "Original md5sums:"
> > >  md5sum $testdir/{file,copy} | _filter_test_dir
> > > diff --git a/tests/generic/431 b/tests/generic/431
> > > index f04ae215..4b22a8ff 100755
> > > --- a/tests/generic/431
> > > +++ b/tests/generic/431
> > > @@ -40,7 +40,7 @@ rm -f $seqres.full
> > >  
> > >  echo "Create the original file and then copy"
> > >  echo -n "abcde" > $testdir/file
> > > -$XFS_IO_PROG -f -c "copy_range $testdir/file" "$testdir/copy"
> > > +$XFS_IO_PROG -t -f -c "copy_range $testdir/file" "$testdir/copy"
> > >  echo -n "abcde" | cmp $testdir/copy
> > >  echo "Original md5sums:"
> > >  md5sum $testdir/{file,copy} | _filter_test_dir
> > > diff --git a/tests/generic/432 b/tests/generic/432
> > > index 6200af86..a2fecf37 100755
> > > --- a/tests/generic/432
> > > +++ b/tests/generic/432
> > > @@ -46,7 +46,7 @@ $XFS_IO_PROG -f -c 'pwrite -S 0x62 1000 1000'
> > > $testdir/file >> $seqres.full 2>&1
> > >  $XFS_IO_PROG -f -c 'pwrite -S 0x63 2000 1000' $testdir/file >>
> > >  $seqres.full 2>&1
> > >  $XFS_IO_PROG -f -c 'pwrite -S 0x64 3000 1000' $testdir/file >>
> > >  $seqres.full 2>&1
> > >  $XFS_IO_PROG -f -c 'pwrite -S 0x65 4000 1000' $testdir/file >>
> > >  $seqres.full 2>&1
> > > -$XFS_IO_PROG -f -c "copy_range $testdir/file" "$testdir/copy"
> > > +$XFS_IO_PROG -t -f -c "copy_range $testdir/file" "$testdir/copy"
> > >  cmp $testdir/file  $testdir/copy
> > >  echo "Original md5sums:"
> > >  md5sum $testdir/{file,copy} | _filter_test_dir
> > > diff --git a/tests/generic/433 b/tests/generic/433
> > > index 1238419a..6204f339 100755
> > > --- a/tests/generic/433
> > > +++ b/tests/generic/433
> > > @@ -42,7 +42,7 @@ rm -f $seqres.full
> > >  
> > >  echo "Create the original file and then copy"
> > >  echo -n "abcde" > $testdir/file
> > > -$XFS_IO_PROG -f -c "copy_range $testdir/file" "$testdir/copy"
> > > +$XFS_IO_PROG -t -f -c "copy_range $testdir/file" "$testdir/copy"
> > >  cmp $testdir/file $testdir/copy
> > >  echo "Original md5sums:"
> > >  md5sum $testdir/{file,copy} | _filter_test_dir
> > > --
> > > 2.21.0
> > > 
> > 

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

* Re: [PATCH] generic/43{0,1,2,3}: add -t option when create $testdir/copy file
  2019-09-06  2:34     ` Zorro Lang
@ 2019-09-06  2:58       ` Jianhong Yin
  0 siblings, 0 replies; 5+ messages in thread
From: Jianhong Yin @ 2019-09-06  2:58 UTC (permalink / raw)
  To: Zorro Lang, darrick wong; +Cc: Jianhong.Yin, fstests



----- 原始邮件 -----
> 发件人: "Zorro Lang" <zlang@redhat.com>
> 收件人: "Jianhong Yin" <jiyin@redhat.com>
> 抄送: "Jianhong.Yin" <yin-jianhong@163.com>, fstests@vger.kernel.org, "darrick wong" <darrick.wong@oracle.com>
> 发送时间: 星期五, 2019年 9 月 06日 上午 10:34:15
> 主题: Re: [PATCH] generic/43{0,1,2,3}: add -t option when create $testdir/copy file
> 
> On Thu, Sep 05, 2019 at 10:15:36PM -0400, Jianhong Yin wrote:
> > 
> > 
> > ----- 原始邮件 -----
> > > 发件人: "Zorro Lang" <zlang@redhat.com>
> > > 收件人: "Jianhong.Yin" <yin-jianhong@163.com>
> > > 抄送: fstests@vger.kernel.org, "darrick wong" <darrick.wong@oracle.com>,
> > > jiyin@redhat.com
> > > 发送时间: 星期五, 2019年 9 月 06日 上午 9:26:45
> > > 主题: Re: [PATCH] generic/43{0,1,2,3}: add -t option when create
> > > $testdir/copy file
> > > 
> > > On Thu, Sep 05, 2019 at 09:39:21AM +0800, Jianhong.Yin wrote:
> > > > to avoid there's already a copy file before run test,
> > > > it might break test.
> > 
> > ^^ Hi Zorro, see here.
> > if there there is already a copy file and it's size > src_file,
> > test will get fail without truncate
> 
> Yeah, I know what you mean. But the thing is whether or not xfstests can hit
> this issue normally? If you think about un-normal situation, you should
> truncate(0) all target files, not only $testdir/copy.
> 
> For example, generic/430 has more other target file, likes
> $testdir/beginning,
> $testdir/middle, $testdir/end, $testdir/beyond and $testdir/hole. If as you
> thought, you should use '-t' to all of them, right? But generally there won't
> be an *existed* files at there, anyway if you really care about all unclear
> test
> environment, you should truncate nearly all copy_range's target files before
> do the copy.

Yes.
I think you are right, xfstests should ensure that the test directory is clean.
So removing the truncate behavior of copy_range will not affect xfstests

Thanks Zorro  //cc Darrick Wong

Jianhong

> 
> Thanks,
> Zorro
> 
> > 
> > > > 
> > > > I know now in xfs_io->copy_range there's a hidden truncate action
> > > > to do that, but we are taking about remove it, see:
> > > >  https://www.spinics.net/lists/linux-xfs/msg31292.html
> > > >  https://www.spinics.net/lists/linux-xfs/msg31327.html
> > > > 
> > > > Signed-off-by: Jianhong Yin <yin-jianhong@163.com>
> > > > ---
> > > 
> > > Hi,
> > > 
> > > By checking the code logic of generic/430, I don't think it needs to
> > > truncate
> > > the target file before copy_range. To make sure that, I did below
> > > test[1],
> > > then
> > > nothing fails. I tested with upstream kernel and xfsprogs(with your
> > > patches).
> > > 
> > > I didn't do more test than that, if I missed something please feel free
> > > to
> > > tell me.
> > > 
> > > Thanks,
> > > Zorro
> > > 
> > > [1]
> > > # git am $your_patches
> > > # git log --oneline
> > > 22c1ab98 (HEAD -> for-next) xfsprogs: copy_range: let = (src_size -
> > > src_offset) if len omitted
> > > 792d4bfb xfsprogs: copy_range don't truncate dstfile
> > > ...
> > > # make -j8 && make -j8 install && make -j8 install-dev
> > > # grep -rsnl copy_range tests/|grep -v .out
> > > tests/generic/group
> > > tests/generic/434
> > > tests/generic/430
> > > tests/generic/431
> > > tests/generic/432
> > > tests/generic/433
> > > tests/generic/553
> > > tests/generic/554
> > > tests/generic/564
> > > tests/generic/565
> > > # ./check generic/430 generic/431 generic/432 generic/433 generic/434
> > > generic/553 generic/554 generic/564 generic/565
> > > FSTYP         -- xfs (debug)
> > > PLATFORM      -- Linux/x86_64 ibm-x3650m4-10 5.3.0-rc6-xfs-for-next #12
> > > SMP
> > > Thu Sep 5 07:35:55 EDT 2019
> > > MKFS_OPTIONS  -- -f -bsize=4096 /dev/mapper/xxx-xxx-xxxxx-xfscratch
> > > MOUNT_OPTIONS -- -o context=system_u:object_r:root_t:s0
> > > /dev/mapper/xxx-xxx-xxxx-xfscratch /mnt/scratch
> > > 
> > > generic/430 2s ...  2s
> > > generic/431 3s ...  2s
> > > generic/432 3s ...  3s
> > > generic/433 2s ...  3s
> > > generic/434      2s
> > > generic/553      2s
> > > generic/554      8s
> > > generic/564      3s
> > > generic/565      5s
> > > Ran: generic/430 generic/431 generic/432 generic/433 generic/434
> > > generic/553
> > > generic/554 generic/564 generic/565
> > > Passed all 9 tests
> > > 
> > > 
> > > 
> > > >  tests/generic/430 | 2 +-
> > > >  tests/generic/431 | 2 +-
> > > >  tests/generic/432 | 2 +-
> > > >  tests/generic/433 | 2 +-
> > > >  4 files changed, 4 insertions(+), 4 deletions(-)
> > > > 
> > > > diff --git a/tests/generic/430 b/tests/generic/430
> > > > index 1b11f60d..71c6d438 100755
> > > > --- a/tests/generic/430
> > > > +++ b/tests/generic/430
> > > > @@ -47,7 +47,7 @@ $XFS_IO_PROG -f -c 'pwrite -S 0x62 1000 1000'
> > > > $testdir/file >> $seqres.full 2>&1
> > > >  $XFS_IO_PROG -f -c 'pwrite -S 0x63 2000 1000' $testdir/file >>
> > > >  $seqres.full 2>&1
> > > >  $XFS_IO_PROG -f -c 'pwrite -S 0x64 3000 1000' $testdir/file >>
> > > >  $seqres.full 2>&1
> > > >  $XFS_IO_PROG -f -c 'pwrite -S 0x65 4000 1000' $testdir/file >>
> > > >  $seqres.full 2>&1
> > > > -$XFS_IO_PROG -f -c "copy_range $testdir/file" "$testdir/copy"
> > > > +$XFS_IO_PROG -t -f -c "copy_range $testdir/file" "$testdir/copy"
> > > >  cmp $testdir/file $testdir/copy
> > > >  echo "Original md5sums:"
> > > >  md5sum $testdir/{file,copy} | _filter_test_dir
> > > > diff --git a/tests/generic/431 b/tests/generic/431
> > > > index f04ae215..4b22a8ff 100755
> > > > --- a/tests/generic/431
> > > > +++ b/tests/generic/431
> > > > @@ -40,7 +40,7 @@ rm -f $seqres.full
> > > >  
> > > >  echo "Create the original file and then copy"
> > > >  echo -n "abcde" > $testdir/file
> > > > -$XFS_IO_PROG -f -c "copy_range $testdir/file" "$testdir/copy"
> > > > +$XFS_IO_PROG -t -f -c "copy_range $testdir/file" "$testdir/copy"
> > > >  echo -n "abcde" | cmp $testdir/copy
> > > >  echo "Original md5sums:"
> > > >  md5sum $testdir/{file,copy} | _filter_test_dir
> > > > diff --git a/tests/generic/432 b/tests/generic/432
> > > > index 6200af86..a2fecf37 100755
> > > > --- a/tests/generic/432
> > > > +++ b/tests/generic/432
> > > > @@ -46,7 +46,7 @@ $XFS_IO_PROG -f -c 'pwrite -S 0x62 1000 1000'
> > > > $testdir/file >> $seqres.full 2>&1
> > > >  $XFS_IO_PROG -f -c 'pwrite -S 0x63 2000 1000' $testdir/file >>
> > > >  $seqres.full 2>&1
> > > >  $XFS_IO_PROG -f -c 'pwrite -S 0x64 3000 1000' $testdir/file >>
> > > >  $seqres.full 2>&1
> > > >  $XFS_IO_PROG -f -c 'pwrite -S 0x65 4000 1000' $testdir/file >>
> > > >  $seqres.full 2>&1
> > > > -$XFS_IO_PROG -f -c "copy_range $testdir/file" "$testdir/copy"
> > > > +$XFS_IO_PROG -t -f -c "copy_range $testdir/file" "$testdir/copy"
> > > >  cmp $testdir/file  $testdir/copy
> > > >  echo "Original md5sums:"
> > > >  md5sum $testdir/{file,copy} | _filter_test_dir
> > > > diff --git a/tests/generic/433 b/tests/generic/433
> > > > index 1238419a..6204f339 100755
> > > > --- a/tests/generic/433
> > > > +++ b/tests/generic/433
> > > > @@ -42,7 +42,7 @@ rm -f $seqres.full
> > > >  
> > > >  echo "Create the original file and then copy"
> > > >  echo -n "abcde" > $testdir/file
> > > > -$XFS_IO_PROG -f -c "copy_range $testdir/file" "$testdir/copy"
> > > > +$XFS_IO_PROG -t -f -c "copy_range $testdir/file" "$testdir/copy"
> > > >  cmp $testdir/file $testdir/copy
> > > >  echo "Original md5sums:"
> > > >  md5sum $testdir/{file,copy} | _filter_test_dir
> > > > --
> > > > 2.21.0
> > > > 
> > > 
> 

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

end of thread, other threads:[~2019-09-06  2:58 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-05  1:39 [PATCH] generic/43{0,1,2,3}: add -t option when create $testdir/copy file Jianhong.Yin
2019-09-06  1:26 ` Zorro Lang
2019-09-06  2:15   ` Jianhong Yin
2019-09-06  2:34     ` Zorro Lang
2019-09-06  2:58       ` Jianhong Yin

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).