summaryrefslogtreecommitdiff
path: root/test/lib
diff options
context:
space:
mode:
authorZdenek Kabelac <zkabelac@redhat.com>2023-04-20 17:08:42 +0200
committerZdenek Kabelac <zkabelac@redhat.com>2023-04-21 14:52:43 +0200
commit80ebec099dbb20e46655958e1ca7fcfd466b78d8 (patch)
tree0a08a476aebee5144bafeb65aaac68557248d55f /test/lib
parent4e0aab74288390b633c25c1bcf3efdb127e3a364 (diff)
downloadlvm2-80ebec099dbb20e46655958e1ca7fcfd466b78d8.tar.gz
aux: add wait_recalc
Share function across tests.
Diffstat (limited to 'test/lib')
-rw-r--r--test/lib/aux.sh25
1 files changed, 25 insertions, 0 deletions
diff --git a/test/lib/aux.sh b/test/lib/aux.sh
index 33710a007..62635ce84 100644
--- a/test/lib/aux.sh
+++ b/test/lib/aux.sh
@@ -1757,6 +1757,31 @@ wait_for_sync() {
return 1
}
+wait_recalc() {
+ local checklv=$1
+
+ for i in {1..100} ; do
+ sync=$(get lv_field "$checklv" sync_percent | cut -d. -f1)
+ echo "sync_percent is $sync"
+
+ test "$sync" = "100" && return
+
+ sleep .1
+ done
+
+ # TODO: There is some strange bug, first leg of RAID with integrity
+ # enabled never gets in sync. I saw this in BB, but not when executing
+ # the commands manually
+# if test -z "$sync"; then
+# echo "TEST\ WARNING: Resync of dm-integrity device '$checklv' failed"
+# dmsetup status "$DM_DEV_DIR/mapper/${checklv/\//-}"
+# exit
+# fi
+ echo "Timeout waiting for recalc"
+ dmsetup status "$DM_DEV_DIR/mapper/${checklv/\//-}"
+ return 1
+}
+
# Check if tests are running on 64bit architecture
can_use_16T() {
test "$(getconf LONG_BIT)" -eq 64