]> git.ipfire.org Git - thirdparty/mdadm.git/commitdiff
Regression fix (#156)
authorXiaoNi87 <xni@redhat.com>
Tue, 18 Mar 2025 00:18:04 +0000 (08:18 +0800)
committerGitHub <noreply@github.com>
Tue, 18 Mar 2025 00:18:04 +0000 (08:18 +0800)
Signed-off-by: Xiao Ni <xni@redhat.com>
.github/tools/run_mdadm_tests.sh
test
tests/05r6tor0.broken [new file with mode: 0644]
tests/07revert-inplace.broken [new file with mode: 0644]
tests/10ddf-create.broken [deleted file]
tests/10ddf-fail-two-spares.broken [deleted file]
tests/20raid5journal.broken [new file with mode: 0644]
tests/env-ddf-template
tests/skiptests [new file with mode: 0644]
util.c

index 456874b51f4616df8153c85c1445903857d714dc..22d89a8c371a2e8207ed2b80c7bede216b82f975 100755 (executable)
@@ -11,7 +11,7 @@ sudo ./test setup
 
 #sudo ./test --tests=00createnames
 
-sudo ./test --skip-broken --no-error --disable-integrity --disable-multipath --disable-linear --keep-going
+sudo ./test --skip-broken --no-error --disable-integrity --disable-multipath --disable-linear --keep-going --skip-bigcase
 
 ret=$?
 sudo ./test cleanup
diff --git a/test b/test
index 88e44f182850066f2b753b067822e2bf3610a53c..7fa68177714f27c18105d5a167322bd76bc0e51f 100755 (executable)
--- a/test
+++ b/test
@@ -26,6 +26,10 @@ savelogs=0
 exitonerror=1
 ctrl_c_error=0
 skipbroken=0
+skipbigcase=0
+skipfile="skiptests"
+skipcheckfile=$testdir/$skipfile
+checkscript=""
 loop=1
 prefix='[0-9][0-9]'
 
@@ -192,6 +196,7 @@ do_help() {
                --loop=N                    Run tests N times (0 to run forever)
                --skip-broken               Skip tests that are known to be broken
                --skip-always-broken        Skip tests that are known to always fail
+               --skip-bigcase              Skip tests that need time than 200 seconds
                --dev=loop|lvm|ram|disk     Use loop devices (default), LVM, RAM or disk
                --disks=                    Provide a bunch of physical devices for test
                --volgroup=name             LVM volume group for LVM test
@@ -295,6 +300,9 @@ parse_args() {
                --skip-always-broken )
                        skipbroken=always
                        ;;
+               --skip-bigcase )
+                       skipbigcase=all
+                       ;;
                --disable-multipath )
                        unset MULTIPATH
                        ;;
@@ -369,9 +377,17 @@ main() {
                else
                        for script in $testdir/$prefix $testdir/$prefix*[^~]
                        do
-                               case $script in *.broken) ;;
-                                *)
-                                    do_test $script
+                               checkscript="${script##*/}"
+                               case $script in
+                               *.broken)
+                                       ;;
+                               *)
+                                       if grep -q "$checkscript" "$skipcheckfile"; then
+                                               if [ "$skipbigcase" == "all" ]; then
+                                                       continue
+                                               fi
+                                       fi
+                                       do_test $script
                                esac
                        done
                fi
