Whamcloud - gitweb
LU-8851 nodemap: add uid/gid only flags to control mapping
[fs/lustre-release.git] / lustre / tests / run_IOR.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 IOR=${IOR:-"$(which IOR)"}
21
22 assert_env MOUNT END_RUN_FILE LOAD_PID_FILE IOR
23
24 trap signaled TERM
25
26 # if MACHINEFILE set and exists -- use it
27 if [ -z $MACHINEFILE ] || [ ! -e $MACHINEFILE ]; then
28     MACHINEFILE=$TMP/$(basename $0)-$(hostname).machines
29     echo $(hostname) >$MACHINEFILE
30 fi
31
32 THREADS_PER_CLIENT=${THREADS_PER_CLIENT:-3}
33 NUM_CLIENTS=$(cat $MACHINEFILE | wc -l)
34
35 # recovery-*-scale scripts use this to signal the client loads to die
36 echo $$ >$LOAD_PID_FILE
37
38 TESTDIR=${TESTDIR:-$MOUNT/d0.ior-$(hostname)}
39
40 CONTINUE=true
41 while [ ! -e "$END_RUN_FILE" ] && $CONTINUE; do
42         echoerr "$(date +'%F %H:%M:%S'): IOR run starting"
43         mkdir -p $TESTDIR
44         # need this only if TESTDIR is not default
45         chmod -R 777 $TESTDIR
46
47         sync
48         mpi_run ${MACHINEFILE_OPTION} ${MACHINEFILE} \
49                 -np $((NUM_CLIENTS * THREADS_PER_CLIENT)) $IOR -a POSIX -b 1g \
50                 -o $TESTDIR/IOR-file -s 1 -t 1m -v -w -r 1>$LOG &
51
52         load_pid=$!
53         wait $load_pid
54         if [ ${PIPESTATUS[0]} -eq 0 ]; then
55                 echoerr "$(date +'%F %H:%M:%S'): IOR succeeded"
56                 cd $TMP
57                 rm -rf $TESTDIR
58                 echoerr "$(date +'%F %H:%M:%S'): IOR run finished"
59         else
60                 echoerr "$(date +'%F %H:%M:%S'): IOR failed"
61                 if [ -z "$ERRORS_OK" ]; then
62                         echo $(hostname) >> $END_RUN_FILE
63                 fi
64                 if [ $BREAK_ON_ERROR ]; then
65                         # break
66                         CONTINUE=false
67                 fi
68         fi
69 done
70
71 echoerr "$(date +'%F %H:%M:%S'): IOR run exiting"