public inbox for fstests@vger.kernel.org
 help / color / mirror / Atom feed
From: David Sterba <dsterba@suse.com>
To: fstests@vger.kernel.org
Cc: David Sterba <dsterba@suse.com>
Subject: [PATCH] common/btrfs: add helper to detect dump-super or btrfs-show-super, fix btrfs/011
Date: Mon, 16 Jan 2017 16:35:12 +0100	[thread overview]
Message-ID: <20170116153512.16573-1-dsterba@suse.com> (raw)

The command btrfs-show-super is not supposed to be distributed but was
useful for testing. The same functionality is now present as
'btrfs inspect-internal dump-super', let's detect which one is available
and use it in btrfs/011 that fails with btrfs-progs 4.8.4+ .

Signed-off-by: David Sterba <dsterba@suse.com>
---
 common/btrfs    | 11 +++++++++++
 tests/btrfs/011 |  2 +-
 2 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/common/btrfs b/common/btrfs
index c821d54ef291..96c3635bcc51 100644
--- a/common/btrfs
+++ b/common/btrfs
@@ -48,6 +48,17 @@ _require_btrfs_qgroup_report()
 	touch ${RESULT_DIR}/require_scratch.require_qgroup_report
 }
 
+_require_btrfs_dump_super()
+{
+	if [ ! -x "$BTRFS_SHOW_SUPER_PROG" ]; then
+		_require_command "$BTRFS_UTIL_PROG" btrfs
+		if ! $BTRFS_UTIL_PROG inspect-internal dump-super --help >& /dev/null; then
+			_notrun "Missing btrfs-show-super or inspect-internal dump-super"
+		fi
+		BTRFS_SHOW_SUPER_PROG="$BTRFS_UTIL_PROG inspect-internal dump-super"
+	fi
+}
+
 _run_btrfs_util_prog()
 {
 	run_check $BTRFS_UTIL_PROG $*
diff --git a/tests/btrfs/011 b/tests/btrfs/011
index 6bc5ba2d51a2..918742717528 100755
--- a/tests/btrfs/011
+++ b/tests/btrfs/011
@@ -62,7 +62,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
 _supported_fs btrfs
 _require_scratch_nocheck
 _require_scratch_dev_pool 4
-_require_command "$BTRFS_SHOW_SUPER_PROG" btrfs-show-super
+_require_btrfs_dump_super
 
 rm -f $seqres.full
 rm -f $tmp.tmp
-- 
2.10.1


                 reply	other threads:[~2017-01-16 15:35 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20170116153512.16573-1-dsterba@suse.com \
    --to=dsterba@suse.com \
    --cc=fstests@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