All of lore.kernel.org
 help / color / mirror / Atom feed
From: Zdenek Kabelac <zkabelac@sourceware.org>
To: lvm-devel@redhat.com
Subject: main - tests: improve check raid_leg_status
Date: Wed, 24 Mar 2021 15:41:56 +0000 (GMT)	[thread overview]
Message-ID: <20210324154156.D454B384B13C@sourceware.org> (raw)

Gitweb:        https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=c1f5ca6751eeda5925638447b561b05bdf8a250c
Commit:        c1f5ca6751eeda5925638447b561b05bdf8a250c
Parent:        0783c661b9eb407b0b436559b6950deefc906b4f
Author:        Zdenek Kabelac <zkabelac@redhat.com>
AuthorDate:    Wed Mar 24 16:05:03 2021 +0100
Committer:     Zdenek Kabelac <zkabelac@redhat.com>
CommitterDate: Wed Mar 24 16:38:12 2021 +0100

tests: improve  check raid_leg_status

Enhance function to wait until raid status gets consisten
(shifts from 0/xxxxx to something else)

If it would took too long fail the check.
---
 test/lib/check.sh | 17 +++++++++++++----
 1 file changed, 13 insertions(+), 4 deletions(-)

diff --git a/test/lib/check.sh b/test/lib/check.sh
index 4deb78a74..5b119430d 100644
--- a/test/lib/check.sh
+++ b/test/lib/check.sh
@@ -436,10 +436,19 @@ sysfs() {
 raid_leg_status() {
 	local st
 	local val
-	st=$(dmsetup status "$1-$2")
-	val=$(echo "$st" | cut -d ' ' -f 6)
-	test "$val" = "$3" || \
-		die "$1-$2 status $val != $3  ($st)"
+
+	# Ignore inconsisten raid status 0/xxxxx idle
+	for i in {100..0} ; do
+		st=( $(dmsetup status $1-$2) ) || die "Unable to get status of $vg/$lv1"
+		b=( $(echo "${st[6]}" | sed s:/:' ':) )
+		[ "${b[0]}" = "0" ] || {
+			test "${st[5]}" = "$3" || break
+			return 0
+		}
+		sleep .1
+	done
+
+	die "$1-$2 status ${st[5]} != $3  ($st)"
 }
 
 grep_dmsetup() {



                 reply	other threads:[~2021-03-24 15:41 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=20210324154156.D454B384B13C@sourceware.org \
    --to=zkabelac@sourceware.org \
    --cc=lvm-devel@redhat.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 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.