diff --git a/lustre/tests/acceptance-small.sh b/lustre/tests/acceptance-small.sh
index 4e203a6d650c667a6c7e16269e8d825b71626c6c..8d25297009f787586904d3da9e53a599dba18e04 100755
--- a/lustre/tests/acceptance-small.sh
+++ b/lustre/tests/acceptance-small.sh
@@ -25,11 +25,6 @@ fi
 [ "$DEBUG_OFF" ] || DEBUG_OFF="eval sysctl -w lnet.debug=\"$DEBUG_LVL\""
 [ "$DEBUG_ON" ] || DEBUG_ON="eval sysctl -w lnet.debug=0x33f0484"
 
-
-
-LIBLUSTRE=${LIBLUSTRE:-../liblustre}
-LIBLUSTRETESTS=${LIBLUSTRETESTS:-$LIBLUSTRE/tests}
-
 if [ "$ACC_SM_ONLY" ]; then
     export RUNTESTS="no" SANITY="no" DBENCH="no" BONNIE="no" IOZONE="no" FSX="no" SANITYN="no" LFSCK="no" LIBLUSTRE="no" REPLAY_SINGLE="no" CONF_SANITY="no" RECOVERY_SMALL="no" REPLAY_OST_SINGLE="no" REPLAY_DUAL="no" INSANITY="no" SANITY_QUOTA="no"
     for O in $ACC_SM_ONLY; do
@@ -38,6 +33,8 @@ if [ "$ACC_SM_ONLY" ]; then
     done
 fi
 
+LIBLUSTRETESTS=${LIBLUSTRETESTS:-../liblustre/tests}
+
 STARTTIME=`date +%s`
 RANTEST=""
 
