Whamcloud - gitweb
LU-1538 tests: sanity/101d to check available space
[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
30 check_progs_installed $CLIENTS $racer ||
31         { skip_env "$racer not found" && exit 0; }
32
33 # run racer
34 test_1() {
35         local rrc=0
36         local rc=0
37         local clients=$CLIENTS
38         local RDIRS
39         local i
40
41         for d in ${RACERDIRS}; do
42                 is_mounted $d || continue
43
44                 RDIRS="$RDIRS $d/racer"
45                 mkdir -p $d/racer
46         #       lfs setstripe $d/racer -c -1
47                 if [ $MDSCOUNT -ge 2 ]; then
48                         for i in $(seq $((MDSCOUNT - 1))); do
49                                 RDIRS="$RDIRS $d/racer$i"
50                                 if [ ! -e $d/racer$i ]; then
51                                         $LFS mkdir -i $i $d/racer$i ||
52                                                 error "lfs mkdir $i failed"
53                                 fi
54                         done
55                 fi
56         done
57
58         local rpids=""
59         for rdir in $RDIRS; do
60                 do_nodes $clients "DURATION=$DURATION MDSCOUNT=$MDSCOUNT \
61                                    $racer $rdir $NUM_RACER_THREADS" &
62                 pid=$!
63                 rpids="$rpids $pid"
64         done
65
66         echo racers pids: $rpids
67         for pid in $rpids; do
68                 wait $pid
69                 rc=$?
70                 echo "pid=$pid rc=$rc"
71                 if [ $rc != 0 ]; then
72                     rrc=$((rrc + 1))
73                 fi
74         done
75
76         return $rrc
77 }
78 run_test 1 "racer on clients: ${CLIENTS:-$(hostname)} DURATION=$DURATION"
79
80 complete $SECONDS
81 check_and_cleanup_lustre
82 exit_status