From 501953d69ed94d6058dce6b6cffe972aeae747ce Mon Sep 17 00:00:00 2001 From: Bryant Duffy-Ly Date: Wed, 13 Oct 2021 15:13:19 -0500 Subject: [PATCH] Fix mkdir-rename-rmdir test script The current script gets stuck in an infinite loop when the test suite is started with 1 mount point. This is due to the advancement part of the script in which it advances the ops for each mount. The current while loop checks for when the op_mnt wraps by checking if it equals 0. But the problem is we set each of the op_mnts to 0 during the advancement, so when it wraps it still equates to 0, so it is an infinite loop. Therefore, the fix is to check at the end of the loop check if the last op's mount number wrapped. If so just break out. Signed-off-by: Bryant Duffy-Ly --- tests/tests/mkdir-rename-rmdir.sh | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/tests/tests/mkdir-rename-rmdir.sh b/tests/tests/mkdir-rename-rmdir.sh index 0379caed..529b9cb2 100755 --- a/tests/tests/mkdir-rename-rmdir.sh +++ b/tests/tests/mkdir-rename-rmdir.sh @@ -23,9 +23,7 @@ else NR_MNTS=$T_NR_MOUNTS fi -# test until final op mount dir wraps -while [ ${op_mnt[$NR_OPS]} == 0 ]; do - +while : ; do # sequentially perform each op from its mount dir for op in $(seq 0 $((NR_OPS - 1))); do m=${op_mnt[$op]} @@ -45,7 +43,7 @@ while [ ${op_mnt[$NR_OPS]} == 0 ]; do # advance through mnt nrs for each op i=0 - while [ ${op_mnt[$NR_OPS]} == 0 ]; do + while [ $i -lt $NR_OPS ]; do ((op_mnt[$i]++)) if [ ${op_mnt[$i]} -ge $NR_MNTS ]; then op_mnt[$i]=0 @@ -54,6 +52,9 @@ while [ ${op_mnt[$NR_OPS]} == 0 ]; do break fi done + + # done when the last op's mnt nr wrapped + [ $i -ge $NR_OPS ] && break done t_pass