Whamcloud - gitweb
LU-11388 test: disable replay-single test_131b
[fs/lustre-release.git] / lustre / tests / racer.sh
1 #!/bin/bash
2 #set -vx
3 set -e
4
5 ONLY=${ONLY:-"$*"}
6 LUSTRE=${LUSTRE:-$(cd $(dirname $0)/..; echo $PWD)}
7 . $LUSTRE/tests/test-framework.sh
8 init_test_env $@
9 . ${CONFIG:=$LUSTRE/tests/cfg/$NAME.sh}
10 init_logging
11
12 racer=$LUSTRE/tests/racer/racer.sh
13 echo racer: $racer with $MDSCOUNT MDTs
14
15 if [ "$SLOW" = "no" ]; then
16     DURATION=${DURATION:-300}
17 else
18     DURATION=${DURATION:-900}
19 fi
20 MOUNT_2=${MOUNT_2:-"yes"}
21
22 build_test_filter
23 check_and_setup_lustre
24
25 CLIENTS=${CLIENTS:-$HOSTNAME}
26 RACERDIRS=${RACERDIRS:-"$DIR $DIR2"}
27 echo RACERDIRS=$RACERDIRS
28
29 #LU-4684
30 RACER_ENABLE_MIGRATION=false
31
32 if ((MDSCOUNT > 1 &&
33      $(lustre_version_code $SINGLEMDS) >= $(version_code 2.8.0))); then
34         RACER_ENABLE_REMOTE_DIRS=${RACER_ENABLE_REMOTE_DIRS:-true}
35         RACER_ENABLE_STRIPED_DIRS=${RACER_ENABLE_STRIPED_DIRS:-true}
36         RACER_ENABLE_MIGRATION=${RACER_ENABLE_MIGRATION:-true}
37 elif ((MDSCOUNT > 1 &&
38        $(lustre_version_code $SINGLEMDS) >= $(version_code 2.5.0))); then
39         RACER_ENABLE_REMOTE_DIRS=${RACER_ENABLE_REMOTE_DIRS:-true}
40 fi
41
42 [[ $(lustre_version_code $SINGLEMDS) -lt $(version_code 2.9.54) ||
43    $(facet_fstype mgs) != zfs ]] && RACER_ENABLE_SNAPSHOT=false
44
45 [[ $(lustre_version_code $SINGLEMDS) -le $(version_code 2.9.55) ]] &&
46         RACER_ENABLE_PFL=false
47
48 [[ $(lustre_version_code $SINGLEMDS) -le $(version_code 2.10.53) ]] &&
49         RACER_ENABLE_DOM=false
50
51 [[ $(lustre_version_code $SINGLEMDS) -lt $(version_code 2.10.55) ]] &&
52         RACER_ENABLE_FLR=false
53
54 RACER_ENABLE_REMOTE_DIRS=${RACER_ENABLE_REMOTE_DIRS:-false}
55 RACER_ENABLE_STRIPED_DIRS=${RACER_ENABLE_STRIPED_DIRS:-false}
56 RACER_ENABLE_MIGRATION=${RACER_ENABLE_MIGRATION:-false}
57 RACER_ENABLE_SNAPSHOT=${RACER_ENABLE_SNAPSHOT:-true}
58 RACER_ENABLE_PFL=${RACER_ENABLE_PFL:-true}
59 RACER_ENABLE_DOM=${RACER_ENABLE_DOM:-true}
60 RACER_ENABLE_FLR=${RACER_ENABLE_FLR:-true}
61
62 check_progs_installed $CLIENTS $racer ||
63         { skip_env "$racer not found" && exit 0; }
64
65 # run racer
66 test_1() {
67         local rrc=0
68         local rc=0
69         local clients=$CLIENTS
70         local RDIRS
71         local i
72
73         for d in ${RACERDIRS}; do
74                 is_mounted $d || continue
75
76                 RDIRS="$RDIRS $d/racer"
77                 mkdir -p $d/racer
78         #       lfs setstripe $d/racer -c -1
79                 if [ $MDSCOUNT -ge 2 ]; then
80                         for i in $(seq $((MDSCOUNT - 1))); do
81                                 RDIRS="$RDIRS $d/racer$i"
82                                 if [ ! -e $d/racer$i ]; then
83                                         $LFS mkdir -i $i $d/racer$i ||
84                                                 error "lfs mkdir $i failed"
85                                 fi
86                         done
87                 fi
88         done
89
90         local rpids=""
91         for rdir in $RDIRS; do
92                 do_nodes $clients "DURATION=$DURATION \
93                         MDSCOUNT=$MDSCOUNT OSTCOUNT=$OSTCOUNT\
94                         RACER_ENABLE_REMOTE_DIRS=$RACER_ENABLE_REMOTE_DIRS \
95                         RACER_ENABLE_STRIPED_DIRS=$RACER_ENABLE_STRIPED_DIRS \
96                         RACER_ENABLE_MIGRATION=$RACER_ENABLE_MIGRATION \
97                         RACER_ENABLE_PFL=$RACER_ENABLE_PFL \
98                         RACER_ENABLE_DOM=$RACER_ENABLE_DOM \
99                         RACER_ENABLE_FLR=$RACER_ENABLE_FLR \
100                         LFS=$LFS \
101                         $racer $rdir $NUM_RACER_THREADS" &
102                 pid=$!
103                 rpids="$rpids $pid"
104         done
105
106         local lss_pids=""
107         if $RACER_ENABLE_SNAPSHOT; then
108                 lss_gen_conf
109
110                 $LUSTRE/tests/racer/lss_create.sh &
111                 pid=$!
112                 lss_pids="$lss_pids $pid"
113
114                 $LUSTRE/tests/racer/lss_destroy.sh &
115                 pid=$!
116                 lss_pids="$lss_pids $pid"
117         fi
118
119         echo racers pids: $rpids
120         for pid in $rpids; do
121                 wait $pid
122                 rc=$?
123                 echo "pid=$pid rc=$rc"
124                 if [ $rc != 0 ]; then
125                     rrc=$((rrc + 1))
126                 fi
127         done
128
129         if $RACER_ENABLE_SNAPSHOT; then
130                 killall -q lss_create.sh
131                 killall -q lss_destroy.sh
132
133                 for pid in $lss_pids; do
134                         wait $pid
135                 done
136
137                 lss_cleanup
138         fi
139
140         return $rrc
141 }
142 run_test 1 "racer on clients: ${CLIENTS:-$(hostname)} DURATION=$DURATION"
143
144 complete $SECONDS
145 check_and_cleanup_lustre
146 exit_status