btrfs/029: fix wrong usage of name filter
diff mbox

Message ID f0fc8c9e-fb9b-fe82-6ebd-29149ef01b8e@jp.fujitsu.com
State New
Headers show

Commit Message

Misono Tomohiro Aug. 30, 2017, 2:44 a.m. UTC
btrfs/029 uses _filter_testdirs() to filter the name of $TEST_DIR and
$SCRATCH_MNT directory.

In this function, it calls both _filter_test_dir and _filter_scratch
concatenated by pipe. Therefore if $TEST_DIR is a prefix of
$SCRATCH_MNT, this filter function gives wrong filtered name for
$SCRATCH_MNT and the test fails.

Fix this by calling _filter_test_dir and _filter_scratch directly.

Signed-off-by: Tomohiro Misono <misono.tomohiro@jp.fujits.com>
---
  tests/btrfs/029 | 11 +++--------
  1 file changed, 3 insertions(+), 8 deletions(-)

      rm -rf $2
@@ -86,7 +81,7 @@ _create_reflinks()
      cp --reflink=always $1 $2 >> $seqres.full 2>&1 || echo "cp reflink 
failed"

      # The failed target actually gets created by cp:
-    ls $2 | _filter_testdirs
+    ls $2 | _filter_test_dir
  }

  echo "test reflinks across different devices"

Comments

Misono Tomohiro Aug. 30, 2017, 6:56 a.m. UTC | #1
Sorry, this patch contains leading spaces, I will resend this soon.

On 2017/08/30 11:44, Misono, Tomohiro wrote:
> btrfs/029 uses _filter_testdirs() to filter the name of $TEST_DIR and
> $SCRATCH_MNT directory.
> 
> In this function, it calls both _filter_test_dir and _filter_scratch
> concatenated by pipe. Therefore if $TEST_DIR is a prefix of
> $SCRATCH_MNT, this filter function gives wrong filtered name for
> $SCRATCH_MNT and the test fails.
> 
> Fix this by calling _filter_test_dir and _filter_scratch directly.
> 
> Signed-off-by: Tomohiro Misono <misono.tomohiro@jp.fujits.com>
> ---
>   tests/btrfs/029 | 11 +++--------
>   1 file changed, 3 insertions(+), 8 deletions(-)
> 
> diff --git a/tests/btrfs/029 b/tests/btrfs/029
> index c390c95..74fded7 100755
> --- a/tests/btrfs/029
> +++ b/tests/btrfs/029
> @@ -66,19 +66,14 @@ _scratch_mkfs > /dev/null 2>&1
>   _scratch_mount
>   $XFS_IO_PROG -f -c 'pwrite -S 0x61 0 9000' $SCRATCH_MNT/original >> 
> $seqres.full
> 
> -_filter_testdirs()
> -{
> -    _filter_test_dir | _filter_scratch
> -}
> -
>   _create_reflinks()
>   {
>       # auto reflink, should fall back to non-reflink
>       rm -rf $2
>       echo "reflink=auto:"
>       cp --reflink=auto $1 $2
> -    md5sum $1 | _filter_testdirs
> -    md5sum $2 | _filter_testdirs
> +    md5sum $1 | _filter_scratch
> +    md5sum $2 | _filter_test_dir
> 
>       # always reflink, should fail outright
>       rm -rf $2
> @@ -86,7 +81,7 @@ _create_reflinks()
>       cp --reflink=always $1 $2 >> $seqres.full 2>&1 || echo "cp reflink 
> failed"
> 
>       # The failed target actually gets created by cp:
> -    ls $2 | _filter_testdirs
> +    ls $2 | _filter_test_dir
>   }
> 
>   echo "test reflinks across different devices"
> 

--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch
diff mbox

diff --git a/tests/btrfs/029 b/tests/btrfs/029
index c390c95..74fded7 100755
--- a/tests/btrfs/029
+++ b/tests/btrfs/029
@@ -66,19 +66,14 @@  _scratch_mkfs > /dev/null 2>&1
  _scratch_mount
  $XFS_IO_PROG -f -c 'pwrite -S 0x61 0 9000' $SCRATCH_MNT/original >> 
$seqres.full

-_filter_testdirs()
-{
-    _filter_test_dir | _filter_scratch
-}
-
  _create_reflinks()
  {
      # auto reflink, should fall back to non-reflink
      rm -rf $2
      echo "reflink=auto:"
      cp --reflink=auto $1 $2
-    md5sum $1 | _filter_testdirs
-    md5sum $2 | _filter_testdirs
+    md5sum $1 | _filter_scratch
+    md5sum $2 | _filter_test_dir

      # always reflink, should fail outright