Linux RAID subsystem development
 help / color / mirror / Atom feed
From: Song Liu <songliubraving@fb.com>
To: linux-raid@vger.kernel.org
Cc: neilb@suse.com, shli@fb.com, hch@infradead.org,
	dan.j.williams@intel.com, kernel-team@fb.com,
	Song Liu <songliubraving@fb.com>
Subject: [PATCH 3/3] mdadm: add test script for raid456 journal
Date: Wed, 21 Oct 2015 11:35:16 -0700	[thread overview]
Message-ID: <1445452516-2816184-4-git-send-email-songliubraving@fb.com> (raw)
In-Reply-To: <1445452516-2816184-1-git-send-email-songliubraving@fb.com>

Signed-off-by: Song Liu <songliubraving@fb.com>
Signed-off-by: Shaohua Li <shli@fb.com>
---
 test                 |  9 ++++++++
 tests/20raid5journal | 64 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 73 insertions(+)
 create mode 100644 tests/20raid5journal

diff --git a/test b/test
index d0a6cb8..13f1bda 100755
--- a/test
+++ b/test
@@ -246,6 +246,15 @@ check() {
        fi
       ;;
 
+    readonly )
+       grep -s "read-only" > /dev/null /proc/mdstat || {
+                echo >&2 "ERROR array is not read-only!"; cat /proc/mdstat ; exit 1; }
+      ;;
+
+    inactive )
+       grep -s "inactive" > /dev/null /proc/mdstat || {
+                echo >&2 "ERROR array is not inactive!"; cat /proc/mdstat ; exit 1; }
+      ;;
     * ) echo >&2 ERROR unknown check $1 ; exit 1;
    esac
 }
diff --git a/tests/20raid5journal b/tests/20raid5journal
new file mode 100644
index 0000000..f751ace
--- /dev/null
+++ b/tests/20raid5journal
@@ -0,0 +1,64 @@
+# check write journal of raid456
+
+# test --detail
+test_detail_shows_journal() {
+    mdadm -D $1 | grep journal || {
+        echo >&2 "ERROR --detail does show journal device!"; mdadm -D $1 ; exit 1; }
+}
+
+# test --examine
+test_examine_shows_journal() {
+    mdadm -E $1 | grep Journal || {
+        echo >&2 "ERROR --examine does show Journal device!"; mdadm -E $1 ; exit 1; }
+}
+
+# test --create
+create_with_journal_and_stop() {
+    mdadm -CR $md0 -l5 -n4 $dev0 $dev1 $dev2 $dev3 --write-journal $dev4
+    check wait
+    tar cf - /etc > $md0
+    ./raid6check $md0 0 0 | grep 'Error detected' && exit 1
+    test_detail_shows_journal $md0
+    test_examine_shows_journal $dev4
+    mdadm -S $md0
+}
+
+# test --assemble
+test_assemble() {
+    create_with_journal_and_stop
+    if mdadm -A $md0 $dev0 $dev1 $dev2 $dev3
+    then
+        echo >&2 "ERROR should return 1 when journal is missing!"; cat /proc/mdstat ; exit 1;
+    fi
+    mdadm -S $md0
+
+    mdadm -A $md0 $dev0 $dev1 $dev2 $dev3 --force
+    check readonly
+    mdadm -S $md0
+}
+
+# test --incremental
+test_incremental() {
+    create_with_journal_and_stop
+    for d in $dev0 $dev1 $dev2 $dev3
+    do
+        mdadm -I $d
+    done
+    check inactive
+    mdadm -I $dev4
+    check raid5
+    mdadm -S $md0
+
+    # test --incremental with journal missing
+    for d in $dev0 $dev1 $dev2 $dev3
+    do
+        mdadm -I $d
+    done
+    mdadm -R $md0
+    check readonly
+    mdadm -S $md0
+}
+
+create_with_journal_and_stop
+test_assemble
+test_incremental
-- 
2.4.6


  parent reply	other threads:[~2015-10-21 18:35 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-21 18:35 [PATCH 0/3] improve mdadm support of write journal Song Liu
2015-10-21 18:35 ` [PATCH 1/3] mdadm: refactor write journal code in Assemble and Incremental Song Liu
2015-10-21 18:35 ` [PATCH 2/3] mdadm: Add description of write journal to md.4 Song Liu
2015-10-21 18:35 ` Song Liu [this message]
2015-10-22  1:22 ` [PATCH 0/3] improve mdadm support of write journal Neil Brown

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=1445452516-2816184-4-git-send-email-songliubraving@fb.com \
    --to=songliubraving@fb.com \
    --cc=dan.j.williams@intel.com \
    --cc=hch@infradead.org \
    --cc=kernel-team@fb.com \
    --cc=linux-raid@vger.kernel.org \
    --cc=neilb@suse.com \
    --cc=shli@fb.com \
    /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