Whamcloud - gitweb
LU-14687 llite: Return errors for aio
[fs/lustre-release.git] / lustre / tests / sanity-selinux.sh
index 0403a3c..8349625 100755 (executable)
 set -e
 
 ONLY=${ONLY:-"$*"}
-# bug number for skipped test:
-ALWAYS_EXCEPT=${ALWAYS_EXCEPT:-"$SANITY_SELINUX_EXCEPT"}
-# UPDATE THE COMMENT ABOVE WITH BUG NUMBERS WHEN CHANGING ALWAYS_EXCEPT!
-
-SRCDIR=$(dirname $0)
-SAVE_PWD=$PWD
 
 LUSTRE=${LUSTRE:-$(dirname $0)/..}
 . $LUSTRE/tests/test-framework.sh
 init_test_env $@
-. ${CONFIG:=$LUSTRE/tests/cfg/$NAME.sh}
 init_logging
 
-require_dsh_mds || exit 0
+ALWAYS_EXCEPT="$SANITY_SELINUX_EXCEPT"
 
 [ "$SLOW" = "no" ] && EXCEPT_SLOW="xxx"
 
+build_test_filter
+
+require_dsh_mds || exit 0
+
 RUNAS_CMD=${RUNAS_CMD:-runas}
 # $RUNAS_ID may get set incorrectly somewhere else
 [ $UID -eq 0 -a $RUNAS_ID -eq 0 ] &&
@@ -69,8 +66,6 @@ rm -rf $DIR/[df][0-9]*
 
 check_runas_id $RUNAS_ID $RUNAS_ID $RUNAS
 
-build_test_filter
-
 umask 077
 
 check_selinux_xattr() {
@@ -549,7 +544,9 @@ create_nodemap() {
        check_nodemap $nm trusted_nodemap 1
 
        sleep 10
+       l_getsepol || error "cannot get sepol"
        sepol=$(l_getsepol | cut -d':' -f2- | xargs)
+       [ -n "$sepol" ] || error "sepol is empty"
        do_facet mgs $LCTL set_param -P nodemap.$nm.sepol="$sepol"
 
        check_nodemap $nm sepol $sepol
@@ -642,6 +639,9 @@ test_21b() {
        [ "$MDS1_VERSION" -lt $(version_code 2.11.56) ] &&
                skip "Need MDS >= 2.11.56"
 
+       stack_trap "restore_opencache" EXIT
+       disable_opencache
+
        local sepol
 
        mkdir -p $DIR/$tdir || error "failed to create $DIR/$tdir"
@@ -754,7 +754,9 @@ test_21b() {
        ln $DIR/$tdir/toopen $DIR/$tdir/toopen_hl3 && error "hardlink (3)"
 
        # reset correct sepol
+       l_getsepol || error "cannot get sepol"
        sepol=$(l_getsepol | cut -d':' -f2- | xargs)
+       [ -n "$sepol" ] || error "sepol is empty"
        do_facet mgs $LCTL set_param -P nodemap.c0.sepol="$sepol"
        check_nodemap c0 sepol $sepol