From: Niu Yawei Date: Fri, 3 Jul 2015 03:51:41 +0000 (-0400) Subject: LU-4306 tests: improve test_4a of s-q X-Git-Tag: 2.7.57~58 X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=commitdiff_plain;h=a838fe8b43a8e3afb35d4854745b4876726f82c5 LU-4306 tests: improve test_4a of s-q test_4a of s-q used "sync; sleep 1; sync" to sync all data, that could stall for an unexpected long time, this patch changes it to sync_all_data for better time-efficiency. This patch also modified the script to report proper error when the grace has already expired before trying create new file. Signed-off-by: Niu Yawei Change-Id: I4aa2f69933be37d5f98af8172ed6a20781fe6e38 Reviewed-on: http://review.whamcloud.com/15483 Tested-by: Jenkins Tested-by: Maloo Reviewed-by: Fan Yong Reviewed-by: Jian Yu Reviewed-by: Oleg Drokin --- diff --git a/lustre/tests/sanity-quota.sh b/lustre/tests/sanity-quota.sh index d792a99..5217551 100644 --- a/lustre/tests/sanity-quota.sh +++ b/lustre/tests/sanity-quota.sh @@ -678,7 +678,8 @@ run_test 3 "Block soft limit (start timer, timer goes off, stop timer)" test_file_soft() { local TESTFILE=$1 local LIMIT=$2 - local TIMER=$(($3 * 3 / 2)) + local grace=$3 + local TIMER=$(($grace * 3 / 2)) setup_quota_test trap cleanup_quota_test EXIT @@ -686,13 +687,19 @@ test_file_soft() { echo "Create files to exceed soft limit" $RUNAS createmany -m ${TESTFILE}_ $((LIMIT + 1)) || quota_error a $TSTUSR "create failure, but expect success" - sync; sleep 1; sync + local trigger_time=$(date +%s) + + sync_all_data || true + + local cur_time=$(date +%s) + [ $(($cur_time - $trigger_time)) -ge $grace ] && + error "Passed grace time $grace, $trigger_time, $cur_time" echo "Create file before timer goes off" $RUNAS touch ${TESTFILE}_before || quota_error a $TSTUSR "failed create before timer expired," \ - "but expect success" - sync; sleep 1; sync + "but expect success. $trigger_time, $cur_time" + sync_all_data || true echo "Sleep $TIMER seconds ..." sleep $TIMER @@ -707,11 +714,11 @@ test_file_soft() { # hasn't been decreased from the pending write, if we acquire quota # in this window, we'll acquire more than we needed. $RUNAS touch ${TESTFILE}_after_1 ${TESTFILE}_after_2 || true - sync; sleep 1; sync + sync_all_data || true $RUNAS touch ${TESTFILE}_after_3 && quota_error a $TSTUSR "create after timer expired," \ "but expect EDQUOT" - sync; sleep 1; sync + sync_all_data || true $SHOW_QUOTA_USER $SHOW_QUOTA_GROUP @@ -726,7 +733,7 @@ test_file_soft() { $RUNAS touch ${TESTFILE}_xxx || quota_error a $TSTUSR "touch after timer stop failure," \ "but expect success" - sync; sleep 1; sync + sync_all_data || true # cleanup cleanup_quota_test