Whamcloud - gitweb
LU-11607 tests: replace version/fstype in sanity-dom/quota 66/35766/2
authorJames Nunez <jnunez@whamcloud.com>
Sun, 11 Aug 2019 16:44:16 +0000 (10:44 -0600)
committerOleg Drokin <green@whamcloud.com>
Sat, 7 Sep 2019 01:52:29 +0000 (01:52 +0000)
The routine get_lustre_env() is available to all Lustre test
suites and sets an environment variable for the file system
type for MDS1 and OST1 and sets variables for the Lustre
version of servers.

In sanity-dom and sanity-quota, replace the calls to
facet_fstype() and lustre_version_code() for all server
types with definitions in get_lustre_env().

While doing this, replace 'facet_fstype $SINGLEMDS' and
'lustre_version_code $SINGLEMDS' with $mds1_FSTYPE
and $MDS1_VERSION, respectively.

Clean up around any modifications by removing calls to
return after skip() or skip_env() and convert spaces
to tabs.

Test-Parameters: trivial testlist=sanity-dom,sanity-quota
Test-Parameters: fstype=zfs testlist=sanity-dom,sanity-quota
Signed-off-by: James Nunez <jnunez@whamcloud.com>
Change-Id: I4dffae5ad69aa2dec5b85e285a9b314b9b35b2ba
Reviewed-on: https://review.whamcloud.com/35766
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Wei Liu <sarah@whamcloud.com>
Reviewed-by: Emoly Liu <emoly@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/tests/sanity-dom.sh
lustre/tests/sanity-quota.sh

index 0b2ecd3..32373c5 100644 (file)
@@ -19,8 +19,8 @@ ALWAYS_EXCEPT="$SANITY_DOM_EXCEPT"
 
 build_test_filter
 
 
 build_test_filter
 
-[[ $(lustre_version_code $SINGLEMDS) -ge $(version_code 2.10.56) ]] ||
-       { skip "Need MDS version at least 2.10.56"; exit 0; }
+[[ "$MDS1_VERSION" -ge $(version_code 2.10.56) ]] ||
+       skip "Need MDS version at least 2.10.56"
 
 OPENFILE=${OPENFILE:-openfile}
 MOUNT_2=${MOUNT_2:-"yes"}
 
 OPENFILE=${OPENFILE:-openfile}
 MOUNT_2=${MOUNT_2:-"yes"}
index a65dacc..d398e34 100755 (executable)
@@ -20,7 +20,7 @@ ALWAYS_EXCEPT+="                55"
 # Test duration:                   30 min
 [ "$SLOW" = "no" ] && EXCEPT_SLOW="61"
 
 # Test duration:                   30 min
 [ "$SLOW" = "no" ] && EXCEPT_SLOW="61"
 
-if [ $(facet_fstype $SINGLEMDS) = "zfs" ]; then
+if [ "$mds1_FSTYPE" = zfs ]; then
        # bug number:                        LU-2887
        # Test duration:                     21      9 min"
        [ "$SLOW" = "no" ] && EXCEPT_SLOW+=" 12a     9"
        # bug number:                        LU-2887
        # Test duration:                     21      9 min"
        [ "$SLOW" = "no" ] && EXCEPT_SLOW+=" 12a     9"
@@ -44,10 +44,10 @@ require_dsh_mds || exit 0
 require_dsh_ost || exit 0
 
 # Does e2fsprogs support quota feature?
 require_dsh_ost || exit 0
 
 # Does e2fsprogs support quota feature?
-if [ $(facet_fstype $SINGLEMDS) == ldiskfs ] &&
+if [ "$mds1_FSTYPE" == ldiskfs ] &&
        do_facet $SINGLEMDS "! $DEBUGFS -c -R supported_features |
                grep -q 'quota'"; then
        do_facet $SINGLEMDS "! $DEBUGFS -c -R supported_features |
                grep -q 'quota'"; then
-       skip_env "e2fsprogs doesn't support quota" && exit 0
+       skip_env "e2fsprogs doesn't support quota"
 fi
 
 QUOTALOG=${TESTSUITELOG:-$TMP/$(basename $0 .sh).log}
 fi
 
 QUOTALOG=${TESTSUITELOG:-$TMP/$(basename $0 .sh).log}
