Whamcloud - gitweb
LU-1255 tests: pass $DBENCH_LIB to run_dbench.sh
authorYu Jian <yujian@whamcloud.com>
Fri, 23 Mar 2012 10:02:11 +0000 (18:02 +0800)
committerOleg Drokin <green@whamcloud.com>
Fri, 6 Apr 2012 05:25:57 +0000 (01:25 -0400)
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 <yujian@whamcloud.com>
Change-Id: I32350bfe3481614a2e5de7d5e7c254b09bd7e774
Reviewed-on: http://review.whamcloud.com/2376
Reviewed-by: Cliff White <cliffw@whamcloud.com>
Tested-by: Hudson
Reviewed-by: Wei Liu <sarah@whamcloud.com>
Tested-by: Maloo <whamcloud.maloo@gmail.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/tests/run_tar.sh
lustre/tests/rundbench
lustre/tests/test-framework.sh

index 0b82ce1..f46b874 100755 (executable)
@@ -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]}
 }
 
index ab9f236..2b17ebd 100755 (executable)
@@ -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" ] && \
index b214e33..32297ca 100644 (file)
@@ -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
 }