]> git.proxmox.com Git - mirror_zfs.git/commitdiff
tests: simplify check_bg_procs_limit_num(), inline into setup
authorнаб <nabijaczleweli@nabijaczleweli.xyz>
Mon, 17 Jan 2022 18:11:06 +0000 (19:11 +0100)
committerBrian Behlendorf <behlendorf1@llnl.gov>
Wed, 26 Jan 2022 19:30:20 +0000 (11:30 -0800)
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz>
Closes #12979

tests/zfs-tests/tests/functional/mv_files/mv_files_001_pos.ksh
tests/zfs-tests/tests/functional/mv_files/mv_files_002_pos.ksh
tests/zfs-tests/tests/functional/mv_files/mv_files_common.kshlib
tests/zfs-tests/tests/functional/mv_files/setup.ksh

index 4ea5e3db388931d280446a1750fbcc2c3444e4b3..c49b19c6c3a3b1659d6ad5091706dc56dc7a7f4c 100755 (executable)
@@ -53,7 +53,6 @@ verify_runnable "global"
 
 function cleanup
 {
-       PIDS=""
        rm -f $OLDDIR/* >/dev/null 2>&1
        rm -f $NEWDIR_IN_FS/* >/dev/null 2>&1
 }
index 283770d4a4bf47df17d6e8603ea01185f434d803..fdadac32d59b164413fe9b7bd5757752afb75470 100755 (executable)
@@ -54,7 +54,6 @@ verify_runnable "global"
 
 function cleanup
 {
-       PIDS=""
        rm -f $OLDDIR/* >/dev/null 2>&1
        rm -f $NEWDIR_ACROSS_FS/* >/dev/null 2>&1
 }
index a64aa6806698db1659601073430b2596cc4ca727..4794d8ae94b6c4bb67737c7a93ffd3e20f2ea3f3 100644 (file)
 
 . $STF_SUITE/tests/functional/mv_files/mv_files.cfg
 
-#
-# Determine whether this version of the ksh being
-# executed has a bug where the limit of background
-# processes of 25.
-#
-function check_bg_procs_limit_num
-{
-echo "#!/bin/ksh" > $TEST_BASE_DIR/exitsZero.ksh
-echo  "exit 0" >> $TEST_BASE_DIR/exitsZero.ksh
-chmod 777 $TEST_BASE_DIR/exitsZero.ksh
-
-cat <<EOF > $TEST_BASE_DIR/testbackgprocs.ksh
-#!/bin/ksh
-#
-# exitsZero.ksh is a one line script
-# that exit with status of "0"
-#
-
-PIDS=""
-typeset -i i=1
-while [ \$i -le 50 ]
-do
-       $TEST_BASE_DIR/exitsZero.ksh &
-        PIDS="\$PIDS \$!"
-        (( i = i + 1 ))
-done
-
-sleep 1
-
-for pid in \$PIDS
-do
-       wait \$pid
-        (( \$? == 127 )) && exit 1
-done
-exit 0
-EOF
-
-ksh $TEST_BASE_DIR/testbackgprocs.ksh
-if [[ $? -eq 1 ]]; then
-#
-# Current ksh being executed has a limit
-# of 25 background processes.
-#
-       return 1
-else
-        return 0
-fi
-}
-
 function init_setup
 {
 
index e4e97b16d5d464e66b228f4cfc858230277ad373..d459c51e4e5719e1bc329d7b8285db1f7695b794 100755 (executable)
 
 verify_runnable "global"
 
-check_bg_procs_limit_num
-if [[ $? -ne 0 ]]; then
+#
+# Determine whether this version of the ksh being
+# executed has a bug where the limit of background
+# processes of 25.
+#
+(
+       pids=
+       for _ in $(seq 50); do
+               : &
+               pids="$pids $!"
+       done
+
+       for pid in $pids; do
+               wait $pid || exit
+       done
+) || {
        log_note "ksh background process limit number is 25"
-       export GANGPIDS=25
-fi
-
-export PIDS=""
+       GANGPIDS=25
+}
 
 init_setup $DISK