From bbf9ed6e54d8bb1eba31225dad1b59aae7727267 Mon Sep 17 00:00:00 2001 From: grev Date: Fri, 13 Mar 2009 19:10:56 +0000 Subject: [PATCH] b=18045 i=Adilger new mdsrate --ignore option for mdsrate tests cleanup --- lustre/tests/mdsrate-create-large.sh | 6 ++++++ lustre/tests/mdsrate-create-small.sh | 7 +++++-- lustre/tests/mdsrate-lookup-1dir.sh | 7 ++++++- lustre/tests/mdsrate-stat-large.sh | 7 ++++++- lustre/tests/mdsrate-stat-small.sh | 7 ++++++- lustre/tests/mdsrate.c | 12 ++++++++++-- lustre/tests/test-framework.sh | 2 +- 7 files changed, 40 insertions(+), 8 deletions(-) diff --git a/lustre/tests/mdsrate-create-large.sh b/lustre/tests/mdsrate-create-large.sh index b45dae1..94bb805 100644 --- a/lustre/tests/mdsrate-create-large.sh +++ b/lustre/tests/mdsrate-create-large.sh @@ -48,6 +48,9 @@ rm -f ${LOG} PI* if [ -n "$NOSINGLE" ]; then echo "NO Test for creates for a single client." else + # We can use np = $NUM_CLIENTS to speed up the cleanup + mdsrate_cleanup $NUM_CLIENTS $MACHINEFILE $NUM_FILES $TESTDIR_SINGLE 'f%%d' --ignore + log "===== $0 ### 1 NODE CREATE ###" echo "Running creates on 1 node(s)." @@ -83,6 +86,7 @@ fi if [ -n "$NOMULTI" ]; then echo "NO test for create on multiple nodes." else + mdsrate_cleanup $NUM_CLIENTS $MACHINEFILE $NUM_FILES $TESTDIR_MULTI 'f%%d' --ignore log "===== $0 ### $NUM_CLIENTS NODES CREATE ###" echo "Running creates on ${NUM_CLIENTS} node(s)." @@ -112,6 +116,8 @@ else fi equals_msg `basename $0`: test complete, cleaning up +mdsrate_cleanup $NUM_CLIENTS $MACHINEFILE $NUM_FILES $TESTDIR_SINGLE 'f%%d' --ignore +mdsrate_cleanup $NUM_CLIENTS $MACHINEFILE $NUM_FILES $TESTDIR_MULTI 'f%%d' --ignore rm -f $MACHINEFILE check_and_cleanup_lustre #rm -f $LOG diff --git a/lustre/tests/mdsrate-create-small.sh b/lustre/tests/mdsrate-create-small.sh index 5455796..cb4a1c0 100644 --- a/lustre/tests/mdsrate-create-small.sh +++ b/lustre/tests/mdsrate-create-small.sh @@ -56,7 +56,8 @@ else if [ -n "$NOCREATE" ]; then echo "NO Test for creates for a single client." else - do_node ${CLIENT} "rm -rf $TESTDIR_SINGLE" + # We can use np = $NUM_CLIENTS to speed up the cleanup + mdsrate_cleanup $NUM_CLIENTS $MACHINEFILE $NUM_FILES $TESTDIR_SINGLE 'f%%d' --ignore log "===== $0 ### 1 NODE CREATE ###" echo "Running creates on 1 node(s)." @@ -101,7 +102,7 @@ else if [ -n "$NOCREATE" ]; then echo "NO test for create on multiple nodes." else - do_node $CLIENT rm -rf $TESTDIR_MULTI + mdsrate_cleanup $NUM_CLIENTS $MACHINEFILE $NUM_FILES $TESTDIR_MULTI 'f%%d' --ignore log "===== $0 ### $NUM_CLIENTS NODES CREATE ###" echo "Running creates on ${NUM_CLIENTS} node(s) with $THREADS_PER_CLIENT threads per client." @@ -136,6 +137,8 @@ else fi equals_msg `basename $0`: test complete, cleaning up +mdsrate_cleanup $NUM_CLIENTS $MACHINEFILE $NUM_FILES $TESTDIR_SINGLE 'f%%d' --ignore +mdsrate_cleanup $NUM_CLIENTS $MACHINEFILE $NUM_FILES $TESTDIR_MULTI 'f%%d' --ignore rm -f $MACHINEFILE check_and_cleanup_lustre #rm -f $LOG diff --git a/lustre/tests/mdsrate-lookup-1dir.sh b/lustre/tests/mdsrate-lookup-1dir.sh index 3387a56..6861599 100644 --- a/lustre/tests/mdsrate-lookup-1dir.sh +++ b/lustre/tests/mdsrate-lookup-1dir.sh @@ -16,7 +16,8 @@ init_test_env $@ assert_env CLIENTS MDSRATE SINGLECLIENT MPIRUN MACHINEFILE=${MACHINEFILE:-$TMP/$(basename $0 .sh).machines} -TESTDIR=$MOUNT +# Do not use name [df][0-9]* to avoid cleanup by rm, bug 18045 +TESTDIR=$MOUNT/mdsrate # Requirements NUM_FILES=${NUM_FILES:-1000000} @@ -34,6 +35,8 @@ rm -f $LOG log "===== $0 ====== " check_and_setup_lustre +mkdir -p $TESTDIR +chmod 0777 $TESTDIR IFree=$(inodes_available) if [ $IFree -lt $NUM_FILES ]; then @@ -48,6 +51,8 @@ get_stripe $TESTDIR if [ -n "$NOCREATE" ]; then echo "NOCREATE=$NOCREATE => no file creation." else + mdsrate_cleanup $NUM_CLIENTS $MACHINEFILE $NUM_FILES $TESTDIR 'f%%d' --ignore + log "===== $0 Test preparation: creating ${NUM_FILES} files." echo "Test preparation: creating ${NUM_FILES} files." diff --git a/lustre/tests/mdsrate-stat-large.sh b/lustre/tests/mdsrate-stat-large.sh index a26ffc8..e499f28 100644 --- a/lustre/tests/mdsrate-stat-large.sh +++ b/lustre/tests/mdsrate-stat-large.sh @@ -18,7 +18,8 @@ init_test_env $@ assert_env CLIENTS MDSRATE SINGLECLIENT MPIRUN MACHINEFILE=${MACHINEFILE:-$TMP/$(basename $0 .sh).machines} -TESTDIR=$MOUNT +# Do not use name [df][0-9]* to avoid cleanup by rm, bug 18045 +TESTDIR=$MOUNT/mdsrate # Requirements NUM_FILES=${NUM_FILES:-1000000} @@ -39,6 +40,8 @@ rm -f $LOG log "===== $0 ====== " check_and_setup_lustre +mkdir -p $TESTDIR +chmod 0777 $TESTDIR IFree=$(inodes_available) if [ $IFree -lt $NUM_FILES ]; then @@ -53,6 +56,8 @@ get_stripe $TESTDIR if [ -n "$NOCREATE" ]; then echo "NOCREATE=$NOCREATE => no file creation." else + mdsrate_cleanup $NUM_CLIENTS $MACHINEFILE $NUM_FILES $TESTDIR 'f%%d' --ignore + log "===== $0 Test preparation: creating ${NUM_FILES} files." echo "Test preparation: creating ${NUM_FILES} files." diff --git a/lustre/tests/mdsrate-stat-small.sh b/lustre/tests/mdsrate-stat-small.sh index f667ee6..c702721 100644 --- a/lustre/tests/mdsrate-stat-small.sh +++ b/lustre/tests/mdsrate-stat-small.sh @@ -18,7 +18,8 @@ init_test_env $@ assert_env CLIENTS MDSRATE SINGLECLIENT MPIRUN MACHINEFILE=${MACHINEFILE:-$TMP/$(basename $0 .sh).machines} -TESTDIR=$MOUNT +# Do not use name [df][0-9]* to avoid cleanup by rm, bug 18045 +TESTDIR=$MOUNT/mdsrate # Requirements NUM_FILES=${NUM_FILES:-1000000} @@ -39,6 +40,8 @@ rm -f $LOG log "===== $0 ====== " check_and_setup_lustre +mkdir -p $TESTDIR +chmod 0777 $TESTDIR IFree=$(inodes_available) if [ $IFree -lt $NUM_FILES ]; then @@ -53,6 +56,8 @@ get_stripe $TESTDIR if [ -n "$NOCREATE" ]; then echo "NOCREATE=$NOCREATE => no file creation." else + mdsrate_cleanup $NUM_CLIENTS $MACHINEFILE $NUM_FILES $TESTDIR 'f%%d' --ignore + log "===== $0 Test preparation: creating ${NUM_FILES} files." echo "Test preparation: creating ${NUM_FILES} files." diff --git a/lustre/tests/mdsrate.c b/lustre/tests/mdsrate.c index 930541f..097d4a8 100644 --- a/lustre/tests/mdsrate.c +++ b/lustre/tests/mdsrate.c @@ -60,6 +60,7 @@ enum { RANDOM = 'A', READDIR = 'B', RECREATE = 'C', + IGNORE = 'E', VERBOSE = 'V', DEBUG = 'v', HELP = 'h', @@ -86,6 +87,7 @@ struct option longOpts[] = { {"random_order", 0, NULL, RANDOM }, {"readdir_order", 0, NULL, READDIR }, {"recreate", 0, NULL, RECREATE }, + {"ignore", 0, NULL, IGNORE }, {"verbose", 0, NULL, VERBOSE }, {"debug", 0, NULL, DEBUG }, {"help", 0, NULL, HELP }, @@ -124,6 +126,7 @@ struct sigaction act; int order = RANDOM; int seed; int recreate; +int ignore; int verbose; int debug; struct stat statbuf; @@ -150,7 +153,7 @@ struct stat statbuf; char *usage_msg = "usage: %s\n" " { --create [ --noexcl ] | --lookup | --mknod |\n" - " --open | --stat | --unlink [ --recreate ] }\n" + " --open | --stat | --unlink [ --recreate ] [ --ignore ] }\n" " [ --help ] [ --verbose ] [ --debug ]\n" " { [ --begin ] --nfiles }\n" " [ --iters ] [ --time ]\n" @@ -403,6 +406,9 @@ process_args(int argc, char *argv[]) } order = c; break; + case IGNORE: + ++ignore; + break; case DEBUG: ++debug; case VERBOSE: @@ -567,7 +573,7 @@ main(int argc, char *argv[]) /* if we're not measuring creation rates then precreate * the files we're operating on. */ - if ((mode != CREATE) && (mode != MKNOD)) { + if ((mode != CREATE) && (mode != MKNOD) && !ignore) { /* create the files in reverse order. When we encounter * a file that already exists, assume the remainder of * the files exist to save time. The timed performance @@ -723,6 +729,8 @@ main(int argc, char *argv[]) if (rc) { if (((rc = errno) == EINTR) && alarm_caught) break; + if (((rc = errno) == ENOENT) && ignore) + continue; fatal(myrank, "unlink(%s) error: %s\n", filename, strerror(rc)); } diff --git a/lustre/tests/test-framework.sh b/lustre/tests/test-framework.sh index ea88d8f..7477a7b 100644 --- a/lustre/tests/test-framework.sh +++ b/lustre/tests/test-framework.sh @@ -2560,6 +2560,6 @@ mpi_run () { } mdsrate_cleanup () { - mpi_run -np $1 -machinefile $2 ${MDSRATE} --unlink --nfiles $3 --dir $4 --filefmt $5 + mpi_run -np $1 -machinefile $2 ${MDSRATE} --unlink --nfiles $3 --dir $4 --filefmt $5 $6 } -- 1.8.3.1