Whamcloud - gitweb
b=20877 disable test_12 of sanity-quota.sh
[fs/lustre-release.git] / lustre / tests / run_tar.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.tar-$(hostname)
25
26 do_tar() {
27     tar cf - /etc | tar xf - 2>&1 | tee $LOG
28     return ${PIPESTATUS[1]}
29 }
30
31 CONTINUE=true
32 while [ ! -e "$END_RUN_FILE" ] && $CONTINUE; do
33     echoerr "$(date +'%F %H:%M:%S'): tar run starting"
34     mkdir -p $TESTDIR
35     cd $TESTDIR
36     do_tar &
37     wait $!
38     RC=$?
39     PREV_ERRORS=$(grep "exit delayed from previous errors" $LOG) || true
40     if [ $RC -ne 0 -a "$ERRORS_OK" -a "$PREV_ERRORS" ]; then
41         echoerr "$(date +'%F %H:%M:%S'): tar errors earlier, ignoring"
42         RC=0
43     fi
44     if [ $RC -eq 0 ]; then
45         echoerr "$(date +'%F %H:%M:%S'): tar succeeded"
46         cd $TMP
47         rm -rf $TESTDIR
48         echoerr "$(date +'%F %H:%M:%S'): tar run finished"
49     else
50         echoerr "$(date +'%F %H:%M:%S'): tar failed"
51         if [ -z "$ERRORS_OK" ]; then
52             echo $(hostname) >> $END_RUN_FILE
53         fi
54         if [ $BREAK_ON_ERROR ]; then
55             # break
56             CONTINUE=false
57         fi
58     fi
59 done
60
61 echoerr "$(date +'%F %H:%M:%S'): tar run exiting"