summaryrefslogtreecommitdiffstats
path: root/tests/func.sh
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-12-12 17:22:06 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-12-12 17:22:06 +0000
commit702eb8bf57b076e15e074f6a0c6fd04fb62546d9 (patch)
treee356c38fbe7b86af13593f321fa0da09a991e76f /tests/func.sh
parentAdding upstream version 4.3+20241108. (diff)
downloadmdadm-702eb8bf57b076e15e074f6a0c6fd04fb62546d9.tar.xz
mdadm-702eb8bf57b076e15e074f6a0c6fd04fb62546d9.zip
Adding upstream version 4.3+20241202.upstream/4.3+20241202upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/func.sh')
-rw-r--r--tests/func.sh47
1 files changed, 39 insertions, 8 deletions
diff --git a/tests/func.sh b/tests/func.sh
index 567d91d..4b4d374 100644
--- a/tests/func.sh
+++ b/tests/func.sh
@@ -186,7 +186,7 @@ is_raid_foreign() {
# to decide if an array is foreign or local. It adds homehost if
# one array is local
hostname=$(hostname)
- if [ `expr length "$(hostname)$name"` -lt 31 ]; then
+ if [ `expr length "$(hostname):$name"` -lt 31 ]; then
is_foreign="no"
else
is_foreign="yes"
@@ -202,6 +202,24 @@ restore_selinux() {
setenforce $sys_selinux
}
+wait_for_reshape_end() {
+ # wait for grow-continue to finish but break if sync_action does not
+ # contain any reshape value
+ while true
+ do
+ sync_action=$(grep -Ec '(resync|recovery|reshape|check|repair) *=' /proc/mdstat)
+ if (( "$sync_action" != 0 )); then
+ sleep 1
+ continue
+ elif [[ $(pgrep -f "mdadm --grow --continue" > /dev/null) != "" ]]; then
+ echo "Grow continue did not finish but reshape is done" >&2
+ exit 1
+ else
+ break
+ fi
+ done
+}
+
setup_systemd_env() {
warn "Warning! Test suite will set up systemd environment!\n"
echo "Use \"systemctl show-environment\" to show systemd environment variables"
@@ -357,15 +375,28 @@ check() {
max=`cat /proc/sys/dev/raid/speed_limit_max`
echo 200000 > /proc/sys/dev/raid/speed_limit_max
sleep 0.1
- while grep -Eq '(resync|recovery|reshape|check|repair) *=' /proc/mdstat ||
- grep -v idle > /dev/null /sys/block/md*/md/sync_action
+ iterations=0
+ # Wait 10 seconds for one of the actions appears in sync_action.
+ while [ $iterations -le 10 ]
do
- sleep 0.5
- done
- while ps auxf | grep "mdadm --grow --continue" | grep -v grep
- do
- sleep 1
+ sync_action=$(grep -Ec '(resync|recovery|reshape|check|repair) *=' /proc/mdstat)
+ if (( "$sync_action" == 0 )); then
+ sleep 1
+ iterations=$(( $iterations + 1 ))
+ continue
+ else
+ break
+ fi
done
+ echo "Reshape has not started after 10 seconds"
+
+ # Now let's wait for reshape to finish.
+ echo "Waiting for grow-continue to finish"
+ wait_for_reshape_end
+ # If we have matrix-raid there's a second process ongoing
+ sleep 5
+ wait_for_reshape_end
+
echo $min > /proc/sys/dev/raid/speed_limit_min
echo $max > /proc/sys/dev/raid/speed_limit_max
;;