From a60af3e3f896351dfb463c6b87a6f9f2489b4551 Mon Sep 17 00:00:00 2001 From: Yu Jian Date: Fri, 23 Mar 2012 18:02:11 +0800 Subject: [PATCH] LU-1255 tests: pass $DBENCH_LIB to run_dbench.sh This patch does: 1) pass the values of $DBENCH_LIB and $DBENCH_SRC to run_dbench.sh 2) redirect the output of tar directly into the $LOG file instead of messing up the test output 3) check the $LOGDIR directory inside gather_logs() in case this function was called before init_logging() 4) fix check_logdir() and check_write_access() to avoid using node.$(hostname -s).yml files which should not be deleted Signed-off-by: Yu Jian Change-Id: I32350bfe3481614a2e5de7d5e7c254b09bd7e774 Reviewed-on: http://review.whamcloud.com/2376 Reviewed-by: Cliff White Tested-by: Hudson Reviewed-by: Wei Liu Tested-by: Maloo Reviewed-by: Oleg Drokin --- lustre/tests/run_tar.sh | 2 +- lustre/tests/rundbench | 10 +++++----- lustre/tests/test-framework.sh | 33 +++++++++++++++++++++++---------- 3 files changed, 29 insertions(+), 16 deletions(-) diff --git a/lustre/tests/run_tar.sh b/lustre/tests/run_tar.sh index 0b82ce1..f46b874 100755 --- a/lustre/tests/run_tar.sh +++ b/lustre/tests/run_tar.sh @@ -27,7 +27,7 @@ echo $$ >$LOAD_PID_FILE TESTDIR=$MOUNT/d0.tar-$(hostname) do_tar() { - tar cf - /etc | tar xf - 2>&1 | tee $LOG + tar cf - /etc | tar xf - >$LOG 2>&1 return ${PIPESTATUS[1]} } diff --git a/lustre/tests/rundbench b/lustre/tests/rundbench index ab9f236..2b17ebd 100755 --- a/lustre/tests/rundbench +++ b/lustre/tests/rundbench @@ -44,13 +44,13 @@ for prefix in $CLIENT_PREFIX; do [ "x$CLIENT" != "x" ] && break; done -if [ -n "$SRC" -a -s "$SRC" ]; then - CLIENT=${SRC} +if [ -n "$DBENCH_SRC" -a -s "$DBENCH_SRC" ]; then + CLIENT=$DBENCH_SRC fi -[ ! -s "$CLIENT" ] && \ - skip_env "$0 : $(hostname) no client file found for dbench DBENCH_LIB=$DBENCH_LIB SRC=$SRC" && \ - exit 0 +[ ! -s "$CLIENT" ] && + skip_env "$0: no client file found for dbench on $(hostname): "\ + "DBENCH_LIB=$DBENCH_LIB DBENCH_SRC=$DBENCH_SRC" && exit 0 [ ! -s "$TGT" ] && echo "copying $CLIENT to $TGT" && cp $CLIENT $TGT [ ! -s "$TGT" ] && \ diff --git a/lustre/tests/test-framework.sh b/lustre/tests/test-framework.sh index b214e33..32297ca 100644 --- a/lustre/tests/test-framework.sh +++ b/lustre/tests/test-framework.sh @@ -1116,12 +1116,14 @@ start_client_load() { eval export ${var}=$load do_node $client "PATH=$PATH MOUNT=$MOUNT ERRORS_OK=$ERRORS_OK \ - BREAK_ON_ERROR=$BREAK_ON_ERROR \ - END_RUN_FILE=$END_RUN_FILE \ - LOAD_PID_FILE=$LOAD_PID_FILE \ - TESTLOG_PREFIX=$TESTLOG_PREFIX \ - TESTNAME=$TESTNAME \ - run_${load}.sh" & +BREAK_ON_ERROR=$BREAK_ON_ERROR \ +END_RUN_FILE=$END_RUN_FILE \ +LOAD_PID_FILE=$LOAD_PID_FILE \ +TESTLOG_PREFIX=$TESTLOG_PREFIX \ +TESTNAME=$TESTNAME \ +DBENCH_LIB=$DBENCH_LIB \ +DBENCH_SRC=$DBENCH_SRC \ +run_${load}.sh" & local ppid=$! log "Started client load: ${load} on $client" @@ -4294,7 +4296,7 @@ destroy_pools () { echo destroy the created pools: ${!listvar} for poolname in ${!listvar//,/ }; do - destroy_pool $fsname.$poolname + destroy_pool $fsname.$poolname done } @@ -4309,6 +4311,13 @@ gather_logs () { local ts=$(date +%s) local docp=true + + if [[ ! -f "$YAML_LOG" ]]; then + # init_logging is not performed before gather_logs, + # so the $LOGDIR needs to be checked here + check_shared_dir $LOGDIR && touch $LOGDIR/shared + fi + [ -f $LOGDIR/shared ] && docp=false # dump lustre logs, dmesg @@ -4674,20 +4683,24 @@ check_logdir() { # Not found. Create local logdir mkdir -p $dir else - touch $dir/node.$(hostname -s).yml + touch $dir/check_file.$(hostname -s) fi return 0 } check_write_access() { local dir=$1 + local node + local file + for node in $(nodes_list); do - if [ ! -f "$dir/node.$(short_hostname ${node}).yml" ]; then + file=$dir/check_file.$(short_hostname $node) + if [[ ! -f "$file" ]]; then # Logdir not accessible/writable from this node. return 1 fi + rm -f $file || return 1 done - rm -f $dir/node.*.yml return 0 } -- 1.8.3.1