From d037b8032573a02ce6d67134296ce45c0471f359 Mon Sep 17 00:00:00 2001 From: yury Date: Thu, 10 Apr 2008 14:58:33 +0000 Subject: [PATCH] b=14901 r=grev,yujian,panda - fixes issues with testing environment setup in test_72 as well in other tests with using check_runas_id() which did not return anything. Added check_runas_id_ret() which is used in cases when test needs to get error code while checking existing specific uid in test system. --- lustre/tests/acceptance-small.sh | 6 +++--- lustre/tests/sanity.sh | 9 +++++++++ lustre/tests/test-framework.sh | 24 +++++++++++++++++------- 3 files changed, 29 insertions(+), 10 deletions(-) diff --git a/lustre/tests/acceptance-small.sh b/lustre/tests/acceptance-small.sh index 6ebcf51..bb9da5a 100755 --- a/lustre/tests/acceptance-small.sh +++ b/lustre/tests/acceptance-small.sh @@ -104,7 +104,7 @@ for NAME in $CONFIGS; do $DEBUG_OFF myUID=$RUNAS_ID myRUNAS=$RUNAS - FAIL_ON_ERROR=false check_runas_id $myUID $myRUNAS || { myRUNAS="" && myUID=$UID; } + FAIL_ON_ERROR=false check_runas_id_ret $myUID $myRUNAS || { myRUNAS="" && myUID=$UID; } chown $myUID:$myUID $DBENCHDIR duration="" [ "$SLOW" = "no" ] && duration=" -t 120" @@ -139,7 +139,7 @@ for NAME in $CONFIGS; do $DEBUG_OFF myUID=$RUNAS_ID myRUNAS=$RUNAS - FAIL_ON_ERROR=false check_runas_id $myUID $myRUNAS || { myRUNAS="" && myUID=$UID; } + FAIL_ON_ERROR=false check_runas_id_ret $myUID $myRUNAS || { myRUNAS="" && myUID=$UID; } chown $myUID:$myUID $BONDIR $myRUNAS bonnie++ -f -r 0 -s$((SIZE / 1024)) -n 10 -u$myUID:$myUID -d$BONDIR $DEBUG_ON @@ -168,7 +168,7 @@ for NAME in $CONFIGS; do $DEBUG_OFF myUID=$RUNAS_ID myRUNAS=$RUNAS - FAIL_ON_ERROR=false check_runas_id $myUID $myRUNAS || { myRUNAS="" && myUID=$UID; } + FAIL_ON_ERROR=false check_runas_id_ret $myUID $myRUNAS || { myRUNAS="" && myUID=$UID; } chown $myUID:$myUID $IOZDIR $myRUNAS iozone $IOZONE_OPTS -f $IOZFILE $DEBUG_ON diff --git a/lustre/tests/sanity.sh b/lustre/tests/sanity.sh index 367995e..7ec9cf8 100644 --- a/lustre/tests/sanity.sh +++ b/lustre/tests/sanity.sh @@ -3016,6 +3016,15 @@ run_test 71 "Running dbench on lustre (don't segment fault) ====" test_72() { # bug 5695 - Test that on 2.6 remove_suid works properly check_kernel_version 43 || return 0 + + # Check that testing environment is properly set up. Skip if not + OLD_FAIL_ON_ERROR=$FAIL_ON_ERROR + FAIL_ON_ERROR=false check_runas_id_ret $(($RUNAS_ID + 1)) "$RUNAS -u $(($RUNAS_ID + 1))" || { + skip "User $((RUNAS_ID + 1)) does not exist - skipping" + FAIL_ON_ERROR=$OLD_FAIL_ON_ERROR + return 0 + } + FAIL_ON_ERROR=$OLD_FAIL_ON_ERROR [ "$RUNAS_ID" = "$UID" ] && skip "RUNAS_ID = UID = $UID -- skipping" && return # We had better clear the $DIR to get enough space for dd rm -rf $DIR/* diff --git a/lustre/tests/test-framework.sh b/lustre/tests/test-framework.sh index 70355b3..22d018a 100644 --- a/lustre/tests/test-framework.sh +++ b/lustre/tests/test-framework.sh @@ -1577,24 +1577,34 @@ is_patchless () lctl get_param version | grep -q patchless } -check_runas_id() { +check_runas_id_ret() { + local myRC=0 local myRUNAS_ID=$1 shift local myRUNAS=$@ - + if [ -z "$myRUNAS" ]; then + error_exit "myRUNAS command must be specified for check_runas_id" + fi if $GSS_KRB5; then $myRUNAS krb5_login.sh || \ error "Failed to refresh Kerberos V5 TGT for UID $myRUNAS_ID." fi - mkdir $DIR/d0_runas_test chmod 0755 $DIR chown $myRUNAS_ID:$myRUNAS_ID $DIR/d0_runas_test - $myRUNAS touch $DIR/d0_runas_test/f$$ || \ - error "unable to write to $DIR/d0_runas_test as UID $myRUNAS_ID. - Please set RUNAS_ID to some UID which exists on MDS and client or - add user $myRUNAS_ID:$myRUNAS_ID on these nodes." + $myRUNAS touch $DIR/d0_runas_test/f$$ || myRC=$? rm -rf $DIR/d0_runas_test + return $myRC +} + +check_runas_id() { + local myRUNAS_ID=$1 + shift + local myRUNAS=$@ + check_runas_id_ret $myRUNAS_ID $myRUNAS || \ + error "unable to write to $DIR/d0_runas_test as UID $myRUNAS_ID. + Please set RUNAS_ID to some UID which exists on MDS and client or + add user $myRUNAS_ID:$myRUNAS_ID on these nodes." } # Run multiop in the background, but wait for it to print -- 1.8.3.1