@@ -455,15 +455,15 @@ test_quota_performance() {
        local etime=$(date +%s)
        delta=$((etime - stime))
        if [ $delta -gt 0 ]; then
        local etime=$(date +%s)
        delta=$((etime - stime))
        if [ $delta -gt 0 ]; then
-           rate=$((size * 1024 / delta))
-           if [ $(facet_fstype $SINGLEMDS) = "zfs" ]; then
-               # LU-2872 - see LU-2887 for fix
-               [ $rate -gt 64 ] ||
-                       error "SLOW IO for $TSTUSR (user): $rate KB/sec"
-           else
-               [ $rate -gt 1024 ] ||
-                       error "SLOW IO for $TSTUSR (user): $rate KB/sec"
-           fi
+               rate=$((size * 1024 / delta))
+               if [ "$mds1_FSTYPE" = zfs ]; then
+                       # LU-2872 - see LU-2887 for fix
+                       [ $rate -gt 64 ] ||
+                               error "SLOW IO for $TSTUSR (user): $rate KB/sec"
+               else
+                       [ $rate -gt 1024 ] ||
+                               error "SLOW IO for $TSTUSR (user): $rate KB/sec"
+               fi
        fi
        rm -f $TESTFILE
 }
        fi
        rm -f $TESTFILE
 }
