Whamcloud - gitweb
LU-3852 tests: skip tests with large file when no room 56/12456/9
authorBruno Faccini <bruno.faccini@intel.com>
Tue, 28 Oct 2014 13:50:00 +0000 (14:50 +0100)
committerOleg Drokin <oleg.drokin@intel.com>
Wed, 17 Dec 2014 17:46:36 +0000 (17:46 +0000)
Strengthen sanity-hsm sub-tests using large files by skipping
then if not enough space instead to fail.

Also re-enable test_251, and test_[200,221,223b] (for LU-4178),
who have all been wrongly disabled because of their multiple
failures on an auto-test node with very low disk space for the
Servers VMs!!

Also fix a bug in sanity/test_56w that should not be run if
$OSTCOUNT < 2, that was triggered due to my very restictive
test environment osscount/ostcount=1 to limit the Lustre FS size
as much as possible.

Test-Parameters: ostcount=1 ostsizegb=1 envdefinitions=SLOW=yes
Test-Parameters: osscount=1 mdscount=1 testlist=sanity-hsm
Signed-off-by: Bruno Faccini <bruno.faccini@intel.com>
Change-Id: I26bc36e4304a916f29149e6ad19306ed59c9a616
Reviewed-on: http://review.whamcloud.com/12456
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Reviewed-by: James Nunez <james.a.nunez@intel.com>
lustre/tests/sanity-hsm.sh
lustre/tests/sanity.sh

index 218012a..e5a8980 100755 (executable)
@@ -13,10 +13,6 @@ export PATH=$PWD/$SRCDIR:$SRCDIR:$PWD/$SRCDIR/utils:$PATH:/sbin:/usr/sbin
 ONLY=${ONLY:-"$*"}
 # bug number for skipped test:    LU-3815
 ALWAYS_EXCEPT="$SANITY_HSM_EXCEPT 34 35 36"
-# bug number for skipped test:LU-4178
-ALWAYS_EXCEPT="$ALWAYS_EXCEPT 200 221 223b"
-# bug number for skipped test:LU-3852
-ALWAYS_EXCEPT="$ALWAYS_EXCEPT 251"
 # UPDATE THE COMMENT ABOVE WITH BUG NUMBERS WHEN CHANGING ALWAYS_EXCEPT!
 
 LUSTRE=${LUSTRE:-$(cd $(dirname $0)/..; echo $PWD)}
@@ -596,12 +592,24 @@ cleanup_large_files() {
        [ $ratio -gt 50 ] && find $MOUNT -size +10M -exec rm -f {} \;
 }
 
