From 85a5d1585c498662e12c912d5f13fdc6b41f335c Mon Sep 17 00:00:00 2001 From: James Nunez Date: Fri, 20 Dec 2013 20:13:19 -0700 Subject: [PATCH] LU-2524 test: Modify tdir to be single directory Currently, the tdir variable is a directory with a subdirectory. This requires the '-p' option when calling mkdir. We've made tdir be a single directory so calls to mkdir and test_mkdir do not require the '-p' option in most cases. tdir was changed from d0.${TESTSUITE}/d${base} to d${testnum}.${TESTSUITE} and tfile was changed from f.${TESTSUITE}.${testnum} to f${testnum}.${TESTSUITE}. Now tdir and tfile are consistent in their format and the call to remove files and directories at the beginning of many test scripts will remove these files and directories. Once this patch lands, we can remove the "-p" option from many of the calls to mkdir. Lustre-commit: a98d44e0439ad5b20d0d7f273b29e6ea990312f0 Lustre-change: http://review.whamcloud.com/8123 LU-2524 tests: run sanity test_51ba in test_51b dir Run the test_51ba directory cleanup in the same directory as the test_51b subtest created its subdirectories. Lustre-commit: 47c581b8155f865ade5c9d067f85930146361c2a Lustre-change: http://review.whamcloud.com/9021 Signed-off-by: James Nunez Change-Id: Ib49d7102a49ff6b5f3ec539a5b2f2f5186231a04 Reviewed-on: http://review.whamcloud.com/8123 Reviewed-by: Andreas Dilger Tested-by: Jenkins Tested-by: Maloo Reviewed-by: wangdi Reviewed-on: http://review.whamcloud.com/10349 Reviewed-by: Oleg Drokin --- lustre/tests/sanity.sh | 4 ++-- lustre/tests/test-framework.sh | 39 ++++++++++++++++++++------------------- 2 files changed, 22 insertions(+), 21 deletions(-) diff --git a/lustre/tests/sanity.sh b/lustre/tests/sanity.sh index 0e08e96..ebfb34d 100644 --- a/lustre/tests/sanity.sh +++ b/lustre/tests/sanity.sh @@ -3772,7 +3772,7 @@ run_test 51a "special situations: split htree with empty entry ==" export NUMTEST=70000 test_51b() { [ $PARALLEL == "yes" ] && skip "skip parallel run" && return - local BASE=$DIR/$tdir + local BASE=$DIR/d${base}.${TESTSUITE} # cleanup the directory rm -fr $BASE @@ -3799,7 +3799,7 @@ test_51b() { run_test 51b "exceed 64k subdirectory nlink limit" test_51ba() { # LU-993 - local BASE=$DIR/$tdir + local BASE=$DIR/d${base}.${TESTSUITE} # unlink all but 100 subdirectories, then check it still works local LEFT=100 [ -f $BASE/fnum ] && local NUMPREV=$(cat $BASE/fnum) && rm $BASE/fnum diff --git a/lustre/tests/test-framework.sh b/lustre/tests/test-framework.sh index d7eeae7..0b2305d 100644 --- a/lustre/tests/test-framework.sh +++ b/lustre/tests/test-framework.sh @@ -4595,34 +4595,35 @@ banner() { } # -# Run a single test function and cleanup after it. +# Run a single test function and cleanup after it. # # This function should be run in a subshell so the test func can # exit() without stopping the whole script. # run_one() { - local testnum=$1 - local message=$2 - tfile=f.${TESTSUITE}.${testnum} - export tdir=d0.${TESTSUITE}/d${base} - export TESTNAME=test_$testnum - local SAVE_UMASK=`umask` - umask 0022 - - banner "test $testnum: $message" - test_${testnum} || error "test_$testnum failed with $?" - cd $SAVE_PWD - reset_fail_loc - check_grant ${testnum} || error "check_grant $testnum failed with $?" - check_catastrophe || error "LBUG/LASSERT detected" + local testnum=$1 + local message=$2 + export tfile=f${testnum}.${TESTSUITE} + export tdir=d${testnum}.${TESTSUITE} + export TESTNAME=test_$testnum + local SAVE_UMASK=`umask` + umask 0022 + + banner "test $testnum: $message" + test_${testnum} || error "test_$testnum failed with $?" + cd $SAVE_PWD + reset_fail_loc + check_grant ${testnum} || error "check_grant $testnum failed with $?" + check_catastrophe || error "LBUG/LASSERT detected" if [ "$PARALLEL" != "yes" ]; then ps auxww | grep -v grep | grep -q multiop && error "multiop still running" fi - unset TESTNAME - unset tdir - umask $SAVE_UMASK - return 0 + unset TESTNAME + unset tdir + unset tfile + umask $SAVE_UMASK + return 0 } # -- 1.8.3.1