fstests.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: fdmanana@kernel.org
To: fstests@vger.kernel.org
Cc: linux-btrfs@vger.kernel.org, Filipe Manana <fdmanana@suse.com>
Subject: [PATCH] btrfs/048: fix test failure when fs mounted with v2 space cache option
Date: Thu,  5 Sep 2019 16:37:00 +0100	[thread overview]
Message-ID: <20190905153700.21284-1-fdmanana@kernel.org> (raw)

From: Filipe Manana <fdmanana@suse.com>

In order to check that the filesystem generation does not change after
failure to set a property, the test expects a specific generation number
of 7 in its golden output. That currently works except when using the
v2 space cache mount option (MOUNT_OPTIONS="-o space_cache=v2"), since
the filesystem generation is 8 because creating a v2 space cache adds
an additional transaction commit. So update the test to not hardcode
specific generation numbers in its golden output and just output an
unexpected message if the generation number changes.

Signed-off-by: Filipe Manana <fdmanana@suse.com>
---
 tests/btrfs/048     | 5 +++--
 tests/btrfs/048.out | 2 --
 2 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/tests/btrfs/048 b/tests/btrfs/048
index 7294f231..7c9eaa05 100755
--- a/tests/btrfs/048
+++ b/tests/btrfs/048
@@ -221,10 +221,11 @@ $BTRFS_UTIL_PROG property get $SCRATCH_MNT compression
 
 echo -e "\nTesting generation is unchanged after failed validation"
 $BTRFS_UTIL_PROG filesystem sync $SCRATCH_MNT
-$BTRFS_UTIL_PROG inspect-internal dump-super $SCRATCH_DEV | grep '^generation'
+gen_before=$($BTRFS_UTIL_PROG inspect-internal dump-super $SCRATCH_DEV | grep '^generation')
 $BTRFS_UTIL_PROG property set $SCRATCH_MNT compression 'lz' 2>&1 | _filter_scratch
 $BTRFS_UTIL_PROG filesystem sync $SCRATCH_MNT
-$BTRFS_UTIL_PROG inspect-internal dump-super $SCRATCH_DEV | grep '^generation'
+gen_after=$($BTRFS_UTIL_PROG inspect-internal dump-super $SCRATCH_DEV | grep '^generation')
+[ "$gen_after" == "$gen_before" ] || echo "filesystem generation changed"
 
 echo -e "\nTesting argument validation with options"
 $BTRFS_UTIL_PROG property set $SCRATCH_MNT compression 'zlib:3'
diff --git a/tests/btrfs/048.out b/tests/btrfs/048.out
index 0923b00c..cc12e329 100644
--- a/tests/btrfs/048.out
+++ b/tests/btrfs/048.out
@@ -89,9 +89,7 @@ ERROR: failed to set compression for SCRATCH_MNT: Invalid argument
 compression=lzo
 
 Testing generation is unchanged after failed validation
-generation		7
 ERROR: failed to set compression for SCRATCH_MNT: Invalid argument
-generation		7
 
 Testing argument validation with options
 ***
-- 
2.11.0

             reply	other threads:[~2019-09-05 15:37 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-05 15:37 fdmanana [this message]
2019-09-05 16:02 ` [PATCH] btrfs/048: fix test failure when fs mounted with v2 space cache option Nikolay Borisov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190905153700.21284-1-fdmanana@kernel.org \
    --to=fdmanana@kernel.org \
    --cc=fdmanana@suse.com \
    --cc=fstests@vger.kernel.org \
    --cc=linux-btrfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).