All of lore.kernel.org
 help / color / mirror / Atom feed
From: Nikolay Borisov <nborisov@suse.com>
To: linux-btrfs@vger.kernel.org
Cc: Nikolay Borisov <nborisov@suse.com>
Subject: [PATCH 2/2] btrfs-progs: tests: Add test for fi show
Date: Thu,  2 Sep 2021 13:06:43 +0300	[thread overview]
Message-ID: <20210902100643.1075385-2-nborisov@suse.com> (raw)
In-Reply-To: <20210902100643.1075385-1-nborisov@suse.com>

Add a test to ensure that 'btrfs fi show' on a mounted filesyste, which
has a missing device will explicitly print which device is missing.

Signed-off-by: Nikolay Borisov <nborisov@suse.com>
---
 tests/cli-tests/016-fi-show-missing/test.sh | 35 +++++++++++++++++++++
 1 file changed, 35 insertions(+)
 create mode 100755 tests/cli-tests/016-fi-show-missing/test.sh

diff --git a/tests/cli-tests/016-fi-show-missing/test.sh b/tests/cli-tests/016-fi-show-missing/test.sh
new file mode 100755
index 000000000000..9df7afd5af94
--- /dev/null
+++ b/tests/cli-tests/016-fi-show-missing/test.sh
@@ -0,0 +1,35 @@
+#!/bin/bash
+#
+# Test that if a device is missing for a mounted filesystem, btrfs fi show will
+# show which device exactly is missing.
+
+source "$TEST_TOP/common"
+
+check_prereq mkfs.btrfs
+check_prereq btrfs
+
+setup_root_helper
+setup_loopdevs 2
+prepare_loopdevs
+
+dev1=${loopdevs[1]}
+dev2=${loopdevs[2]}
+
+run_check $SUDO_HELPER "$TOP"/mkfs.btrfs -f -draid1 $dev1 $dev2
+# move the device, changing its path, simulating the device being missing
+mv $dev2 /dev/loop-non-existent
+
+run_check $SUDO_HELPER mount -o degraded $dev1 $TEST_MNT
+
+if ! run_check_stdout $SUDO_HELPER "$TOP"/btrfs fi show $TEST_MNT | \
+	grep -q "$dev2 \*\*\*MISSING\*\*\*"; then
+
+	_fail "Didn't find exact missing device"
+fi
+
+mv /dev/loop-non-existent $dev2
+
+run_check $SUDO_HELPER umount $TEST_MNT
+
+cleanup_loopdevs
+
-- 
2.17.1


  reply	other threads:[~2021-09-02 10:06 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-02 10:06 [PATCH 1/2] btrfs-progs: fi show: Print missing device for a mounted file system Nikolay Borisov
2021-09-02 10:06 ` Nikolay Borisov [this message]
2021-09-02 10:27 ` Qu Wenruo
2021-09-02 10:41   ` Nikolay Borisov
2021-09-02 10:46     ` Qu Wenruo
2021-09-02 10:59       ` Nikolay Borisov
2021-09-02 12:17         ` Qu Wenruo
2021-09-06 16:47           ` g.btrfs
2021-09-06 23:24             ` Anand Jain
2021-09-07  6:03             ` Nikolay Borisov
2021-09-07  8:59               ` Graham Cobb
2021-09-07  9:15                 ` Nikolay Borisov
2021-09-07 16:28             ` Goffredo Baroncelli
2021-09-02 11:44 ` Anand Jain
2021-09-02 14:28   ` Nikolay Borisov
2021-09-03  5:12     ` Anand Jain
2021-09-03  6:58       ` Nikolay Borisov
2021-09-07 13:50 ` David Sterba
2021-09-07 14:18   ` Nikolay Borisov
2021-09-08 11:17   ` Nikolay Borisov
2022-03-29  8:30 Nikolay Borisov
2022-03-29  8:30 ` [PATCH 2/2] btrfs-progs: tests: Add test for fi show Nikolay Borisov
2022-07-18 16:04   ` David Sterba

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=20210902100643.1075385-2-nborisov@suse.com \
    --to=nborisov@suse.com \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.