Whamcloud - gitweb
d50150e7b7ed1d5353cbbf54c0ef9dadad304d67
[fs/lustre-release.git] / lustre / tests / run_dd.sh
1 #!/bin/bash
2 set -x
3
4 TMP=${TMP:-/tmp}
5
6 TESTSUITELOG=${TESTSUITELOG:-$TMP/recovery-mds-scale}
7 LOG=${TESTSUITELOG}_$(basename $0)-$(hostname)
8 DEBUGLOG=${LOG}.debug
9
10 mkdir -p ${LOG%/*}
11
12 rm -f $LOG $DEBUGLOG
13 exec 2>$DEBUGLOG
14
15 . $(dirname $0)/functions.sh
16
17 assert_env MOUNT END_RUN_FILE LOAD_PID_FILE
18
19 trap signaled TERM
20
21 # recovery-*-scale scripts use this to signal the client loads to die
22 echo $$ >$LOAD_PID_FILE
23
24 TESTDIR=$MOUNT/d0.dd-$(hostname)
25
26 CONTINUE=true
27 while [ ! -e "$END_RUN_FILE" ] && $CONTINUE; do
28     echoerr "$(date +'%F %H:%M:%S'): dd run starting"
29     mkdir -p $TESTDIR
30     cd $TESTDIR
31     dd bs=4k count=1000000 if=/dev/zero of=$TESTDIR/dd-file 1>$LOG &
32     load_pid=$!
33     wait $load_pid
34
35     if [ $? -eq 0 ]; then
36         echoerr "$(date +'%F %H:%M:%S'): dd succeeded"
37         cd $TMP
38         rm -rf $TESTDIR
39         echoerr "$(date +'%F %H:%M:%S'): dd run finished"
40     else
41         echoerr "$(date +'%F %H:%M:%S'): dd failed"
42         if [ -z "$ERRORS_OK" ]; then
43             echo $(hostname) >> $END_RUN_FILE
44         fi
45         if [ $BREAK_ON_ERROR ]; then
46             # break
47             CONTINUE=false
48         fi
49     fi
50 done
51
52 echoerr "$(date +'%F %H:%M:%S'): dd run exiting"