+check_enough_free_space() {
+       local nb=$1
+       local unit=$2
+       local need=$((nb * unit /1024))
+       local free=$(df -kP $MOUNT | tail -1 | awk '{print $4}')
+       (( $need >= $free )) && return 1
+       return 0
+}
+
 make_large_for_striping() {
        local file2=${1/$DIR/$DIR2}
        local sz=$($LCTL get_param -n lov.*-clilov-*.stripesize | head -n1)
 
        cleanup_large_files
 
+       check_enough_free_space 5 $sz
+       [ $? != 0 ] && return $?
+
        dd if=/dev/urandom of=$file2 count=5 bs=$sz conv=fsync ||
                error "cannot create $file2"
        path2fid $1 || error "cannot get fid on $1"
@@ -612,6 +620,9 @@ make_large_for_progress() {
 
        cleanup_large_files
 
+       check_enough_free_space 39 1000000
+       [ $? != 0 ] && return $?
+
        # big file is large enough, so copy time is > 30s
        # so copytool make 1 progress
        # size is not a multiple of 1M to avoid stripe
@@ -626,6 +637,9 @@ make_large_for_progress_aligned() {
 
        cleanup_large_files
 
+       check_enough_free_space 33 1048576
+       [ $? != 0 ] && return $?
+
        # big file is large enough, so copy time is > 30s
        # so copytool make 1 progress
        # size is a multiple of 1M to have stripe
@@ -640,6 +654,9 @@ make_large_for_cancel() {
 
        cleanup_large_files
 
+       check_enough_free_space 103 1048576
+       [ $? != 0 ] && return $?
+
        # Copy timeout is 100s. 105MB => 105s
        dd if=/dev/urandom of=$file2 count=103 bs=1M conv=fsync ||
                error "cannot create $file2"
@@ -1123,6 +1140,8 @@ test_12c() {
        local f=$DIR/$tdir/$tfile
        $LFS setstripe -c 2 $f
        local fid=$(make_large_for_striping $f)
+       [ $? != 0 ] && skip "not enough free space" && return
+
        local FILE_CRC=$(md5sum $f)
 
        $LFS hsm_archive --archive $HSM_ARCHIVE_NUMBER $f
@@ -1998,6 +2017,8 @@ test_26() {
        mkdir -p $DIR/$tdir
        local f=$DIR/$tdir/$tfile
        local fid=$(make_large_for_progress $f)
+       [ $? != 0 ] && skip "not enough free space" && return
+
        $LFS hsm_archive --archive $HSM_ARCHIVE_NUMBER $f
        wait_request_state $fid ARCHIVE SUCCEED
 
@@ -2035,6 +2056,8 @@ test_27b() {
        mkdir -p $DIR/$tdir
        local f=$DIR/$tdir/$tfile
        local fid=$(make_large_for_progress $f)
+       [ $? != 0 ] && skip "not enough free space" && return
+
        $LFS hsm_archive --archive $HSM_ARCHIVE_NUMBER $f
        wait_request_state $fid ARCHIVE SUCCEED
        $LFS hsm_release $f
@@ -2054,6 +2077,8 @@ test_28() {
        mkdir -p $DIR/$tdir
        local f=$DIR/$tdir/$tfile
        local fid=$(make_large_for_progress $f)
+       [ $? != 0 ] && skip "not enough free space" && return
+
        $LFS hsm_archive --archive $HSM_ARCHIVE_NUMBER $f
        wait_request_state $fid ARCHIVE SUCCEED
 
@@ -2232,6 +2257,8 @@ test_31b() {
 
        local f=$DIR/$tdir/$tfile
        local fid=$(make_large_for_progress $f)
+       [ $? != 0 ] && skip "not enough free space" && return
+
        $LFS hsm_archive --archive $HSM_ARCHIVE_NUMBER $f
        wait_request_state $fid ARCHIVE SUCCEED
        $LFS hsm_release $f
@@ -2253,6 +2280,8 @@ test_31c() {
 
        local f=$DIR/$tdir/$tfile
        local fid=$(make_large_for_progress_aligned $f)
+       [ $? != 0 ] && skip "not enough free space" && return
+
        $LFS hsm_archive --archive $HSM_ARCHIVE_NUMBER $f
        wait_request_state $fid ARCHIVE SUCCEED
        $LFS hsm_release $f
@@ -2274,6 +2303,8 @@ test_33() {
 
        local f=$DIR/$tdir/$tfile
        local fid=$(make_large_for_progress $f)
+       [ $? != 0 ] && skip "not enough free space" && return
+
        $LFS hsm_archive --archive $HSM_ARCHIVE_NUMBER $f
        wait_request_state $fid ARCHIVE SUCCEED
        $LFS hsm_release $f
@@ -2338,6 +2369,8 @@ test_34() {
 
        local f=$DIR/$tdir/$tfile
        local fid=$(make_large_for_progress $f)
+       [ $? != 0 ] && skip "not enough free space" && return
+
        $LFS hsm_archive --archive $HSM_ARCHIVE_NUMBER $f
        wait_request_state $fid ARCHIVE SUCCEED
        $LFS hsm_release $f
@@ -2371,6 +2404,8 @@ test_35() {
        local f=$DIR/$tdir/$tfile
        local f1=$DIR/$tdir/$tfile-1
        local fid=$(make_large_for_progress $f)
+       [ $? != 0 ] && skip "not enough free space" && return
+
        local fid1=$(copy_file /etc/passwd $f1)
        $LFS hsm_archive --archive $HSM_ARCHIVE_NUMBER $f
        wait_request_state $fid ARCHIVE SUCCEED
@@ -2407,6 +2442,8 @@ test_36() {
 
        local f=$DIR/$tdir/$tfile
        local fid=$(make_large_for_progress $f)
+       [ $? != 0 ] && skip "not enough free space" && return
+
        $LFS hsm_archive --archive $HSM_ARCHIVE_NUMBER $f
        wait_request_state $fid ARCHIVE SUCCEED
        $LFS hsm_release $f
@@ -2600,6 +2637,7 @@ test_56() {
        mkdir -p $DIR/$tdir
        local f=$DIR/$tdir/$tfile
        local fid=$(make_large_for_progress $f)
+       [ $? != 0 ] && skip "not enough free space" && return
 
        $LFS hsm_archive --archive $HSM_ARCHIVE_NUMBER $f ||
                error "could not archive file"
@@ -2722,6 +2760,7 @@ test_60() {
        mkdir -p $DIR/$tdir
        local f=$DIR/$tdir/$tfile
        local fid=$(make_large_for_progress $f)
+       [ $? != 0 ] && skip "not enough free space" && return
 
        local mdtidx=0
        local mdt=${MDT_PREFIX}${mdtidx}
@@ -2829,6 +2868,7 @@ test_71() {
        mkdir -p $DIR/$tdir
        local f=$DIR/$tdir/$tfile
        local fid=$(make_large_for_progress $f)
+       [ $? != 0 ] && skip "not enough free space" && return
 
        $LFS hsm_archive --archive $HSM_ARCHIVE_NUMBER $f ||
                error "could not archive file"
@@ -3105,6 +3145,8 @@ test_104() {
        mkdir -p $DIR/$tdir
        local f=$DIR/$tdir/$tfile
        local fid=$(make_large_for_progress $f)
+       [ $? != 0 ] && skip "not enough free space" && return
+
        # if cdt is on, it can serve too quickly the request
        cdt_disable
        $LFS hsm_archive --archive $HSM_ARCHIVE_NUMBER --data $DATA $f
@@ -3416,6 +3458,8 @@ test_200() {
        mkdir -p $DIR/$tdir
        local f=$DIR/$tdir/$tfile
        local fid=$(make_large_for_cancel $f)
+       [ $? != 0 ] && skip "not enough free space" && return
+
        # test with cdt on is made in test_221
        cdt_disable
        $LFS hsm_archive --archive $HSM_ARCHIVE_NUMBER $f
@@ -3457,6 +3501,8 @@ test_202() {
        mkdir -p $DIR/$tdir
        local f=$DIR/$tdir/$tfile
        local fid=$(make_large_for_progress $f)
+       [ $? != 0 ] && skip "not enough free space" && return
+
        $LFS hsm_archive --archive $HSM_ARCHIVE_NUMBER $f
        wait_request_state $fid ARCHIVE SUCCEED
 
@@ -3502,6 +3548,7 @@ test_221() {
 
        local f=$DIR/$tdir/$tfile
        local fid=$(make_large_for_cancel $f)
+       [ $? != 0 ] && skip "not enough free space" && return
 
        changelog_setup
 
@@ -3609,6 +3656,7 @@ test_223b() {
 
        local f=$DIR/$tdir/$tfile
        local fid=$(make_large_for_progress $f)
+       [ $? != 0 ] && skip "not enough free space" && return
 
        changelog_setup
        $LFS hsm_archive --archive $HSM_ARCHIVE_NUMBER $f
@@ -3669,6 +3717,7 @@ test_225() {
        mkdir -p $DIR/$tdir
        local f=$DIR/$tdir/$tfile
        local fid=$(make_large_for_progress $f)
+       [ $? != 0 ] && skip "not enough free space" && return
 
        changelog_setup
        $LFS hsm_archive --archive $HSM_ARCHIVE_NUMBER $f
@@ -3872,6 +3921,7 @@ test_251() {
        mkdir -p $DIR/$tdir
        local f=$DIR/$tdir/$tfile
        local fid=$(make_large_for_cancel $f)
+       [ $? != 0 ] && skip "not enough free space" && return
 
        cdt_disable
        # to have a short test
index e4162eb..d7c9ad3 100644 (file)
@@ -4780,6 +4780,8 @@ test_56v() {
 run_test 56v "check 'lfs find -mdt match with lfs getstripe -M' ======="
 
 test_56w() {
+       [[ $OSTCOUNT -lt 2 ]] && skip_env "$OSTCOUNT < 2 OSTs -- skipping" &&
+               return
        [ $PARALLEL == "yes" ] && skip "skip parallel run" && return
        TDIR=$DIR/${tdir}w