diff --git a/tests/05r6tor0.broken b/tests/05r6tor0.broken
new file mode 100644 (file)
index 0000000..930a094
--- /dev/null
@@ -0,0 +1,15 @@
+Sometimes
+
++++ pgrep -f 'mdadm --grow --continue'
+++ [[ '' != '' ]]
+++ break
+++ echo 100
+++ echo 500
+++ sleep 2
+++ check raid5
+++ case $1 in
+++ grep -sq 'active raid5 ' /proc/mdstat
+++ die 'active raid5 not found'
+++ echo -e '\n\tERROR: active raid5 not found \n'
+
+        ERROR: active raid5 not found
diff --git a/tests/07revert-inplace.broken b/tests/07revert-inplace.broken
new file mode 100644 (file)
index 0000000..73d98a0
--- /dev/null
@@ -0,0 +1,8 @@
+always fails
+
+Fails with errors:
+       ++ /usr/sbin/mdadm -A /dev/md0 --update=revert-reshape /dev/loop0 /dev/loop1 /dev/loop2 /dev/loop3 /dev/loop4 --backup-file=/tmp/md-backup
+++ rv=1
+++ case $* in
+++ cat /var/tmp/stderr
+mdadm: failed to RUN_ARRAY /dev/md0: Invalid argument
diff --git a/tests/10ddf-create.broken b/tests/10ddf-create.broken
deleted file mode 100644 (file)
index 0f7d25e..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-Fails due to segmentation fault at assemble.
-
-Too much effort to diagnose this now, marking as broken to make CI clear.
-       ++ /usr/sbin/mdadm -A /dev/md/ddf0 /dev/loop8 /dev/loop9 /dev/loop10 /dev/loop11 /dev/loop12
-       ./test: line 76: 101955 Segmentation fault      (core dumped) $mdadm "$@" 2> $targetdir/stderr
diff --git a/tests/10ddf-fail-two-spares.broken b/tests/10ddf-fail-two-spares.broken
deleted file mode 100644 (file)
index eeea56d..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-fails infrequently
-
-Fails roughly 1 in 3 with error:
-
-   ERROR: /dev/md/vol1 should be optimal in meta data
diff --git a/tests/20raid5journal.broken b/tests/20raid5journal.broken
new file mode 100644 (file)
index 0000000..c7b214a
--- /dev/null
@@ -0,0 +1,17 @@
+always fail
+
+++ /usr/sbin/mdadm -I /dev/loop4
+++ rv=0
+++ case $* in
+++ cat /var/tmp/stderr
+mdadm: /dev/loop4 attached to /dev/md/0_0, which has been started.
+++ return 0
+++ check raid5
+++ case $1 in
+++ grep -sq 'active raid5 ' /proc/mdstat
+++ die 'active raid5 not found'
+++ echo -e '\n\tERROR: active raid5 not found \n'
+
+        ERROR: active raid5 not found
+
+++ save_log fail
index 4f4ad0f32c0c930066ff0466c4a49477baa85008..ebc0ebf3ab1e113b0218cf3fffb9222e89cc6d17 100644 (file)
@@ -3,8 +3,7 @@ sha1_sum() {
 }
 
 get_rootdev() {
-    local part=$(grep ' / ' /proc/mounts | awk '{print $1}')
-    local bd=/dev/$(lsblk -no PKNAME $part)
+    local bd=$(grep ' / ' /proc/mounts | awk '{print $1}')
     [ -b $bd ] || exit 1
     echo $bd
 }
diff --git a/tests/skiptests b/tests/skiptests
new file mode 100644 (file)
index 0000000..fd0893f
--- /dev/null
@@ -0,0 +1,9 @@
+casename:seconds
+01raid6integ:1732
+01replace:396
+07layouts:836
+11spare-migration:1140
+12imsm-r0_2d-grow-r0_5d:218
+13imsm-r0_r0_2d-grow-r0_r0_4d:218
+13imsm-r0_r0_2d-grow-r0_r0_5d:246
+19raid6check:268
diff --git a/util.c b/util.c
index 8c45f0e1feaf5e1180ff0c06eb118f1ce0c2e26c..9fe2d2276712909559841e8a2df07c9aa6ba1190 100644 (file)
--- a/util.c
+++ b/util.c
@@ -2310,7 +2310,7 @@ mdadm_status_t continue_via_systemd(char *devnm, char *service_name, char *prefi
        dprintf("Start %s service\n", service_name);
        /* Simply return that service cannot be started */
        if (check_env("MDADM_NO_SYSTEMCTL"))
-               return MDADM_STATUS_SUCCESS;
+               return MDADM_STATUS_ERROR;
 
        /* Fork in attempt to start services */
        switch (fork()) {