+export NUMTEST=70000
+test_51b() {
+ NUMFREE=`df -i -P $DIR | tail -n 1 | awk '{ print $4 }'`
+ [ $NUMFREE -lt 21000 ] && \
+ echo "skipping test 51b, not enough free inodes($NUMFREE)" && \
+ return
+
+ check_kernel_version 40 || NUMTEST=31000
+ [ $NUMFREE -lt $NUMTEST ] && NUMTEST=$(($NUMFREE - 50))
+
+ mkdir -p $DIR/d51b
+ (cd $DIR/d51b; mkdirmany t $NUMTEST)
+}
+run_test 51b "mkdir .../t-0 --- .../t-$NUMTEST ===================="
+
+test_51c() {
+ NUMTEST=70000
+ check_kernel_version 40 || NUMTEST=31000
+ NUMFREE=`df -i -P $DIR | tail -n 1 | awk '{ print $4 }'`
+ [ $NUMFREE -lt $NUMTEST ] && echo "skipping test 51c" && return
+ mkdir -p $DIR/d51b
+ (cd $DIR/d51b; rmdirmany t $NUMTEST)
+}
+run_test 51c "rmdir .../t-0 --- .../t-$NUMTEST ===================="
+
+test_52a() {
+ [ -f $DIR/d52a/foo ] && chattr -a $DIR/d52a/foo
+ mkdir -p $DIR/d52a
+ touch $DIR/d52a/foo
+ chattr =a $DIR/d52a/foo || error
+ echo bar >> $DIR/d52a/foo || error
+ cp /etc/hosts $DIR/d52a/foo && error
+ rm -f $DIR/d52a/foo 2>/dev/null && error
+ link $DIR/d52a/foo $DIR/d52a/foo_link 2>/dev/null && error
+ echo foo >> $DIR/d52a/foo || error
+ mrename $DIR/d52a/foo $DIR/d52a/foo_ren && error
+ lsattr $DIR/d52a/foo | egrep -q "^-+a-+ $DIR/d52a/foo" || error
+ chattr -a $DIR/d52a/foo || error
+
+ rm -fr $DIR/d52a || error
+}
+run_test 52a "append-only flag test (should return errors) ====="
+
+test_52b() {
+ [ -f $DIR/d52b/foo ] && chattr -i $DIR/d52b/foo
+ mkdir -p $DIR/d52b
+ touch $DIR/d52b/foo
+ chattr =i $DIR/d52b/foo || error
+ cat test > $DIR/d52b/foo && error
+ cp /etc/hosts $DIR/d52b/foo && error
+ rm -f $DIR/d52b/foo 2>/dev/null && error
+ link $DIR/d52b/foo $DIR/d52b/foo_link 2>/dev/null && error
+ echo foo >> $DIR/d52b/foo && error
+ mrename $DIR/d52b/foo $DIR/d52b/foo_ren && error
+ [ -f $DIR/d52b/foo ] || error
+ [ -f $DIR/d52b/foo_ren ] && error
+ lsattr $DIR/d52b/foo | egrep -q "^-+i-+ $DIR/d52b/foo" || error
+ chattr -i $DIR/d52b/foo || error
+
+ rm -fr $DIR/d52b || error
+}
+run_test 52b "immutable flag test (should return errors) ======="
+
+test_53() {
+ for i in `ls -d /proc/fs/lustre/osc/OSC*mds1 2> /dev/null` ; do
+ ostname=`echo $i | cut -d _ -f 3-4 | sed -e s/_mds1//`
+ ost_last=`cat /proc/fs/lustre/obdfilter/$ostname/last_id`
+ mds_last=`cat $i/prealloc_last_id`
+ echo "$ostname.last_id=$ost_last ; MDS.last_id=$mds_last"
+ if [ $ost_last != $mds_last ]; then
+ error "$ostname.last_id=$ost_last ; MDS.last_id=$mds_last"
+ fi
+ done
+}
+run_test 53 "verify that MDS and OSTs agree on pre-creation ===="
+
+test_54a() {
+ $SOCKETSERVER $DIR/socket
+ $SOCKETCLIENT $DIR/socket || error
+ $MUNLINK $DIR/socket
+}
+run_test 54a "unix damain socket test =========================="
+
+test_54b() {
+ f="$DIR/f54b"
+ mknod $f c 1 3
+ chmod 0666 $f
+ dd if=/dev/zero of=$f bs=`page_size` count=1
+}
+run_test 54b "char device works in lustre ======================"
+
+find_loop_dev() {
+ [ "$LOOPNUM" ] && return
+ [ -b /dev/loop/0 ] && LOOPBASE=/dev/loop/
+ [ -b /dev/loop0 ] && LOOPBASE=/dev/loop
+ [ -z "$LOOPBASE" ] && echo "/dev/loop/0 and /dev/loop0 gone?" && return
+
+ for i in `seq 3 7`; do
+ losetup $LOOPBASE$i > /dev/null 2>&1 && continue
+ LOOPDEV=$LOOPBASE$i
+ LOOPNUM=$i
+ break
+ done
+}
+
+test_54c() {
+ tfile="$DIR/f54c"
+ tdir="$DIR/d54c"
+ loopdev="$DIR/loop54c"
+
+ find_loop_dev
+ [ -z "$LOOPNUM" ] && echo "couldn't find empty loop device" && return
+ mknod $loopdev b 7 $LOOPNUM
+ echo "make a loop file system with $tfile on $loopdev ($LOOPNUM)..."
+
+ dd if=/dev/zero of=$tfile bs=`page_size` seek=1024 count=1 > /dev/null
+ losetup $loopdev $tfile || error "can't set up $loopdev for $tfile"
+ mkfs.ext2 $loopdev || error "mke2fs on $loopdev"
+ mkdir -p $tdir
+ mount -t ext2 $loopdev $tdir || error "error mounting $loopdev on $tdir"
+ dd if=/dev/zero of=$tdir/tmp bs=`page_size` count=30 || error "dd write"
+ df $tdir
+ dd if=$tdir/tmp of=/dev/zero bs=`page_size` count=30 || error "dd read"
+ umount $tdir
+ losetup -d $loopdev
+ rm $loopdev
+}
+run_test 54c "block device works in lustre ====================="
+
+test_54d() {
+ f="$DIR/f54d"
+ string="aaaaaa"
+ mknod $f p
+ [ "$string" = `echo $string > $f | cat $f` ] || error
+}
+run_test 54d "fifo device works in lustre ======================"
+
+check_fstype() {
+ test "x$FSTYPE" = "x$(grep $FSTYPE /proc/filesystems)" && return 0
+ modprobe $FSTYPE > /dev/null 2>&1
+ test "x$FSTYPE" = "x$(grep $FSTYPE /proc/filesystems)" && return 0
+ test "x$(uname -r | grep -o '2.6')" = "x2.6" && MODEXT="ko" || MODEXT="o"
+ insmod ../$FSTYPE/$FSTYPE.$MODEXT > /dev/null 2>&1
+ test "x$FSTYPE" = "x$(grep $FSTYPE /proc/filesystems)" && return 0
+ return 1
+}
+
+test_55() {
+ rm -rf $DIR/d55
+ mkdir $DIR/d55
+ check_fstype && echo "can't find fs $FSTYPE, skipping test 55" && return
+ if [ "$FSTYPE" == "smfs" ] ; then
+ mount -t $MDS_BACKFSTYPE -o loop,iopen $EXT2_DEV $DIR/d55 || error "mounting"
+ else
+ mount -t $FSTYPE -o loop,iopen $EXT2_DEV $DIR/d55 || error "mounting"
+ fi
+ touch $DIR/d55/foo
+ $IOPENTEST1 $DIR/d55/foo $DIR/d55 || error "running $IOPENTEST1"
+ $IOPENTEST2 $DIR/d55 || error "running $IOPENTEST2"
+ echo "check for $EXT2_DEV. Please wait..."
+ rm -rf $DIR/d55/*
+ umount $DIR/d55 || error "unmounting"
+}
+run_test 55 "check iopen_connect_dentry() ======================"
+
+test_56() {
+ rm -rf $DIR/d56
+ mkdir $DIR/d56
+ mkdir $DIR/d56/dir
+ NUMFILES=3
+ NUMFILESx2=$(($NUMFILES * 2))
+ for i in `seq 1 $NUMFILES` ; do
+ touch $DIR/d56/file$i
+ touch $DIR/d56/dir/file$i
+ done
+
+ # test lfs find with --recursive
+ FILENUM=`$LFIND --recursive $DIR/d56 | grep -v OBDS | grep -c obdidx`
+ [ $FILENUM -eq $NUMFILESx2 ] || error \
+ "lfs find --recursive $DIR/d56 wrong: found $FILENUM, expected $NUMFILESx2"
+ FILENUM=`$LFIND $DIR/d56 | grep -v OBDS | grep -c obdidx`
+ [ $FILENUM -eq $NUMFILES ] || error \
+ "lfs find $DIR/d56 without --recursive wrong: found $FILENUM,
+ expected $NUMFILES"
+ echo "lfs find --recursive passed."
+
+ # test lfs find with file instead of dir
+ FILENUM=`$LFIND $DIR/d56/file1 | grep -v OBDS | grep -c obdidx`
+ [ $FILENUM -eq 1 ] || error \
+ "lfs find $DIR/d56/file1 wrong: found $FILENUM, expected 1"
+ echo "lfs find file passed."
+
+ #test lfs find with --verbose
+ [ `$LFIND --verbose $DIR/d56 | grep -v OBDS | grep -c lmm_magic` -eq $NUMFILES ] ||\
+ error "lfs find --verbose $DIR/d56 wrong: should find $NUMFILES lmm_magic info"
+ [ `$LFIND $DIR/d56 | grep -v OBDS | grep -c lmm_magic` -eq 0 ] || error \
+ "lfs find $DIR/d56 without --verbose wrong: should not show lmm_magic info"
+ echo "lfs find --verbose passed."
+
+ #test lfs find with --obd
+ $LFIND --obd wrong_uuid $DIR/d56 2>&1 | grep -q "unknown obduuid" || \
+ error "lfs find --obd wrong_uuid should return error information"
+
+ [ "$OSTCOUNT" -lt 2 ] && \
+ echo "skipping other lfs find --obd test" && return
+ FILENUM=`$LFIND --recursive $DIR/d56 | grep -v OBDS | grep obdidx | wc -l`
+ OBDUUID=`$LFIND --recursive $DIR/d56 | grep -A 1 OBDS | grep -v OBDS | awk '{print $3}'`
+ OBDIDX=`$LFIND --recursive $DIR/d56 | grep -A 1 OBDS | grep -v OBDS | awk '{print $1}'`
+ FOUND=`$LFIND --recursive --obd $OBDUUID $DIR/d56 | wc -l`
+
+ [ $FOUND -eq $FILENUM ] || \
+ error "lfs find --obd wrong: found $FOUND, expected $FILENUM"
+
+ [ `$LFIND -r -v --obd $OBDUUID $DIR/d56 | grep "^[[:blank:]]*$OBDIDX" | wc -l` ] || \
+ error "lfs find --obd wrong: should not show file on other obd"
+
+ echo "lfs find --obd passed."
+}
+run_test 56 "check lfs find ===================================="
+
+test_57a() {
+ # note test will not do anything if MDS is not local
+ for DEV in `cat /proc/fs/lustre/mds/*/mntdev`; do
+ dumpe2fs -hf $DEV > $TMP/t57a.dump || error "can't access $DEV"
+ DEVISIZE=`awk '/Inode size:/ { print $3 }' $TMP/t57a.dump`
+ [ "$DEVISIZE" -gt 128 ] || error "inode size $DEVISIZE"
+ rm $TMP/t57a.dump
+ done
+}
+run_test 57a "verify MDS filesystem created with large inodes =="
+
+test_57b() {
+ FILECOUNT=100
+ FILE1=$DIR/d57b/f1
+ FILEN=$DIR/d57b/f$FILECOUNT
+ rm -rf $DIR/d57b || error "removing $DIR/d57b"
+ mkdir -p $DIR/d57b || error "creating $DIR/d57b"
+ echo "mcreating $FILECOUNT files"
+ createmany -m $DIR/d57b/f 1 $FILECOUNT || \
+ error "creating files in $DIR/d57b"
+
+ # verify that files do not have EAs yet
+ $LFIND $FILE1 2>&1 | grep -q "no stripe" || error "$FILE1 has an EA"
+ $LFIND $FILEN 2>&1 | grep -q "no stripe" || error "$FILEN has an EA"
+
+ MDSFREE="`cat /proc/fs/lustre/mds/*/kbytesfree`"
+ MDCFREE="`cat /proc/fs/lustre/mdc/*/kbytesfree`"
+ echo "opening files to create objects/EAs"
+ for FILE in `seq -f $DIR/d57b/f%g 1 $FILECOUNT`; do
+ $OPENFILE -f O_RDWR $FILE > /dev/null || error "opening $FILE"
+ done
+
+ # verify that files have EAs now
+ $LFIND $FILE1 | grep -q "obdidx" || error "$FILE1 missing EA"
+ $LFIND $FILEN | grep -q "obdidx" || error "$FILEN missing EA"
+
+ MDSFREE2="`cat /proc/fs/lustre/mds/*/kbytesfree`"
+ MDCFREE2="`cat /proc/fs/lustre/mdc/*/kbytesfree`"
+
+ if [ "$MDCFREE" != "$MDCFREE2" ]; then
+ if [ "$MDSFREE" != "$MDSFREE2" ]; then
+ error "MDC before $MDCFREE != after $MDCFREE2"
+ else
+ echo "MDC before $MDCFREE != after $MDCFREE2"
+ echo "unable to confirm if MDS has large inodes"
+ fi
+ fi
+ rm -rf $DIR/d57b
+}
+run_test 57b "default LOV EAs are stored inside large inodes ==="
+
+test_58() {
+ wiretest
+}
+run_test 58 "verify cross-platform wire constants =============="
+
+test_59() {
+ echo "touch 130 files"
+ for i in `seq 1 130` ; do
+ touch $DIR/59-$i
+ done
+ echo "rm 130 files"
+ for i in `seq 1 130` ; do
+ rm -f $DIR/59-$i
+ done
+ sync
+ sleep 2
+ # wait for commitment of removal
+}
+run_test 59 "verify cancellation of llog records async ========="
+
+test_60() {
+ echo 60 "llog tests run from kernel mode"
+ sh run-llog.sh
+}
+run_test 60 "llog sanity tests run from kernel module =========="
+
+test_61() {
+ f="$DIR/f61"
+ dd if=/dev/zero of=$f bs=`page_size` count=1
+ cancel_lru_locks OSC
+ multiop $f OSMWUc || error
+ sync
+}
+run_test 61 "mmap() writes don't make sync hang ================"
+
+# bug 2330 - insufficient obd_match error checking causes LBUG
+test_62() {
+ f="$DIR/f62"
+ echo foo > $f
+ cancel_lru_locks OSC
+ echo 0x405 > /proc/sys/lustre/fail_loc
+ cat $f && error "cat succeeded, expect -EIO"
+ echo 0 > /proc/sys/lustre/fail_loc
+}
+run_test 62 "verify obd_match failure doesn't LBUG (should -EIO)"
+
+# bug 2319 - oig_wait() interrupted causes crash because of invalid waitq.
+test_63() {
+ MAX_DIRTY_MB=`cat /proc/fs/lustre/osc/*/max_dirty_mb | head -n 1`
+ for i in /proc/fs/lustre/osc/*/max_dirty_mb ; do
+ echo 0 > $i
+ done
+ for i in `seq 10` ; do
+ dd if=/dev/zero of=$DIR/f63 bs=8k &
+ sleep 5
+ kill $!
+ sleep 1
+ done
+
+ for i in /proc/fs/lustre/osc/*/max_dirty_mb ; do
+ echo $MAX_DIRTY_MB > $i
+ done
+ true
+}
+run_test 63 "Verify oig_wait interruption does not crash ======"
+
+test_64a () {
+ df $DIR
+ grep "[0-9]" /proc/fs/lustre/osc/OSC*MNT*/cur*
+}
+run_test 64a "verify filter grant calculations (in kernel) ====="
+
+test_64b () {
+ sh oos.sh $MOUNT
+}
+run_test 64b "check out-of-space detection on client ==========="
+
+# bug 1414 - set/get directories' stripe info
+test_65a() {
+ mkdir -p $DIR/d65a
+ touch $DIR/d65a/f1
+ $LVERIFY $DIR/d65a $DIR/d65a/f1 || error "lverify failed"
+}
+run_test 65a "directory with no stripe info ===================="
+
+test_65b() {
+ mkdir -p $DIR/d65b
+ $LSTRIPE $DIR/d65b $(($STRIPESIZE * 2)) 0 1 || error "setstripe"
+ touch $DIR/d65b/f2
+ $LVERIFY $DIR/d65b $DIR/d65b/f2 || error "lverify failed"
+}
+run_test 65b "directory setstripe $(($STRIPESIZE * 2)) 0 1 ==============="
+
+test_65c() {
+ if [ $OSTCOUNT -gt 1 ]; then
+ mkdir -p $DIR/d65c
+ $LSTRIPE $DIR/d65c $(($STRIPESIZE * 4)) 1 \
+ $(($OSTCOUNT - 1)) || error "setstripe"
+ touch $DIR/d65c/f3
+ $LVERIFY $DIR/d65c $DIR/d65c/f3 || error "lverify failed"
+ fi
+}
+run_test 65c "directory setstripe $(($STRIPESIZE * 4)) 1 $(($OSTCOUNT - 1))"
+
+[ $STRIPECOUNT -eq 0 ] && sc=1 || sc=$(($STRIPECOUNT - 1))
+
+test_65d() {
+ mkdir -p $DIR/d65d
+ $LSTRIPE $DIR/d65d $STRIPESIZE -1 $sc || error "setstripe"
+ touch $DIR/d65d/f4 $DIR/d65d/f5
+ $LVERIFY $DIR/d65d $DIR/d65d/f4 $DIR/d65d/f5 || error "lverify failed"
+}
+run_test 65d "directory setstripe $STRIPESIZE -1 $sc ======================"
+
+test_65e() {
+ mkdir -p $DIR/d65e
+
+ $LSTRIPE $DIR/d65e 0 -1 0 || error "setstripe"
+ $LFS find -v $DIR/d65e | grep "$DIR/d65e/ has no stripe info" || error "no stripe info failed"
+ touch $DIR/d65e/f6
+ $LVERIFY $DIR/d65e $DIR/d65e/f6 || error "lverify failed"
+}
+run_test 65e "directory setstripe 0 -1 0 (default) ============="
+
+test_65f() {
+ mkdir -p $DIR/d65f
+ $RUNAS $LSTRIPE $DIR/d65f 0 -1 0 && error "setstripe succeeded" || true
+}
+run_test 65f "dir setstripe permission (should return error) ==="
+
+test_65g() {
+ mkdir -p $DIR/d65g
+ $LSTRIPE $DIR/d65g $(($STRIPESIZE * 2)) 0 1 || error "setstripe"
+ $LSTRIPE -d $DIR/d65g || error "deleting stripe info failed"
+ $LFS find -v $DIR/d65g | grep "$DIR/d65g/ has no stripe info" || error "no stripe info failed"
+}
+run_test 65g "directory setstripe -d ========"
+
+test_65h() {
+ mkdir -p $DIR/d65h
+ $LSTRIPE $DIR/d65h $(($STRIPESIZE * 2)) 0 1 || error "setstripe"
+ mkdir -p $DIR/d65h/dd1
+ [ "`$LFS find -v $DIR/d65h | grep "^count"`" == \
+ "`$LFS find -v $DIR/d65h/dd1 | grep "^count"`" ] || error "stripe info inherit failed"
+}
+run_test 65h "directory stripe info inherit ======"
+
+# bug 2543 - update blocks count on client
+test_66() {
+ COUNT=${COUNT:-8}
+ dd if=/dev/zero of=$DIR/f66 bs=1k count=$COUNT
+ sync
+ BLOCKS=`ls -s $DIR/f66 | awk '{ print $1 }'`
+ [ $BLOCKS -ge $COUNT ] || error "$DIR/f66 blocks $BLOCKS < $COUNT"
+}
+run_test 66 "update inode blocks count on client ==============="
+
+test_67() { # bug 3285 - supplementary group fails on MDS, passes on client
+ [ "$RUNAS_ID" = "$UID" ] && echo "skipping test 67" && return
+ check_kernel_version 35 || return 0
+ mkdir $DIR/d67
+ chmod 771 $DIR/d67
+ chgrp $RUNAS_ID $DIR/d67
+ $RUNAS -g $(($RUNAS_ID + 1)) -G1,2,$RUNAS_ID ls $DIR/d67 && error ||true
+}
+run_test 67 "supplementary group failure (should return error) ="
+
+cleanup_68() {
+ if [ "$LOOPDEV" ]; then
+ swapoff $LOOPDEV || error "swapoff failed"
+ losetup -d $LOOPDEV || error "losetup -d failed"
+ unset LOOPDEV LOOPNUM
+ fi
+ rm -f $DIR/f68
+}
+
+meminfo() {
+ awk '($1 == "'$1':") { print $2 }' /proc/meminfo
+}
+
+swap_used() {
+ swapon -s | awk '($1 == "'$1'") { print $4 }'
+}
+
+# excercise swapping to lustre by adding a high priority swapfile entry
+# and then consuming memory until it is used.
+test_68() {
+ [ "$UID" != 0 ] && echo "skipping test 68 (must run as root)" && return
+ [ "`lsmod|grep obdfilter`" ] && echo "skipping test 68 (local OST)" && \
+ return
+
+ find_loop_dev
+ dd if=/dev/zero of=$DIR/f68 bs=64k count=1024
+
+ trap cleanup_68 EXIT
+
+ losetup $LOOPDEV $DIR/f68 || error "losetup $LOOPDEV failed"
+ mkswap $LOOPDEV
+ swapon -p 32767 $LOOPDEV || error "swapon $LOOPDEV failed"
+
+ echo "before: `swapon -s | grep $LOOPDEV`"
+ KBFREE=`meminfo MemTotal`
+ $MEMHOG $KBFREE || error "error allocating $KBFREE kB"
+ echo "after: `swapon -s | grep $LOOPDEV`"
+ SWAPUSED=`swap_used $LOOPDEV`
+
+ cleanup_68
+
+ [ $SWAPUSED -eq 0 ] && echo "no swap used???" || true
+}
+run_test 68 "support swapping to Lustre ========================"
+
+# bug 3462 - multiple simultaneous MDC requests
+test_69() {
+ mkdir $DIR/D68-1
+ mkdir $DIR/D68-2
+ multiop $DIR/D68-1/f68-1 O_c &
+ pid1=$!
+ #give multiop a chance to open
+ usleep 500
+
+ echo 0x80000129 > /proc/sys/lustre/fail_loc
+ multiop $DIR/D68-1/f68-2 Oc &
+ sleep 1
+ echo 0 > /proc/sys/lustre/fail_loc
+
+ multiop $DIR/D68-2/f68-3 Oc &
+ pid3=$!
+
+ kill -USR1 $pid1
+ wait $pid1 || return 1
+
+ sleep 25
+
+ $CHECKSTAT -t file $DIR/D68-1/f68-1 || return 4
+ $CHECKSTAT -t file $DIR/D68-1/f68-2 || return 5
+ $CHECKSTAT -t file $DIR/D68-2/f68-3 || return 6
+
+ rm -rf $DIR/D68-*
+}
+run_test 69 "multiple MDC requests (should not deadlock)"
+
+
+test_70() {
+ STAT="/proc/fs/lustre/osc/OSC*MNT*/stats"
+ mkdir $DIR/d70
+ dd if=/dev/zero of=$DIR/d70/file bs=512 count=5
+ cancel_lru_locks OSC
+ cat $DIR/d70/file >/dev/null
+ # Hopefully there is only one.
+ ENQ=`cat $STAT|awk -vnum=0 '/ldlm_enq/ {num += $2} END {print num;}'`
+ CONV=`cat $STAT|awk -vnum=0 '/ldlm_conv/ {num += $2} END {print num;}'`
+ CNCL=`cat $STAT|awk -vnum=0 '/ldlm_canc/ {num += $2} END {print num;}'`
+ dd if=/dev/zero of=$DIR/d70/file bs=512 count=5
+ ENQ1=`cat $STAT|awk -vnum=0 '/ldlm_enq/ {num += $2} END {print num;}'`
+ CONV1=`cat $STAT|awk -vnum=0 '/ldlm_conv/ {num += $2} END {print num;}'`
+ CNCL1=`cat $STAT|awk -vnum=0 '/ldlm_canc/ {num += $2} END {print num;}'`
+
+ if [ $CONV1 -le $CONV ] ; then
+ error "No conversion happened. Before: enq $ENQ, conv $CONV, cancel $CNCL ; After: enq $ENQ1, conv $CONV1, cancel $CNCL1"
+ else
+ echo "OK"
+ true
+ fi
+
+}
+run_test 70 "Test that PR->PW conversion takes place ==========="
+
+test_71() {
+ cp `which dbench` $DIR
+
+ [ ! -f $DIR/dbench ] && echo "dbench not installed, skip this test" && return 0
+
+ TGT=$DIR/client.txt
+ SRC=${SRC:-/usr/lib/dbench/client.txt}
+ [ ! -e $TGT -a -e $SRC ] && echo "copying $SRC to $TGT" && cp $SRC $TGT
+ SRC=/usr/lib/dbench/client_plain.txt
+ [ ! -e $TGT -a -e $SRC ] && echo "copying $SRC to $TGT" && cp $SRC $TGT
+
+ echo "copying /lib to $DIR"
+ cp -r /lib $DIR/lib
+
+ echo "chroot $DIR /dbench -c client.txt 2"
+ chroot $DIR /dbench -c client.txt 2
+ RC=$?
+
+ rm -f $DIR/dbench
+ rm -f $TGT
+ rm -fr $DIR/lib
+
+ return $RC
+}
+run_test 71 "Running dbench on lustre (don't segment fault) ===="
+
+# on the LLNL clusters, runas will still pick up root's $TMP settings,
+# which will not be writable for the runas user, and then you get a CVS
+# error message with a corrupt path string (CVS bug) and panic.
+# We're not using much space, so just stick it in /tmp, which is safe.
+OLDTMPDIR=$TMPDIR
+OLDTMP=$TMP
+TMPDIR=/tmp
+TMP=/tmp
+OLDHOME=$HOME
+[ $RUNAS_ID -ne $UID ] && HOME=/tmp
+
+test_99a() {
+ mkdir -p $DIR/d99cvsroot
+ chown $RUNAS_ID $DIR/d99cvsroot
+ $RUNAS cvs -d $DIR/d99cvsroot init || error
+}
+run_test 99a "cvs init ========================================="
+
+test_99b() {
+ [ ! -d $DIR/d99cvsroot ] && test_99a
+ cd /etc/init.d
+ # some versions of cvs import exit(1) when asked to import links or
+ # files they can't read. ignore those files.
+ TOIGNORE=$(find . -type l -printf '-I %f\n' -o \
+ ! -perm +4 -printf '-I %f\n')
+ $RUNAS cvs -d $DIR/d99cvsroot import -m "nomesg" $TOIGNORE \
+ d99reposname vtag rtag
+}
+run_test 99b "cvs import ======================================="
+
+test_99c() {
+ [ ! -d $DIR/d99cvsroot ] && test_99b
+ cd $DIR
+ mkdir -p $DIR/d99reposname
+ chown $RUNAS_ID $DIR/d99reposname
+ $RUNAS cvs -d $DIR/d99cvsroot co d99reposname
+}
+run_test 99c "cvs checkout ====================================="
+
+test_99d() {
+ [ ! -d $DIR/d99cvsroot ] && test_99c
+ cd $DIR/d99reposname
+ $RUNAS touch foo99
+ $RUNAS cvs add -m 'addmsg' foo99
+}
+run_test 99d "cvs add =========================================="
+
+test_99e() {
+ [ ! -d $DIR/d99cvsroot ] && test_99c
+ cd $DIR/d99reposname
+ $RUNAS cvs update
+}
+run_test 99e "cvs update ======================================="
+
+test_99f() {
+ [ ! -d $DIR/d99cvsroot ] && test_99d
+ cd $DIR/d99reposname
+ $RUNAS cvs commit -m 'nomsg' foo99
+}
+run_test 99f "cvs commit ======================================="
+
+test_100() {
+ netstat -ta | while read PROT SND RCV LOCAL REMOTE STAT; do
+ LPORT=`echo $LOCAL | cut -d: -f2`
+ RPORT=`echo $REMOTE | cut -d: -f2`
+ if [ "$PROT" = "tcp" ] && [ "$LPORT" != "*" ] && [ "$RPORT" != "*" ] && [ $RPORT -eq 988 ] && [ $LPORT -gt 1024 ]; then
+ echo "local port: $LPORT > 1024"
+ error
+ fi
+ done
+}
+run_test 100 "check local port using privileged port ==========="
+
+
+TMPDIR=$OLDTMPDIR
+TMP=$OLDTMP
+HOME=$OLDHOME
+
+log "cleanup: ======================================================"
+if [ "`mount | grep ^$NAME`" ]; then
+ rm -rf $DIR/[Rdfs][1-9]*
+ if [ "$I_MOUNTED" = "yes" ]; then
+ sh llmountcleanup.sh || error
+ fi
+fi