Whamcloud - gitweb
LU-14880 libcfs: Use crypto/sha2.h if available
[fs/lustre-release.git] / lustre / tests / run_iozone.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.iozone-$(hostname)
28
29 CONTINUE=true
30 while [ ! -e "$END_RUN_FILE" ] && $CONTINUE; do
31         echoerr "$(date +'%F %H:%M:%S'): iozone run starting"
32         mkdir -p $TESTDIR
33         cd $TESTDIR
34
35         sync
36         iozone -a -M -R -V 0xab -g 100M -q 512k -i0 -i1 \
37                                         -f $TESTDIR/iozone-file 1>$LOG &
38         load_pid=$!
39         wait $load_pid
40         if [ ${PIPESTATUS[0]} -eq 0 ]; then
41                 echoerr "$(date +'%F %H:%M:%S'): iozone succeeded"
42                 cd $TMP
43                 rm -rf $TESTDIR
44                 if [ -d $TESTDIR ]; then
45                         echoerr "$(date +'%F %H:%M:%S'): failed to remove \
46                                                                  $TESTDIR"
47                         echo $(hostname) >> $END_RUN_FILE
48                         CONTINUE=false
49                 fi
50                 echoerr "$(date +'%F %H:%M:%S'): iozone run finished"
51         else
52                 echoerr "$(date +'%F %H:%M:%S'): iozone failed"
53                 if [ -z "$ERRORS_OK" ]; then
54                         echo $(hostname) >> $END_RUN_FILE
55                 fi
56                 if [ $BREAK_ON_ERROR ]; then
57                         # break
58                         CONTINUE=false
59                 fi
60         fi
61 done
62
63 echoerr "$(date +'%F %H:%M:%S'): iozone run exiting"