diff --git a/lustre/tests/test-framework.sh b/lustre/tests/test-framework.sh
index 14ee67ab96202ccde3eac1fb3e761f661fb7a350..7ae309b35b68a3128099da6001b1bebb855225cd 100644
--- a/lustre/tests/test-framework.sh
+++ b/lustre/tests/test-framework.sh
@@ -89,6 +89,7 @@ init_test_env() {
     export LPROC=/proc/fs/lustre
     export DIR2
     export AT_MAX_PATH
+    export SAVE_PWD=${SAVE_PWD:-$LUSTRE/tests}
 
     if [ "$ACCEPTOR_PORT" ]; then
         export PORT_OPT="--port $ACCEPTOR_PORT"
@@ -1298,6 +1299,7 @@ run_one() {
     export TESTNAME=test_$testnum
     test_${testnum} || error "test_$testnum failed with $?"
     #check_mds
+    cd $SAVE_PWD
     reset_fail_loc
     check_grant ${testnum} || error "check_grant $testnum failed with $?"
     [ -f $CATASTROPHE ] && [ `cat $CATASTROPHE` -ne 0 ] && \
@@ -1308,7 +1310,6 @@ run_one() {
     unset TESTNAME
     unset tdir
     umask $SAVE_UMASK
-    cd $SAVE_PWD
     $CLEANUP
 }