tests: simplify check_bg_procs_limit_num(), inline into setup
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz> Closes #12979
This commit is contained in:
parent
d9fdba124d
commit
7467281594
|
@ -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
|
||||
}
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
|
@ -30,55 +30,6 @@
|
|||
|
||||
. $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
|
||||
{
|
||||
|
||||
|
|
|
@ -34,13 +34,25 @@
|
|||
|
||||
verify_runnable "global"
|
||||
|
||||
check_bg_procs_limit_num
|
||||
if [[ $? -ne 0 ]]; then
|
||||
log_note "ksh background process limit number is 25"
|
||||
export GANGPIDS=25
|
||||
fi
|
||||
#
|
||||
# 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
|
||||
|
||||
export PIDS=""
|
||||
for pid in $pids; do
|
||||
wait $pid || exit
|
||||
done
|
||||
) || {
|
||||
log_note "ksh background process limit number is 25"
|
||||
GANGPIDS=25
|
||||
}
|
||||
|
||||
init_setup $DISK
|
||||
|
||||
|
|
Loading…
Reference in New Issue