From 47df77069e5fe18e83781d7e86d7a8cfefc5b40b Mon Sep 17 00:00:00 2001 From: Elena Gryaznova Date: Fri, 30 Jul 2010 19:00:45 +0400 Subject: [PATCH] b=14242 test_6g fails when b_release_1_6_4 is run on Cray XT3 i=Andreas.Dilger acceptance-small test-framework RUNAS_GID changes --- lustre/tests/acceptance-small.sh | 20 +++++++++++++------- lustre/tests/cfg/local.sh | 4 +++- lustre/tests/replay-vbr.sh | 24 ++++++++++++------------ lustre/tests/sanity-benchmark.sh | 20 +++++++++++++------- lustre/tests/sanity.sh | 26 +++++++++++++------------- lustre/tests/sanityN.sh | 10 +++++----- 6 files changed, 59 insertions(+), 45 deletions(-) diff --git a/lustre/tests/acceptance-small.sh b/lustre/tests/acceptance-small.sh index da001eb..addbb4b 100755 --- a/lustre/tests/acceptance-small.sh +++ b/lustre/tests/acceptance-small.sh @@ -137,9 +137,11 @@ for NAME in $CONFIGS; do $DEBUG_OFF myUID=$RUNAS_ID + myGID=$RUNAS_GID myRUNAS=$RUNAS - FAIL_ON_ERROR=false check_runas_id_ret $myUID $myUID $myRUNAS || { myRUNAS="" && myUID=$UID; } - chown $myUID:$myUID $DBENCHDIR + FAIL_ON_ERROR=false check_runas_id_ret $myUID $myGID $myRUNAS || \ + { myRUNAS="" && myUID=$UID && myGID=`id -g $USER`; } + chown $myUID:$myGID $DBENCHDIR duration="" [ "$SLOW" = "no" ] && duration=" -t 120" if [ "$SLOW" != "no" -o $DB_THREADS -eq 1 ]; then @@ -172,10 +174,12 @@ for NAME in $CONFIGS; do log "min OST has ${MIN}kB available, using ${SIZE}kB file size" $DEBUG_OFF myUID=$RUNAS_ID + myGID=$RUNAS_GID myRUNAS=$RUNAS - FAIL_ON_ERROR=false check_runas_id_ret $myUID $myUID $myRUNAS || { myRUNAS="" && myUID=$UID; } - chown $myUID:$myUID $BONDIR - $myRUNAS bonnie++ -f -r 0 -s$((SIZE / 1024)) -n 10 -u$myUID:$myUID -d$BONDIR + FAIL_ON_ERROR=false check_runas_id_ret $myUID $myGID $myRUNAS || \ + { myRUNAS="" && myUID=$UID && myGID=`id -g $USER`; } + chown $myUID:$myGID $BONDIR + $myRUNAS bonnie++ -f -r 0 -s$((SIZE / 1024)) -n 10 -u$myUID:$myGID -d$BONDIR $DEBUG_ON $CLEANUP $SETUP @@ -202,9 +206,11 @@ for NAME in $CONFIGS; do # $SPACE was calculated with all OSTs $DEBUG_OFF myUID=$RUNAS_ID + myGID=$RUNAS_GID myRUNAS=$RUNAS - FAIL_ON_ERROR=false check_runas_id_ret $myUID $myUID $myRUNAS || { myRUNAS="" && myUID=$UID; } - chown $myUID:$myUID $IOZDIR + FAIL_ON_ERROR=false check_runas_id_ret $myUID $myGID $myRUNAS || \ + { myRUNAS="" && myUID=$UID && myGID=`id -g $USER`; } + chown $myUID:$myGID $IOZDIR $myRUNAS iozone $IOZONE_OPTS -s $SIZE -f $IOZFILE 2>&1 | tee $IOZLOG tail -1 $IOZLOG | grep -q complete || \ { error "iozone (1) failed" && false; } diff --git a/lustre/tests/cfg/local.sh b/lustre/tests/cfg/local.sh index 55c216f..fd1f60f 100644 --- a/lustre/tests/cfg/local.sh +++ b/lustre/tests/cfg/local.sh @@ -94,10 +94,12 @@ DIR2=${DIR2:-$MOUNT2} if [ $UID -ne 0 ]; then log "running as non-root uid $UID" RUNAS_ID="$UID" + RUNAS_GID=`id -g $USER` RUNAS="" else RUNAS_ID=${RUNAS_ID:-500} - RUNAS=${RUNAS:-"runas -u $RUNAS_ID"} + RUNAS_GID=${RUNAS_GID:-$RUNAS_ID} + RUNAS=${RUNAS:-"runas -u $RUNAS_ID -g $RUNAS_GID"} fi FAILURE_MODE=${FAILURE_MODE:-SOFT} # or HARD diff --git a/lustre/tests/replay-vbr.sh b/lustre/tests/replay-vbr.sh index ddb3337..602c662 100644 --- a/lustre/tests/replay-vbr.sh +++ b/lustre/tests/replay-vbr.sh @@ -212,7 +212,7 @@ test_0h() { do_node $CLIENT1 mcreate $file pre=$(get_version $CLIENT1 $file) - do_node $CLIENT1 chown $RUNAS_ID $file + do_node $CLIENT1 chown $RUNAS_ID:$RUNAS_GID $file post=$(get_version $CLIENT1 $file) if (($pre == $post)); then error "version not changed: pre $pre, post $post" @@ -227,7 +227,7 @@ test_0i() { do_node $CLIENT1 mcreate $file pre=$(get_version $CLIENT1 $file) - do_node $CLIENT1 chown :$RUNAS_ID $file + do_node $CLIENT1 chgrp $RUNAS_GID $file post=$(get_version $CLIENT1 $file) if (($pre == $post)); then error "version not changed: pre $pre, post $post" @@ -242,8 +242,8 @@ test_0j() { do_node $CLIENT1 mcreate $file replay_barrier mds - do_node $CLIENT2 chown :$RUNAS_ID $file - do_node $CLIENT1 chown $RUNAS_ID $file + do_node $CLIENT2 chgrp $RUNAS_GID $file + do_node $CLIENT1 chown $RUNAS_ID:$RUNAS_GID $file zconf_umount $CLIENT2 $MOUNT facet_failover mds @@ -262,8 +262,8 @@ test_0k() { do_node $CLIENT1 mcreate $file replay_barrier mds - do_node $CLIENT2 chown $RUNAS_ID $file - do_node $CLIENT1 chown :$RUNAS_ID $file + do_node $CLIENT2 chown $RUNAS_ID:$RUNAS_GID $file + do_node $CLIENT1 chgrp $RUNAS_GID $file zconf_umount $CLIENT2 $MOUNT facet_failover mds @@ -297,7 +297,7 @@ test_0m() { do_node $CLIENT1 openfile -f O_RDWR:O_CREAT -m 0644 $file replay_barrier mds - do_node $CLIENT2 chown :$RUNAS_ID $file + do_node $CLIENT2 chgrp $RUNAS_GID $file do_node $CLIENT1 chmod 666 $file zconf_umount $CLIENT2 $MOUNT facet_failover mds @@ -669,11 +669,11 @@ test_2b() { replay_barrier mds do_node $CLIENT1 chmod 666 $DIR/$tfile-a # R do_node $CLIENT2 chmod 666 $DIR1/$tfile-b # R - do_node $CLIENT2 chown :$RUNAS_ID $DIR2/$tfile-a # U - do_node $CLIENT1 chown $RUNAS_ID $DIR/$tfile-a # J + do_node $CLIENT2 chgrp $RUNAS_GID $DIR2/$tfile-a # U + do_node $CLIENT1 chown $RUNAS_ID:$RUNAS_GID $DIR/$tfile-a # J do_node $CLIENT2 truncate $DIR2/$tfile-b 1 # U - do_node $CLIENT2 chown :$RUNAS_ID $DIR1/$tfile-b # R - do_node $CLIENT1 chown $RUNAS_ID $DIR/$tfile-b # R + do_node $CLIENT2 chgrp $RUNAS_GID $DIR1/$tfile-b # R + do_node $CLIENT1 chown $RUNAS_ID:$RUNAS_GID $DIR/$tfile-b # R zconf_umount $CLIENT2 $MOUNT2 facet_failover mds @@ -698,7 +698,7 @@ test_2b() { do_node $CLIENT2 $CHECKSTAT -p 0666 -u \\\#$UID -g \\\#$UID \ $DIR1/$tfile-a || error "$DIR/$tfile-a: unexpected state" - do_node $CLIENT2 $CHECKSTAT -p 0666 -u \\\#$RUNAS_ID -g \\\#$RUNAS_ID \ + do_node $CLIENT2 $CHECKSTAT -p 0666 -u \\\#$RUNAS_ID -g \\\#$RUNAS_GID \ $DIR1/$tfile-b || error "$DIR/$tfile-b: unexpected state" zconf_umount $CLIENT2 $MOUNT1 diff --git a/lustre/tests/sanity-benchmark.sh b/lustre/tests/sanity-benchmark.sh index 31a9ffe..e48a5d9 100644 --- a/lustre/tests/sanity-benchmark.sh +++ b/lustre/tests/sanity-benchmark.sh @@ -56,9 +56,11 @@ test_dbench() { $DEBUG_OFF myUID=$RUNAS_ID + myGID=$RUNAS_GID myRUNAS=$RUNAS - FAIL_ON_ERROR=false check_runas_id_ret $myUID $myUID $myRUNAS || { myRUNAS="" && myUID=$UID; } - chown $myUID:$myUID $DBENCHDIR + FAIL_ON_ERROR=false check_runas_id_ret $myUID $myGID $myRUNAS || \ + { myRUNAS="" && myUID=$UID && myGID=`id -g $USER`; } + chown $myUID:$myGID $DBENCHDIR local duration="" [ "$SLOW" = "no" ] && duration=" -t 120" if [ "$SLOW" != "no" -o $DB_THREADS -eq 1 ]; then @@ -89,10 +91,12 @@ test_bonnie() { log "min OST has ${MIN}kB available, using ${SIZE}kB file size" $DEBUG_OFF myUID=$RUNAS_ID + myGID=$RUNAS_GID myRUNAS=$RUNAS - FAIL_ON_ERROR=false check_runas_id_ret $myUID $myUID $myRUNAS || { myRUNAS="" && myUID=$UID; } - chown $myUID:$myUID $BONDIR - $myRUNAS bonnie++ -f -r 0 -s$((SIZE / 1024)) -n 10 -u$myUID:$myUID -d$BONDIR + FAIL_ON_ERROR=false check_runas_id_ret $myUID $myGID $myRUNAS || \ + { myRUNAS="" && myUID=$UID && myGID=`id -$USER`; } + chown $myUID:$myGID $BONDIR + $myRUNAS bonnie++ -f -r 0 -s$((SIZE / 1024)) -n 10 -u$myUID:$myGID -d$BONDIR $DEBUG_ON } run_test bonnie "bonnie++" @@ -119,9 +123,11 @@ test_iozone() { # $SPACE was calculated with all OSTs $DEBUG_OFF myUID=$RUNAS_ID + myGID=$RUNAS_GID myRUNAS=$RUNAS - FAIL_ON_ERROR=false check_runas_id_ret $myUID $myUID $myRUNAS || { myRUNAS="" && myUID=$UID; } - chown $myUID:$myUID $IOZDIR + FAIL_ON_ERROR=false check_runas_id_ret $myUID $myGID $myRUNAS || \ + { myRUNAS="" && myUID=$UID && myGID=`id -g $USER`; } + chown $myUID:$myGID $IOZDIR $myRUNAS iozone $IOZONE_OPTS -s $SIZE -f $IOZFILE 2>&1 | tee $IOZLOG tail -1 $IOZLOG | grep -q complete || \ { error "iozone (1) failed" && return 1; } diff --git a/lustre/tests/sanity.sh b/lustre/tests/sanity.sh index 1a0226f..c472421 100644 --- a/lustre/tests/sanity.sh +++ b/lustre/tests/sanity.sh @@ -123,7 +123,7 @@ rm -rf $DIR/[Rdfs][0-9]* # $RUNAS_ID may get set incorrectly somewhere else [ $UID -eq 0 -a $RUNAS_ID -eq 0 ] && error "\$RUNAS_ID set to 0, but \$UID is also 0!" -check_runas_id $RUNAS_ID $RUNAS_ID $RUNAS +check_runas_id $RUNAS_ID $RUNAS_GID $RUNAS build_test_filter @@ -291,16 +291,16 @@ test_6g() { $RUNAS mkdir $DIR/d6g/d || error chmod g+s $DIR/d6g/d || error mkdir $DIR/d6g/d/subdir - $CHECKSTAT -g \#$RUNAS_ID $DIR/d6g/d/subdir || error + $CHECKSTAT -g \#$RUNAS_GID $DIR/d6g/d/subdir || error } run_test 6g "Is new dir in sgid dir inheriting group?" test_6h() { # bug 7331 [ $RUNAS_ID -eq $UID ] && skip_env "RUNAS_ID = UID = $UID -- skipping" && return touch $DIR/f6h || error "touch failed" - chown $RUNAS_ID:$RUNAS_ID $DIR/f6h || error "initial chown failed" - $RUNAS -G$RUNAS_ID chown $RUNAS_ID:0 $DIR/f6h && error "chown worked" - $CHECKSTAT -t file -u \#$RUNAS_ID -g \#$RUNAS_ID $DIR/f6h || error + chown $RUNAS_ID:$RUNAS_GID $DIR/f6h || error "initial chown failed" + $RUNAS -G$RUNAS_GID chown $RUNAS_ID:0 $DIR/f6h && error "chown worked" + $CHECKSTAT -t file -u \#$RUNAS_ID -g \#$RUNAS_GID $DIR/f6h || error } run_test 6h "$RUNAS chown RUNAS_ID.0 .../f6h (should return error)" @@ -540,13 +540,13 @@ run_test 21 "write to dangling link ============================" test_22() { WDIR=$DIR/$tdir mkdir -p $WDIR - chown $RUNAS_ID $WDIR + chown $RUNAS_ID:$RUNAS_GID $WDIR (cd $WDIR || error "cd $WDIR failed"; $RUNAS tar cf - /etc/hosts /etc/sysconfig/network | \ $RUNAS tar xf -) ls -lR $WDIR/etc || error "ls -lR $WDIR/etc failed" $CHECKSTAT -t dir $WDIR/etc || error "checkstat -t dir failed" - $CHECKSTAT -u \#$RUNAS_ID $WDIR/etc || error "checkstat -u failed" + $CHECKSTAT -u \#$RUNAS_ID -g \#$RUNAS_GID $WDIR/etc || error "checkstat -u failed" } run_test 22 "unpack tar archive as non-root user ===============" @@ -2826,14 +2826,14 @@ test_56q() { setup_56 $NUMFILES $NUMDIRS - chgrp $RUNAS_ID $TDIR/file* || error "chown $DIR/${tdir}g/file$i failed" + chgrp $RUNAS_GID $TDIR/file* || error "chown $DIR/${tdir}g/file$i failed" EXPECTED=$NUMFILES - NUMS="`$LFIND -gid $RUNAS_ID $TDIR | wc -l`" + NUMS="`$LFIND -gid $RUNAS_GID $TDIR | wc -l`" [ $NUMS -eq $EXPECTED ] || \ error "lfs find -gid $TDIR wrong: found $NUMS, expected $EXPECTED" EXPECTED=$(( ($NUMFILES+1) * $NUMDIRS + 1)) - NUMS="`$LFIND ! -gid $RUNAS_ID $TDIR | wc -l`" + NUMS="`$LFIND ! -gid $RUNAS_GID $TDIR | wc -l`" [ $NUMS -eq $EXPECTED ] || \ error "lfs find ! -gid $TDIR wrong: found $NUMS, expected $EXPECTED" @@ -3223,8 +3223,8 @@ test_67a() { # was test_67 bug 3285 - supplementary group fails on MDS, passes o check_kernel_version 35 || return 0 mkdir -p $DIR/$tdir chmod 771 $DIR/$tdir - chgrp $RUNAS_ID $DIR/$tdir - $RUNAS -u $RUNAS_ID -g $(($RUNAS_ID + 1)) -G1,2,$RUNAS_ID ls $DIR/$tdir + chgrp $RUNAS_GID $DIR/$tdir + $RUNAS -u $RUNAS_ID -g $(($RUNAS_GID + 1)) -G1,2,$RUNAS_GID ls $DIR/$tdir RC=$? GROUP_UPCALL=$(do_facet mds lctl get_param -n mds.*.group_upcall) [ -z "$GROUP_UPCALL" ] && \ @@ -3379,7 +3379,7 @@ test_72() { # bug 5695 - Test that on 2.6 remove_suid works properly [ "$RUNAS_ID" = "$UID" ] && skip_env "RUNAS_ID = UID = $UID -- skipping" && return # Check that testing environment is properly set up. Skip if not - FAIL_ON_ERROR=false check_runas_id_ret $RUNAS_ID $RUNAS_ID $RUNAS || { + FAIL_ON_ERROR=false check_runas_id_ret $RUNAS_ID $RUNAS_GID $RUNAS || { skip_env "User $RUNAS_ID does not exist - skipping" return 0 } diff --git a/lustre/tests/sanityN.sh b/lustre/tests/sanityN.sh index 1d4ac91..922b4ff 100644 --- a/lustre/tests/sanityN.sh +++ b/lustre/tests/sanityN.sh @@ -61,7 +61,7 @@ rm -rf $DIR1/[df][0-9]* $DIR1/lnk # $RUNAS_ID may get set incorrectly somewhere else [ $UID -eq 0 -a $RUNAS_ID -eq 0 ] && error "\$RUNAS_ID set to 0, but \$UID is also 0!" -check_runas_id $RUNAS_ID $RUNAS_ID $RUNAS +check_runas_id $RUNAS_ID $RUNAS_GID $RUNAS build_test_filter @@ -483,13 +483,13 @@ test_25() { chmod 0755 $DIR1/$tdir/f1 || error "chmod 0755 $DIR1/$tdir/f1" $RUNAS $CHECKSTAT $DIR2/$tdir/f1 || error "checkstat $DIR2/$tdir/f1 #1" - setfacl -m u:$RUNAS_ID:--- $DIR1/$tdir || error "setfacl $DIR2/$tdir #1" + setfacl -m u:$RUNAS_ID:--- -m g:$RUNAS_GID:--- $DIR1/$tdir || error "setfacl $DIR2/$tdir #1" $RUNAS $CHECKSTAT $DIR2/$tdir/f1 && error "checkstat $DIR2/$tdir/f1 #2" - setfacl -m u:$RUNAS_ID:r-x $DIR1/$tdir || error "setfacl $DIR2/$tdir #2" + setfacl -m u:$RUNAS_ID:r-x -m g:$RUNAS_GID:r-x $DIR1/$tdir || error "setfacl $DIR2/$tdir #2" $RUNAS $CHECKSTAT $DIR2/$tdir/f1 || error "checkstat $DIR2/$tdir/f1 #3" - setfacl -m u:$RUNAS_ID:--- $DIR1/$tdir || error "setfacl $DIR2/$tdir #3" + setfacl -m u:$RUNAS_ID:--- -m g:$RUNAS_GID:--- $DIR1/$tdir || error "setfacl $DIR2/$tdir #3" $RUNAS $CHECKSTAT $DIR2/$tdir/f1 && error "checkstat $DIR2/$tdir/f1 #4" - setfacl -x u:$RUNAS_ID: $DIR1/$tdir || error "setfacl $DIR2/$tdir #4" + setfacl -x u:$RUNAS_ID: -x g:$RUNAS_GID: $DIR1/$tdir || error "setfacl $DIR2/$tdir #4" $RUNAS $CHECKSTAT $DIR2/$tdir/f1 || error "checkstat $DIR2/$tdir/f1 #5" rm -rf $DIR1/$tdir -- 1.8.3.1