From f58fbbf035b2bf11aa5959f200a4230223235193 Mon Sep 17 00:00:00 2001 From: Jian Yu Date: Wed, 29 May 2013 15:38:40 +0800 Subject: [PATCH] LU-1233 tests: clean up files in performance-sanity test This patch cleans up the files created in performance-sanity.sh through mdsrate-{create,lookup,stat}-*.sh after create/lookup/stat operation fails. Test-Parameters: envdefinitions=SLOW=yes,ENABLE_QUOTA=yes \ clientdistro=el6 serverdistro=el6 clientarch=x86_64 \ serverarch=x86_64 testlist=performance-sanity Signed-off-by: Jian Yu Change-Id: I2fc612bea7a10dd7bb5a735af2b1330f339c2a22 Reviewed-on: http://review.whamcloud.com/6483 Tested-by: Hudson Tested-by: Maloo Reviewed-by: Minh Diep Reviewed-by: Wei Liu Reviewed-by: Oleg Drokin --- lustre/tests/mdsrate-create-large.sh | 22 +++++++++------ lustre/tests/mdsrate-create-small.sh | 24 +++++++++++------ lustre/tests/mdsrate-lookup-10dirs.sh | 51 ++++++++++++++++++++++------------- lustre/tests/mdsrate-lookup-1dir.sh | 31 ++++++++++++++------- lustre/tests/mdsrate-stat-large.sh | 31 ++++++++++++++------- lustre/tests/mdsrate-stat-small.sh | 30 ++++++++++++++------- 6 files changed, 124 insertions(+), 65 deletions(-) diff --git a/lustre/tests/mdsrate-create-large.sh b/lustre/tests/mdsrate-create-large.sh index df46b1c..c046473 100644 --- a/lustre/tests/mdsrate-create-large.sh +++ b/lustre/tests/mdsrate-create-large.sh @@ -61,10 +61,13 @@ else mpi_run -np 1 ${MACHINEFILE_OPTION} ${MACHINEFILE} ${COMMAND} | tee ${LOG} - if [ ${PIPESTATUS[0]} != 0 ]; then - [ -f $LOG ] && sed -e "s/^/log: /" $LOG - error "mdsrate creates for a single client failed, aborting" - fi + if [ ${PIPESTATUS[0]} != 0 ]; then + [ -f $LOG ] && sed -e "s/^/log: /" $LOG + error_noexit "mdsrate create on single client failed, aborting" + mdsrate_cleanup $NUM_CLIENTS $MACHINEFILE $NUM_FILES \ + $TESTDIR_SINGLE 'f%%d' --ignore + exit 1 + fi log "===== $0 ### 1 NODE UNLINK ###" @@ -106,10 +109,13 @@ else mpi_run -np ${NUM_CLIENTS} ${MACHINEFILE_OPTION} ${MACHINEFILE} \ ${COMMAND} | tee ${LOG} - if [ ${PIPESTATUS[0]} != 0 ]; then - [ -f $LOG ] && sed -e "s/^/log: /" $LOG - error "mdsrate create on multiple nodes failed, aborting" - fi + if [ ${PIPESTATUS[0]} != 0 ]; then + [ -f $LOG ] && sed -e "s/^/log: /" $LOG + error_noexit "mdsrate create on multiple nodes failed, aborting" + mdsrate_cleanup $NUM_CLIENTS $MACHINEFILE $NUM_FILES \ + $TESTDIR_MULTI 'f%%d' --ignore + exit 1 + fi log "===== $0 ### $NUM_CLIENTS NODES UNLINK ###" diff --git a/lustre/tests/mdsrate-create-small.sh b/lustre/tests/mdsrate-create-small.sh index 432c7d8..44fee4b 100644 --- a/lustre/tests/mdsrate-create-small.sh +++ b/lustre/tests/mdsrate-create-small.sh @@ -69,10 +69,13 @@ else mpi_run -np 1 ${MACHINEFILE_OPTION} ${MACHINEFILE} ${COMMAND} | tee ${LOG} - if [ ${PIPESTATUS[0]} != 0 ]; then - [ -f $LOG ] && sed -e "s/^/log: /" $LOG - error "mdsrate create for a single client failed, aborting" - fi + if [ ${PIPESTATUS[0]} != 0 ]; then + [ -f $LOG ] && sed -e "s/^/log: /" $LOG + error_noexit "mdsrate create on single client failed, aborting" + mdsrate_cleanup $NUM_CLIENTS $MACHINEFILE $NUM_FILES \ + $TESTDIR_SINGLE 'f%%d' --ignore + exit 1 + fi fi if [ -n "$NOUNLINK" ]; then @@ -120,10 +123,15 @@ else echo "+ ${COMMAND}" mpi_run -np $((NUM_CLIENTS * THREADS_PER_CLIENT)) \ ${MACHINEFILE_OPTION} ${MACHINEFILE} ${COMMAND} | tee ${LOG} - if [ ${PIPESTATUS[0]} != 0 ]; then - [ -f $LOG ] && sed -e "s/^/log: /" $LOG - error "mdsrate create on multiple nodes failed, aborting" - fi + + if [ ${PIPESTATUS[0]} != 0 ]; then + [ -f $LOG ] && sed -e "s/^/log: /" $LOG + error_noexit "mdsrate create on multiple nodes failed, aborting" + mdsrate_cleanup $((NUM_CLIENTS * THREADS_PER_CLIENT)) \ + $MACHINEFILE $NUM_FILES \ + $TESTDIR_MULTI 'f%%d' --ignore + exit 1 + fi fi if [ -n "$NOUNLINK" ]; then diff --git a/lustre/tests/mdsrate-lookup-10dirs.sh b/lustre/tests/mdsrate-lookup-10dirs.sh index 6408329..1b65bdf 100644 --- a/lustre/tests/mdsrate-lookup-10dirs.sh +++ b/lustre/tests/mdsrate-lookup-10dirs.sh @@ -52,13 +52,22 @@ generate_machine_file $NODES_TO_USE $MACHINEFILE || error "can not generate mach DIRfmt="${BASEDIR}/lookup-%d" +# +# Unlink the files created in the directories under $BASEDIR. +# FIXME: does it make sense to add the possibility to unlink dirfmt to mdsrate? +# +mdsrate_cleanup_all() { + local i + for i in $(seq 0 $NUM_DIRS); do + mdsrate_cleanup $NUM_CLIENTS $MACHINEFILE $NUM_FILES \ + $BASEDIR/lookup-$i 'f%%d' --ignore + done +} + if [ -n "$NOCREATE" ]; then echo "NOCREATE=$NOCREATE => no file creation." else - # FIXME: does it make sense to add the possibility to unlink dirfmt to mdsrate? - for i in $(seq 0 $NUM_DIRS); do - mdsrate_cleanup $NUM_CLIENTS $MACHINEFILE $NUM_FILES $BASEDIR/lookup-$i 'f%%d' --ignore - done + mdsrate_cleanup_all log "===== $0 Test preparation: creating ${NUM_DIRS} dirs with ${NUM_FILES} files." @@ -74,8 +83,12 @@ else mpi_run -np ${NUM_DIRS} ${MACHINEFILE_OPTION} ${MACHINEFILE} \ ${COMMAND} 2>&1 - # No lookup if error occurs on file creation, abort. - [ ${PIPESTATUS[0]} != 0 ] && error "mdsrate file creation failed, aborting" + # No lookup if error occurs on file creation, abort. + if [ ${PIPESTATUS[0]} != 0 ]; then + error_noexit "mdsrate file creation failed, aborting" + mdsrate_cleanup_all + exit 1 + fi fi COMMAND="${MDSRATE} ${MDSRATE_DEBUG} --lookup --time ${TIME_PERIOD} ${SEED_OPTION} @@ -91,10 +104,12 @@ else mpi_run -np 1 ${MACHINEFILE_OPTION} ${MACHINEFILE} ${COMMAND} | tee ${LOG} - if [ ${PIPESTATUS[0]} != 0 ]; then - [ -f $LOG ] && sed -e "s/^/log: /" $LOG - error "mdsrate lookups on a single client failed, aborting" - fi + if [ ${PIPESTATUS[0]} != 0 ]; then + [ -f $LOG ] && sed -e "s/^/log: /" $LOG + error_noexit "mdsrate lookup on single client failed, aborting" + mdsrate_cleanup_all + exit 1 + fi fi # 2 @@ -107,18 +122,16 @@ else mpi_run -np ${NUM_CLIENTS} ${MACHINEFILE_OPTION} ${MACHINEFILE} \ ${COMMAND} | tee ${LOG} - if [ ${PIPESTATUS[0]} != 0 ]; then - [ -f $LOG ] && sed -e "s/^/log: /" $LOG - error "mdsrate lookups on multiple nodes failed, aborting" - fi + if [ ${PIPESTATUS[0]} != 0 ]; then + [ -f $LOG ] && sed -e "s/^/log: /" $LOG + error_noexit "mdsrate lookup on multiple nodes failed, aborting" + mdsrate_cleanup_all + exit 1 + fi fi equals_msg `basename $0`: test complete, cleaning up -# FIXME: does it make sense to add the possibility to unlink dirfmt to mdsrate? -for i in $(seq 0 $NUM_DIRS); do - mdsrate_cleanup $NUM_CLIENTS $MACHINEFILE $NUM_FILES $BASEDIR/lookup-$i 'f%%d' --ignore -done - +mdsrate_cleanup_all rmdir $BASEDIR || true rm -f $MACHINEFILE check_and_cleanup_lustre diff --git a/lustre/tests/mdsrate-lookup-1dir.sh b/lustre/tests/mdsrate-lookup-1dir.sh index d4a710f..c242b44 100644 --- a/lustre/tests/mdsrate-lookup-1dir.sh +++ b/lustre/tests/mdsrate-lookup-1dir.sh @@ -67,8 +67,13 @@ else mpi_run -np ${NUM_THREADS} ${MACHINEFILE_OPTION} ${MACHINEFILE} \ ${COMMAND} 2>&1 - # No lockup if error occurs on file creation, abort. - [ ${PIPESTATUS[0]} != 0 ] && error "mdsrate file creation failed, aborting" + # No lockup if error occurs on file creation, abort. + if [ ${PIPESTATUS[0]} != 0 ]; then + error_noexit "mdsrate file creation failed, aborting" + mdsrate_cleanup $NUM_THREADS $MACHINEFILE $NUM_FILES \ + $TESTDIR 'f%%d' --ignore + exit 1 + fi fi COMMAND="${MDSRATE} ${MDSRATE_DEBUG} --lookup --time ${TIME_PERIOD} ${SEED_OPTION} @@ -83,10 +88,13 @@ else mpi_run -np 1 ${MACHINEFILE_OPTION} ${MACHINEFILE} ${COMMAND} | tee ${LOG} - if [ ${PIPESTATUS[0]} != 0 ]; then - [ -f $LOG ] && sed -e "s/^/log: /" $LOG - error "mdsrate lookups on a single client failed, aborting" - fi + if [ ${PIPESTATUS[0]} != 0 ]; then + [ -f $LOG ] && sed -e "s/^/log: /" $LOG + error_noexit "mdsrate lookup on single client failed, aborting" + mdsrate_cleanup $NUM_CLIENTS $MACHINEFILE $NUM_FILES \ + $TESTDIR 'f%%d' --ignore + exit 1 + fi fi # 2 @@ -99,10 +107,13 @@ else mpi_run -np ${NUM_CLIENTS} ${MACHINEFILE_OPTION} ${MACHINEFILE} \ ${COMMAND} | tee ${LOG} - if [ ${PIPESTATUS[0]} != 0 ]; then - [ -f $LOG ] && sed -e "s/^/log: /" $LOG - error "mdsrate lookups on multiple nodes failed, aborting" - fi + if [ ${PIPESTATUS[0]} != 0 ]; then + [ -f $LOG ] && sed -e "s/^/log: /" $LOG + error_noexit "mdsrate lookup on multiple nodes failed, aborting" + mdsrate_cleanup $NUM_CLIENTS $MACHINEFILE $NUM_FILES \ + $TESTDIR 'f%%d' --ignore + exit 1 + fi fi equals_msg `basename $0`: test complete, cleaning up diff --git a/lustre/tests/mdsrate-stat-large.sh b/lustre/tests/mdsrate-stat-large.sh index 3901218..cce4eb4 100644 --- a/lustre/tests/mdsrate-stat-large.sh +++ b/lustre/tests/mdsrate-stat-large.sh @@ -70,8 +70,13 @@ else mpi_run -np ${NUM_THREADS} ${MACHINEFILE_OPTION} ${MACHINEFILE} \ ${COMMAND} 2>&1 - [ ${PIPESTATUS[0]} != 0 ] && - error "mdsrate file creation failed, aborting" + + if [ ${PIPESTATUS[0]} != 0 ]; then + error_noexit "mdsrate file creation failed, aborting" + mdsrate_cleanup $NUM_THREADS $MACHINEFILE $NUM_FILES \ + $TESTDIR 'f%%d' --ignore + exit 1 + fi fi COMMAND="${MDSRATE} ${MDSRATE_DEBUG} --stat --time ${TIME_PERIOD} @@ -87,10 +92,13 @@ else mpi_run -np 1 ${MACHINEFILE_OPTION} ${MACHINEFILE} ${COMMAND} | tee ${LOG} - if [ ${PIPESTATUS[0]} != 0 ]; then - [ -f $LOG ] && sed -e "s/^/log: /" $LOG - error "mdsrate stats on a single client failed, aborting" - fi + if [ ${PIPESTATUS[0]} != 0 ]; then + [ -f $LOG ] && sed -e "s/^/log: /" $LOG + error_noexit "mdsrate stat on single client failed, aborting" + mdsrate_cleanup $NUM_CLIENTS $MACHINEFILE $NUM_FILES \ + $TESTDIR 'f%%d' --ignore + exit 1 + fi fi # 2 @@ -104,10 +112,13 @@ else mpi_run -np ${NUM_CLIENTS} ${MACHINEFILE_OPTION} ${MACHINEFILE} \ ${COMMAND} | tee ${LOG} - if [ ${PIPESTATUS[0]} != 0 ]; then - [ -f $LOG ] && sed -e "s/^/log: /" $LOG - error "mdsrate stats on multiple nodes failed, aborting" - fi + if [ ${PIPESTATUS[0]} != 0 ]; then + [ -f $LOG ] && sed -e "s/^/log: /" $LOG + error_noexit "mdsrate stat on multiple nodes failed, aborting" + mdsrate_cleanup $NUM_CLIENTS $MACHINEFILE $NUM_FILES \ + $TESTDIR 'f%%d' --ignore + exit 1 + fi fi equals_msg `basename $0`: test complete, cleaning up diff --git a/lustre/tests/mdsrate-stat-small.sh b/lustre/tests/mdsrate-stat-small.sh index d51480e..267c0d7 100644 --- a/lustre/tests/mdsrate-stat-small.sh +++ b/lustre/tests/mdsrate-stat-small.sh @@ -70,9 +70,13 @@ else mpi_run -np ${NUM_THREADS} ${MACHINEFILE_OPTION} ${MACHINEFILE} \ ${COMMAND} 2>&1 - [ ${PIPESTATUS[0]} != 0 ] && - error "mdsrate file creation failed, aborting" + if [ ${PIPESTATUS[0]} != 0 ]; then + error_noexit "mdsrate file creation failed, aborting" + mdsrate_cleanup $NUM_THREADS $MACHINEFILE $NUM_FILES \ + $TESTDIR 'f%%d' --ignore + exit 1 + fi fi COMMAND="${MDSRATE} ${MDSRATE_DEBUG} --stat --time ${TIME_PERIOD} @@ -88,10 +92,13 @@ else mpi_run -np 1 ${MACHINEFILE_OPTION} ${MACHINEFILE} ${COMMAND} | tee ${LOG} - if [ ${PIPESTATUS[0]} != 0 ]; then - [ -f $LOG ] && sed -e "s/^/log: /" $LOG - error "mdsrate on a single client failed, aborting" - fi + if [ ${PIPESTATUS[0]} != 0 ]; then + [ -f $LOG ] && sed -e "s/^/log: /" $LOG + error_noexit "mdsrate stat on single client failed, aborting" + mdsrate_cleanup $NUM_CLIENTS $MACHINEFILE $NUM_FILES \ + $TESTDIR 'f%%d' --ignore + exit 1 + fi fi # 2 @@ -105,10 +112,13 @@ else mpi_run -np ${NUM_CLIENTS} ${MACHINEFILE_OPTION} ${MACHINEFILE} \ ${COMMAND} | tee ${LOG} - if [ ${PIPESTATUS[0]} != 0 ]; then - [ -f $LOG ] && sed -e "s/^/log: /" $LOG - error "mdsrate stats on multiple nodes failed, aborting" - fi + if [ ${PIPESTATUS[0]} != 0 ]; then + [ -f $LOG ] && sed -e "s/^/log: /" $LOG + error_noexit "mdsrate stat on multiple nodes failed, aborting" + mdsrate_cleanup $NUM_CLIENTS $MACHINEFILE $NUM_FILES \ + $TESTDIR 'f%%d' --ignore + exit 1 + fi fi equals_msg `basename $0`: test complete, cleaning up -- 1.8.3.1