]> git.ipfire.org Git - thirdparty/mdadm.git/commitdiff
Fix 07reshape5initr test
authorKinga Stefaniuk <kinga.stefaniuk@intel.com>
Thu, 10 Oct 2024 06:35:46 +0000 (08:35 +0200)
committerMariusz Tkaczyk <mariusz.tkaczyk@linux.intel.com>
Wed, 13 Nov 2024 13:17:35 +0000 (14:17 +0100)
This test could hang if "check" action is not written to sync_action. If
this value didn't appear, test hanged on infinite while loop. Add 5
second timeout to loop.

Signed-off-by: Kinga Stefaniuk <kinga.stefaniuk@intel.com>
tests/07reshape5intr

index 0f4803ac1f820a45bfa6f747e35add71fb9d3156..2af29101c4c73f76b81015a4ab1ec5d208a973aa 100644 (file)
@@ -31,7 +31,21 @@ do
   echo 1000 > /proc/sys/dev/raid/speed_limit_min
   echo 2000 > /proc/sys/dev/raid/speed_limit_max
   check wait
-  while ! echo check > /sys/block/md0/md/sync_action; do sleep 0.1; done
+
+  max=5
+
+  for ((i = 0 ; i < max ; i++ )); do
+    if [[ $(echo check > /sys/block/md0/md/sync_action) != 0 ]]; then
+        break;
+    fi
+    sleep 1
+  done
+
+  if [[ i == max ]]; then
+     echo >&2 "Timeout waiting for check to succeed"
+     exit 1
+  fi
+
   check wait
   mm=`cat /sys/block/md0/md/mismatch_cnt`
   if [ $mm -gt 0 ]