Whamcloud - gitweb
LU-2174 test: improve error message
authorNiu Yawei <niu@whamcloud.com>
Mon, 15 Oct 2012 07:47:23 +0000 (03:47 -0400)
committerOleg Drokin <green@whamcloud.com>
Wed, 24 Oct 2012 19:52:43 +0000 (15:52 -0400)
In sanity-quota.sh, if the testing user/group isn't existing, print
error message to inform user to create them.

Check free space for test_0.

Signed-off-by: Niu Yawei <niu@whamcloud.com>
Change-Id: Ie08250d665b305b140315f76391fd5161a6fbdd5
Reviewed-on: http://review.whamcloud.com/4268
Tested-by: Hudson
Reviewed-by: Johann Lombardi <johann.lombardi@intel.com>
Tested-by: Maloo <whamcloud.maloo@gmail.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/tests/sanity-quota.sh

index 58cd433..ced8a28 100644 (file)
@@ -99,12 +99,15 @@ lustre_fail() {
 
 RUNAS="runas -u $TSTID -g $TSTID"
 RUNAS2="runas -u $TSTID2 -g $TSTID2"
 
 RUNAS="runas -u $TSTID -g $TSTID"
 RUNAS2="runas -u $TSTID2 -g $TSTID2"
-FAIL_ON_ERROR=true check_runas_id $TSTID $TSTID $RUNAS
-FAIL_ON_ERROR=true check_runas_id $TSTID2 $TSTID2 $RUNAS2
 DD="dd if=/dev/zero bs=1M"
 
 FAIL_ON_ERROR=false
 
 DD="dd if=/dev/zero bs=1M"
 
 FAIL_ON_ERROR=false
 
+check_runas_id_ret $TSTUSR $TSTUSR $RUNAS ||
+       error "Please create user $TSTUSR($TSTID) and group $TSTUSR($TSTID)"
+check_runas_id_ret $TSTUSR2 $TSTUSR2 $RUNAS2 ||
+       error "Please create user $TSTUSR2($TSTID2) and group $TSTUSR2($TSTID2)"
+
 # clear quota limits for a user or a group
 # usage: resetquota -u username
 #        resetquota -g groupname
 # clear quota limits for a user or a group
 # usage: resetquota -u username
 #        resetquota -g groupname
@@ -351,12 +354,17 @@ test_quota_performance() {
 
 # test basic quota performance b=21696
 test_0() {
 
 # test basic quota performance b=21696
 test_0() {
-       setup_quota_test
-       trap cleanup_quota_test EXIT
-
        local MB=100 # 100M
        [ "$SLOW" = "no" ] && MB=10
 
        local MB=100 # 100M
        [ "$SLOW" = "no" ] && MB=10
 
+       local free_space=$(lfs df | grep "filesystem summary" | \
+                               awk '{print $5}')
+       [ $free_space -le $((MB * 1024)) ] &&
+               skip "not enough space ${free_space} KB, " \
+                       "required $((MB * 1024)) KB" && return
+       setup_quota_test
+       trap cleanup_quota_test EXIT
+
        set_ost_qtype "none" || error "disable ost quota failed"
        test_quota_performance $MB
 
        set_ost_qtype "none" || error "disable ost quota failed"
        test_quota_performance $MB