@@ -56,6 +53,7 @@ setup_if_needed() {
 
 title() {
     echo "-----============= acceptance-small: "$*" ============-----"
+    $LCTL mark "----===== $* =====----" 2> /dev/null || true
     RANTEST=${RANTEST}$*", "
 }
 
@@ -71,14 +69,14 @@ for NAME in $CONFIGS; do
 
 	if [ "$RUNTESTS" != "no" ]; then
 	        title runtests
-		sh runtests
+		bash runtests
 		$CLEANUP
 		$SETUP
 	fi
 
 	if [ "$SANITY" != "no" ]; then
 	        title sanity
-		sh sanity.sh
+		bash sanity.sh
 		$CLEANUP
 		$SETUP
 	fi
@@ -91,13 +89,13 @@ for NAME in $CONFIGS; do
 		[ $THREADS -lt $DB_THREADS ] && DB_THREADS=$THREADS
 
 		$DEBUG_OFF
-		sh rundbench 1
+		bash rundbench 1
 		$DEBUG_ON
 		$CLEANUP
 		$SETUP
 		if [ $DB_THREADS -gt 1 ]; then
 			$DEBUG_OFF
-			sh rundbench $DB_THREADS
+			bash rundbench $DB_THREADS
 			$DEBUG_ON
 			$CLEANUP
 			$SETUP
@@ -125,9 +123,11 @@ for NAME in $CONFIGS; do
 		SPACE=`df -P $MOUNT | tail -n 1 | awk '{ print $4 }'`
 		[ $SPACE -lt $SIZE ] && SIZE=$((SPACE * 3 / 4))
 		IOZONE_OPTS="-i 0 -i 1 -i 2 -e -+d -r $RSIZE -s $SIZE"
-		IOZFILE="-f $MOUNT/iozone"
+		IOZFILE="$MOUNT/iozone"
+		# $SPACE was calculated with all OSTs
+		$LFS setstripe $IOZFILE 0 -1 -1
 		$DEBUG_OFF
-		iozone $IOZONE_OPTS $IOZFILE
+		iozone $IOZONE_OPTS -f $IOZFILE
 		$DEBUG_ON
 		$CLEANUP
 		$SETUP
@@ -189,7 +189,7 @@ for NAME in $CONFIGS; do
 		mkdir -p $MOUNT2
 		mount_client $MOUNT2
 		#echo "can't mount2 for '$NAME', skipping sanityN.sh"
-		START=: CLEAN=: sh sanityN.sh
+		START=: CLEAN=: bash sanityN.sh
 		umount $MOUNT2
 
 		$DEBUG_ON
@@ -203,7 +203,7 @@ for NAME in $CONFIGS; do
 		if grep -q obdfilter /proc/fs/lustre/devices; then
 			if [ `echo $E2VER | cut -d. -f2` -ge 39 ] && \
 			   [ "`echo $E2VER | grep cfs`" ]; then
-			   	sh lfscktest.sh
+			   	bash lfscktest.sh
 			else
 				e2fsck -V
 				echo "e2fsck does not support lfsck, skipping"
@@ -229,6 +229,7 @@ for NAME in $CONFIGS; do
 		#export LIBLUSTRE_DEBUG_MASK=`cat /proc/sys/lnet/debug`
 		if [ -x $LIBLUSTRETESTS/sanity ]; then
 			mkdir -p $MOUNT2
+			echo $LIBLUSTRETESTS/sanity --target=$LIBLUSTRE_MOUNT_TARGET
 			$LIBLUSTRETESTS/sanity --target=$LIBLUSTRE_MOUNT_TARGET
 		fi
 		$CLEANUP
@@ -240,37 +241,37 @@ done
 
 if [ "$REPLAY_SINGLE" != "no" ]; then
         title replay-single
-	sh replay-single.sh
+	bash replay-single.sh
 fi
 
 if [ "$CONF_SANITY" != "no" ]; then
         title conf-sanity
-        sh conf-sanity.sh
+        bash conf-sanity.sh
 fi
 
 if [ "$RECOVERY_SMALL" != "no" ]; then
         title recovery-small
-        sh recovery-small.sh
+        bash recovery-small.sh
 fi
 
 if [ "$REPLAY_OST_SINGLE" != "no" ]; then
         title replay-ost-single
-        sh replay-ost-single.sh
+        bash replay-ost-single.sh
 fi
 
 if [ "$REPLAY_DUAL" != "no" ]; then
         title replay-dual
-        sh replay-dual.sh
+        bash replay-dual.sh
 fi
 
 if [ "$INSANITY" != "no" ]; then
         title insanity
-        sh insanity.sh -r
+        bash insanity.sh -r
 fi
 
 if [ "$SANITY_QUOTA" != "no" ]; then
         title sanity-quota
-        sh sanity-quota.sh
+        bash sanity-quota.sh
 fi
 
 
diff --git a/lustre/tests/replay-single.sh b/lustre/tests/replay-single.sh
index 2d75155e2f3c78d02304f6f5cb48eeb3514522d6..50ca9f340028b858d6333b3d72dce2dc782f86ce 100755
--- a/lustre/tests/replay-single.sh
+++ b/lustre/tests/replay-single.sh
@@ -927,7 +927,7 @@ test_42() {
     createmany -o $DIR/$tfile-%d 800
     replay_barrier ost1
     unlinkmany $DIR/$tfile-%d 0 400
-    DEBUG42=`sysctl -n lnet.debug`
+    debugsave
     sysctl -w lnet.debug=-1
     facet_failover ost1
     
@@ -936,7 +936,7 @@ test_42() {
     #[ $blocks_after -lt $blocks ] || return 1
     echo wait for MDS to timeout and recover
     sleep $((TIMEOUT * 2))
-    sysctl -w lnet.debug="$DEBUG42"
+    debugrestore
     unlinkmany $DIR/$tfile-%d 400 400
     $CHECKSTAT -t file $DIR/$tfile-* && return 2 || true
 }
diff --git a/lustre/tests/sanity-quota.sh b/lustre/tests/sanity-quota.sh
index ab43295586c955af61869bab9e74f1c481340c88..102f2441bcd424ee44a2d501e668a62f53b914b3 100644
--- a/lustre/tests/sanity-quota.sh
+++ b/lustre/tests/sanity-quota.sh
@@ -668,8 +668,8 @@ test_9() {
         set_blk_tunesz $((1024 * 50))
 
         # set the D_QUOTA flag
-	DBG_SAVE="`sysctl -n lnet.debug`"
-	sysctl -w lnet.debug="$DBG_SAVE quota"
+	debugsave
+	sysctl -w lnet.debug="+quota"
 
         TESTFILE="$TSTDIR/quota_tst90"
 
@@ -711,7 +711,7 @@ test_9() {
         set_blk_tunesz $BTUNE_SZ
         set_blk_unitsz $BUNIT_SZ
 
-	sysctl -w lnet.debug="$DBG_SAVE"
+	debugrestore
         return $RC
 }
 run_test 9 "run for fixing bug10707(64bit) ==========="
@@ -737,12 +737,9 @@ test_10() {
 	set_blk_tunesz $((1024 * 50))
 
 	# set the D_QUOTA flag
-	set_flag=0
-	if [ -z "`sysctl lnet.debug | grep quota`" ]; then
-		sysctl -w lnet.debug="+quota"
-		set_flag=1
-	fi
-
+	debugsave
+	sysctl -w lnet.debug="+quota"
+	
 	# make qd_count 32 bit
 	sysctl -w lustre.fail_loc=0xA00
 
@@ -785,9 +782,7 @@ test_10() {
 	RC=$?
 
 	# clear the flage
-	if [ $set_flag -eq 1 ]; then
-		sysctl -w lnet.debug="-quota"
-	fi
+	debugrestore
 
 	# make qd_count 64 bit
 	sysctl -w lustre.fail_loc=0
diff --git a/lustre/tests/sanity.sh b/lustre/tests/sanity.sh
index e1dcda2d2d755b91f7d54362019c23973fe80542..0cb9483569ea2fa1e0a258839e368177f5e103ae 100644
--- a/lustre/tests/sanity.sh
+++ b/lustre/tests/sanity.sh
@@ -1924,7 +1924,7 @@ run_test 43c "md5sum of copy into lustre========================"
 test_44() {
 	[  "$OSTCOUNT" -lt "2" ] && skip "skipping 2-stripe test" && return
 	dd if=/dev/zero of=$DIR/f1 bs=4k count=1 seek=1023
-	dd if=$DIR/f1 bs=4k count=1
+	dd if=$DIR/f1 bs=4k count=1 > /dev/null
 }
 run_test 44 "zero length read from a sparse stripe ============="
 
@@ -2039,8 +2039,8 @@ test_48a() { # bug 2399
 		touch .foo || error "'touch .foo' failed after recreating cwd"
 		mkdir .bar || error "'mkdir .foo' failed after recreating cwd"
 	fi
-	ls . || error "'ls .' failed after recreating cwd"
-	ls .. || error "'ls ..' failed after removing cwd"
+	ls . > /dev/null || error "'ls .' failed after recreating cwd"
+	ls .. > /dev/null || error "'ls ..' failed after removing cwd"
 	cd . || error "'cd .' failed after recreating cwd"
 	mkdir . && error "'mkdir .' worked after recreating cwd"
 	rmdir . && error "'rmdir .' worked after recreating cwd"
@@ -2060,8 +2060,8 @@ test_48b() { # bug 2399
 		touch .foo && error "'touch .foo' worked after removing cwd"
 		mkdir .foo && error "'mkdir .foo' worked after removing cwd"
 	fi
-	ls . && error "'ls .' worked after removing cwd"
-	ls .. || error "'ls ..' failed after removing cwd"
+	ls . > /dev/null && error "'ls .' worked after removing cwd"
+	ls .. > /dev/null || error "'ls ..' failed after removing cwd"
 	cd . && error "'cd .' worked after removing cwd"
 	mkdir . && error "'mkdir .' worked after removing cwd"
 	rmdir . && error "'rmdir .' worked after removing cwd"
@@ -2604,7 +2604,7 @@ run_test 63 "Verify oig_wait interruption does not crash ======="
 # bug 2248 - async write errors didn't return to application on sync
 # bug 3677 - async write errors left page locked
 test_63b() {
-	DBG_SAVE="`sysctl -n lnet.debug`"
+	debugsave
 	sysctl -w lnet.debug=-1
 
 	# ensure we have a grant to do async writes
@@ -2614,15 +2614,11 @@ test_63b() {
 	#define OBD_FAIL_OSC_BRW_PREP_REQ        0x406
 	sysctl -w lustre.fail_loc=0x80000406
 	multiop $DIR/$tfile Owy && \
-		$LCTL dk /tmp/test63b.debug && \
-		sysctl -w lnet.debug="$DBG_SAVE" && \
 		error "sync didn't return ENOMEM"
 	sync; sleep 2; sync	# do a real sync this time to flush page
 	grep locked $LPROC/llite/*/dump_page_cache && \
-		$LCTL dk /tmp/test63b.debug && \
-		sysctl -w lnet.debug="$DBG_SAVE" && \
 		error "locked page left in cache after async error" || true
-	sysctl -w lnet.debug="$DBG_SAVE"
+	debugrestore
 }
 run_test 63b "async write errors should be returned to fsync ==="
 
diff --git a/lustre/tests/test-framework.sh b/lustre/tests/test-framework.sh
index b7d5e138a406e483047465d39ca81c54d0122c2a..f0a460ea1503e87e66087c501bc14fffce04e348 100644
--- a/lustre/tests/test-framework.sh
+++ b/lustre/tests/test-framework.sh
@@ -44,6 +44,8 @@ init_test_env() {
     export LCTL=${LCTL:-"$LUSTRE/utils/lctl"}
     export LFS=${LFS:-"$LUSTRE/utils/lfs"}
     [ ! -f "$LCTL" ] && export LCTL=$(which lctl) 
+    export LFS=${LFS:-"$LUSTRE/utils/lfs"}
+    [ ! -f "$LFS" ] && export LFS=$(which lfs) 
     export MKFS=${MKFS:-"$LUSTRE/utils/mkfs.lustre"}
     [ ! -f "$MKFS" ] && export MKFS=$(which mkfs.lustre) 
     export TUNEFS=${TUNEFS:-"$LUSTRE/utils/tunefs.lustre"}
@@ -988,6 +990,15 @@ pgcache_empty() {
     return 0
 }
 
+debugsave() {
+    DEBUGSAVE="$(sysctl -n lnet.debug)"
+}
+
+debugrestore() {
+    [ -n "$DEBUGSAVE" ] && sysctl -w lnet.debug="${DEBUGSAVE}"
+    DEBUGSAVE=""
+}
+
 FAIL_ON_ERROR=true
 ##################################
 # Test interface