Whamcloud - gitweb
LU-3326 tests: sync after file deleted in run_*.sh
[fs/lustre-release.git] / lustre / tests / run_dbench.sh
1 #!/bin/bash
2
3 TMP=${TMP:-/tmp}
4
5 TESTLOG_PREFIX=${TESTLOG_PREFIX:-$TMP/recovery-mds-scale}
6 TESTNAME=${TESTNAME:-""}
7 [ -n "$TESTNAME" ] && TESTLOG_PREFIX=$TESTLOG_PREFIX.$TESTNAME
8
9 LOG=$TESTLOG_PREFIX.$(basename $0 .sh)_stdout.$(hostname -s).log
10 DEBUGLOG=$(echo $LOG | sed 's/\(.*\)stdout/\1debug/')
11
12 mkdir -p ${LOG%/*}
13
14 rm -f $LOG $DEBUGLOG
15 exec 2>$DEBUGLOG
16 set -x
17
18 . $(dirname $0)/functions.sh
19
20 assert_env MOUNT END_RUN_FILE LOAD_PID_FILE
21
22 trap signaled TERM
23
24 # recovery-*-scale scripts use this to signal the client loads to die
25 echo $$ >$LOAD_PID_FILE
26
27 TESTDIR=$MOUNT/d0.dbench-$(hostname)
28
29 CONTINUE=true
30
31 while [ ! -e "$END_RUN_FILE" ] && $CONTINUE; do
32         echoerr "$(date +'%F %H:%M:%S'): dbench run starting"
33
34         mkdir -p $TESTDIR
35
36         sync
37         rundbench -D $TESTDIR 2 1>$LOG &
38         load_pid=$!
39
40         wait $load_pid
41         if [ ${PIPESTATUS[0]} -eq 0 ]; then
42                 echoerr "$(date +'%F %H:%M:%S'): dbench succeeded"
43                 cd $TMP
44                 rm -rf $TESTDIR
45                 echoerr "$(date +'%F %H:%M:%S'): dbench run finished"
46         else
47                 echoerr "$(date +'%F %H:%M:%S'): dbench failed"
48                 if [ -z "$ERRORS_OK" ]; then
49                         echo $(hostname) >> $END_RUN_FILE
50                 fi
51
52                 if [ $BREAK_ON_ERROR ]; then
53                         # break
54                         CONTINUE=false
55                 fi
56         fi
57 done
58
59 echoerr "$(date +'%F %H:%M:%S'): dbench run exiting"