From: Andreas Dilger Date: Fri, 11 Sep 2020 21:31:30 +0000 (-0600) Subject: LU-13019 tests: replace usleep in test scripts X-Git-Tag: 2.13.56~18 X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=commitdiff_plain;h=ca754ec8b43416d41bbd401bad7d9f93746fb867;hp=174b9684c3f48c7f7f845b14d9452d0bf1ceaece LU-13019 tests: replace usleep in test scripts The "usleep" command is specific to RHEL, and is not available on Ubuntu clients. Instead, "sleep" can be used with a fractional second value to get the same effect more portably. The "usleep" values are increased to be more reasonable lengths, as a 100us sleep doesn't make sense after do_facet or other remote call that may take seconds to complete. Also, in VM testing there may be unpredictable delays, so it is better to be conservative. Test-Parameters: trivial testlist=sanity-hsm,replay-single,replay-dual Signed-off-by: Andreas Dilger Change-Id: Ic88c37d33ac17f46b9c1fb912112d318d9c3d07f Reviewed-on: https://review.whamcloud.com/39889 Tested-by: jenkins Tested-by: Maloo Reviewed-by: James Simmons Reviewed-by: Emoly Liu Reviewed-by: Sebastien Buisson Reviewed-by: James Nunez Reviewed-by: Oleg Drokin --- diff --git a/lustre/tests/replay-dual.sh b/lustre/tests/replay-dual.sh index ebbeafa..8aa6de8 100755 --- a/lustre/tests/replay-dual.sh +++ b/lustre/tests/replay-dual.sh @@ -451,7 +451,7 @@ test_18() { # bug 3822 - evicting client with enqueued lock do_facet client lctl set_param ldlm.namespaces.*.early_lock_cancel=0 do_facet client lctl set_param fail_loc=0x80000305 # drop cb, evict cancel_lru_locks mdc - usleep 500 # wait to ensure first client is one that will be evicted + sleep 0.1 # wait to ensure first client is one that will be evicted openfile -f O_RDONLY $MOUNT2/$tdir/$tfile wait $OPENPID do_facet client lctl set_param ldlm.namespaces.*.early_lock_cancel=1 diff --git a/lustre/tests/replay-single.sh b/lustre/tests/replay-single.sh index 808873e..726d773 100755 --- a/lustre/tests/replay-single.sh +++ b/lustre/tests/replay-single.sh @@ -473,7 +473,7 @@ test_20b() { # bug 10480 dd if=/dev/zero of=$DIR/$tfile bs=4k count=10000 & while [ ! -e $DIR/$tfile ] ; do - usleep 60 # give dd a chance to start + sleep 0.01 # give dd a chance to start done $LFS getstripe $DIR/$tfile || error "$LFS getstripe $DIR/$tfile failed" diff --git a/lustre/tests/sanity-hsm.sh b/lustre/tests/sanity-hsm.sh index 15f9551..9f31459 100755 --- a/lustre/tests/sanity-hsm.sh +++ b/lustre/tests/sanity-hsm.sh @@ -92,7 +92,7 @@ wait_copytools() { local wait_timeout=200 local wait_start=$SECONDS local wait_end=$((wait_start + wait_timeout)) - local sleep_time=100000 # 0.1 second + local sleep_time=1 while ((SECONDS < wait_end)); do if ! search_copytools $hosts; then @@ -101,9 +101,8 @@ wait_copytools() { fi echo "copytools still running on $hosts" - usleep $sleep_time - [ $sleep_time -lt 32000000 ] && # 3.2 seconds - sleep_time=$(bc <<< "$sleep_time * 2") + sleep $sleep_time + [ $sleep_time -lt 5 ] && sleep_time=$((sleep_time + 1)) done # try to dump Copytool's stack diff --git a/lustre/tests/sanity.sh b/lustre/tests/sanity.sh index cd1b832..a0db0c0 100755 --- a/lustre/tests/sanity.sh +++ b/lustre/tests/sanity.sh @@ -7717,7 +7717,7 @@ test_60g() { do_facet mds$index $LCTL set_param fail_loc=0x8000019a \ > /dev/null - usleep 100 + sleep 0.01 done kill -9 $pid diff --git a/lustre/tests/sanityn.sh b/lustre/tests/sanityn.sh index 9ee1e95..0e8cdd5 100755 --- a/lustre/tests/sanityn.sh +++ b/lustre/tests/sanityn.sh @@ -753,7 +753,7 @@ test_27() { lctl clear dd if=/dev/zero of=$DIR2/$tfile bs=$((4096+4))k conv=notrunc count=4 seek=3 & DD2_PID=$! - usleep 50 + sleep 0.5 log "dd 1 started" dd if=/dev/zero of=$DIR1/$tfile bs=$((16384-1024))k conv=notrunc count=1 seek=4 &