@@ -955,7 +955,7 @@ test_4a() {
        $LFS setquota -u $TSTUSR -b 0 -B 0 -i $LIMIT -I 0 $DIR ||
                error "set user quota failed"
 
        $LFS setquota -u $TSTUSR -b 0 -B 0 -i $LIMIT -I 0 $DIR ||
                error "set user quota failed"
 
-       [ $(facet_fstype $SINGLEMDS) = "zfs" ] && GRACE=20
+       [ "$mds1_FSTYPE" = zfs ] && GRACE=20
 
        test_file_soft $TESTFILE $LIMIT $GRACE "u"
 
 
        test_file_soft $TESTFILE $LIMIT $GRACE "u"
 
@@ -1357,7 +1357,7 @@ test_7c() {
        # enable ost quota
        set_ost_qtype $QTYPE || error "enable ost quota failed"
        # trigger reintegration
        # enable ost quota
        set_ost_qtype $QTYPE || error "enable ost quota failed"
        # trigger reintegration
-       local procf="osd-$(facet_fstype ost1).$FSNAME-OST*."
+       local procf="osd-$ost1_FSTYPE.$FSNAME-OST*."
        procf=${procf}quota_slave.force_reint
        do_facet ost1 $LCTL set_param $procf=1 ||
                error "force reintegration failed"
        procf=${procf}quota_slave.force_reint
        do_facet ost1 $LCTL set_param $procf=1 ||
                error "force reintegration failed"
@@ -1426,7 +1426,7 @@ test_7e() {
 
        # LU-2435: skip this quota test if underlying zfs version has not
        # supported native dnode accounting
 
        # LU-2435: skip this quota test if underlying zfs version has not
        # supported native dnode accounting
-       [ "$(facet_fstype mds1)" == "zfs" ] && {
+       [ "$mds1_FSTYPE" == zfs ] && {
                local F="feature@userobj_accounting"
                local pool=$(zpool_name mds1)
                local feature=$(do_facet mds1 $ZPOOL get -H $F $pool)
                local F="feature@userobj_accounting"
                local pool=$(zpool_name mds1)
                local feature=$(do_facet mds1 $ZPOOL get -H $F $pool)
@@ -2210,7 +2210,7 @@ test_23_sub() {
 }
 
 test_23() {
 }
 
 test_23() {
-       [ $(facet_fstype ost1) == "zfs" ] &&
+       [ "$ost1_FSTYPE" == zfs ] &&
                skip "Overwrite in place is not guaranteed to be " \
                "space neutral on ZFS"
 
                skip "Overwrite in place is not guaranteed to be " \
                "space neutral on ZFS"
 
@@ -2651,7 +2651,7 @@ run_test 35 "Usage is still accessible across reboot"
 # chown/chgrp to the file created with MDS_OPEN_DELAY_CREATE
 # LU-5006
 test_37() {
 # chown/chgrp to the file created with MDS_OPEN_DELAY_CREATE
 # LU-5006
 test_37() {
-       [ $(lustre_version_code $SINGLEMDS) -lt $(version_code 2.6.93) ] &&
+       [ "$MDS1_VERSION" -lt $(version_code 2.6.93) ] &&
                skip "Old server doesn't have LU-5006 fix."
 
        setup_quota_test || error "setup quota failed with $?"
                skip "Old server doesn't have LU-5006 fix."
 
        setup_quota_test || error "setup quota failed with $?"
@@ -2683,7 +2683,7 @@ run_test 37 "Quota accounted properly for file created by 'lfs setstripe'"
 
 # LU-8801
 test_38() {
 
 # LU-8801
 test_38() {
-       [ $(lustre_version_code $SINGLEMDS) -lt $(version_code 2.8.60) ] &&
+       [ "$MDS1_VERSION" -lt $(version_code 2.8.60) ] &&
                skip "Old server doesn't have LU-8801 fix."
 
        [ "$UID" != 0 ] && skip_env "must run as root" && return
                skip "Old server doesn't have LU-8801 fix."
 
        [ "$UID" != 0 ] && skip_env "must run as root" && return
@@ -2712,7 +2712,7 @@ test_38() {
        cancel_lru_locks osc
        sync; sync_all_data || true
 
        cancel_lru_locks osc
        sync; sync_all_data || true
 
-       local procf="osd-$(facet_fstype $SINGLEMDS).$FSNAME-MDT0000"
+       local procf="osd-$mds1_FSTYPE.$FSNAME-MDT0000"
        procf=${procf}.quota_slave.acct_user
        local accnt_cnt
 
        procf=${procf}.quota_slave.acct_user
        local accnt_cnt
 
@@ -2976,7 +2976,7 @@ test_54() {
 run_test 54 "basic lfs project interface test"
 
 test_55() {
 run_test 54 "basic lfs project interface test"
 
 test_55() {
-       [ $(lustre_version_code $SINGLEMDS) -lt $(version_code 2.10.58) ] &&
+       [ "$MDS1_VERSION" -lt $(version_code 2.10.58) ] &&
                skip "Not supported before 2.10.58."
        setup_quota_test || error "setup quota failed with $?"
 
                skip "Not supported before 2.10.58."
        setup_quota_test || error "setup quota failed with $?"
 
@@ -3061,7 +3061,7 @@ test_57() {
 run_test 57 "lfs project could tolerate errors"
 
 test_59() {
 run_test 57 "lfs project could tolerate errors"
 
 test_59() {
-       [ "$(facet_fstype $SINGLEMDS)" != "ldiskfs" ] &&
+       [ "$mds1_FSTYPE" != ldiskfs ] &&
                skip "ldiskfs only test"
        disable_project_quota
        setup_quota_test || error "setup quota failed with $?"
                skip "ldiskfs only test"
        disable_project_quota
        setup_quota_test || error "setup quota failed with $?"
@@ -3108,7 +3108,7 @@ run_test 60 "Test quota for root with setgid"
 
 # test default quota
 test_default_quota() {
 
 # test default quota
 test_default_quota() {
-       [ $(lustre_version_code $SINGLEMDS) -lt $(version_code 2.11.51) ] &&
+       [ "$MDS1_VERSION" -lt $(version_code 2.11.51) ] &&
                skip "Not supported before 2.11.51."
 
        local qtype=$1
                skip "Not supported before 2.11.51."
 
        local qtype=$1
@@ -3303,8 +3303,8 @@ test_62() {
 run_test 62 "Project inherit should be only changed by root"
 
 test_dom() {
 run_test 62 "Project inherit should be only changed by root"
 
 test_dom() {
-       [ $(lustre_version_code $SINGLEMDS) -lt $(version_code 2.11.55) ] &&
-               skip "Not supported before 2.11.55" && return
+       [ "$MDS1_VERSION" -lt $(version_code 2.11.55) ] &&
+               skip "Not supported before 2.11.55"
 
        local qtype=$1
        local qid=$TSTUSR
 
        local qtype=$1
        local qid=$TSTUSR