Whamcloud - gitweb
LU-13019 tests: replace usleep in test scripts 89/39889/3
authorAndreas Dilger <adilger@whamcloud.com>
Fri, 11 Sep 2020 21:31:30 +0000 (15:31 -0600)
committerOleg Drokin <green@whamcloud.com>
Sat, 19 Sep 2020 14:12:54 +0000 (14:12 +0000)
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 <adilger@whamcloud.com>
Change-Id: Ic88c37d33ac17f46b9c1fb912112d318d9c3d07f
Reviewed-on: https://review.whamcloud.com/39889
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: James Simmons <jsimmons@infradead.org>
Reviewed-by: Emoly Liu <emoly@whamcloud.com>
Reviewed-by: Sebastien Buisson <sbuisson@ddn.com>
Reviewed-by: James Nunez <jnunez@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/tests/replay-dual.sh
lustre/tests/replay-single.sh
lustre/tests/sanity-hsm.sh
lustre/tests/sanity.sh
lustre/tests/sanityn.sh

index ebbeafa..8aa6de8 100755 (executable)
@@ -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
index 808873e..726d773 100755 (executable)
@@ -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"
index 15f9551..9f31459 100755 (executable)
@@ -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
index cd1b832..a0db0c0 100755 (executable)
@@ -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
index 9ee1e95..0e8cdd5 100755 (executable)
@@ -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 &