Whamcloud - gitweb
teach runregression-net.sh about echo_client
[fs/lustre-release.git] / lustre / tests / runregression-net.sh
1 #!/bin/sh
2 export PATH=/sbin:/usr/sbin:$PATH
3
4 SRCDIR="`dirname $0`/"
5 . $SRCDIR/common.sh
6
7 COUNT=${COUNT:-10000000}
8 COUNT_10=`expr $COUNT / 10`
9 COUNT_100=`expr $COUNT / 100`
10 COUNT_1000=`expr $COUNT / 1000`
11
12 ENDRUN=endrun-`hostname`
13
14 ECHONAME="`$OBDCTL device_list 2> /dev/null | awk '/ echo_client / { print $4 }' | tail -1`"
15
16 if [ -z "$ECHONAME" ]; then
17         echo "$0: needs an ECHO_CLIENT set up first" 1>&2
18         exit 1
19 fi
20
21 runthreads() {
22         THR=$1
23         DO=$2
24         CNT=$3
25         V=$4
26         PGS=$5
27
28         case $DO in
29         test_getattr)
30                 RW=
31
32         test_brw_write)
33                 DO=test_brw
34                 RW=w
35                 ;;
36
37         test_brw_read)
38                 DO=test_brw
39                 RW=r
40                 ;;
41         esac
42
43         $OBDCTL --threads $THR v \$$ECHONAME $DO $CNT $RW $V $PGS $OID || exit 1
44
45         if [ -e endrun ]; then
46                 rm endrun
47                 echo "exiting because endrun file was found"
48                 exit 0
49         fi
50 }
51
52 [ -z "$OID" ] && OID=`$OBDCTL --device \\$$ECHONAME create 1 | awk '/is object id/ { print $6 }'`
53 [ -z "$OID" ] && echo "error creating object" 1>&2 && exit 1
54
55 # TODO: obdctl needs to check on the progress of each forked thread
56 #       (IPC SHM, sockets?) to see if it hangs.
57 for CMD in test_getattr test_brw_write test_brw_read; do
58         case $CMD in
59         test_getattr)
60                 PG=
61                 PGV=
62                 ;;
63         test_brw_write)
64                 PG=1
65                 PGV=16
66                 ;;
67
68         test_brw_read)
69                 PG=1
70                 case $OSTNODE in
71                 ba*) PGV= ;; # disabled until the BA OST code is updated
72                 *) PGV=16 ;;
73                 esac
74                 ;;
75         esac
76
77         # We use '--threads 1 X' instead of '--device X' so that
78         # obdctl can monitor the forked thread for progress (TODO).
79         runthreads 1 $CMD 1 1 $PG
80         runthreads 1 $CMD 100 1 $PG
81
82         debug_server_off
83         debug_client_off
84         runthreads 1 $CMD $COUNT_100 -10 $PG
85         [ "$PGV" ] && runthreads 1 $CMD $COUNT_1000 -10 $PGV
86
87         runthreads 1 $CMD $COUNT -30 $PG
88         [ "$PGV" ] && runthreads 1 $CMD $COUNT_10 -30 $PGV
89
90         runthreads 1 $CMD 100 -10 $PG
91
92         runthreads 2 $CMD $COUNT_100 -30 $PG
93         [ "$PGV" ] && runthreads 2 $CMD $COUNT_1000 -30 $PGV
94
95         runthreads 2 $CMD $COUNT -30 $PG
96         [ "$PGV" ] && runthreads 2 $CMD $COUNT_10 -30 $PGV
97
98         runthreads 10 $CMD $COUNT_10 -30 $PG
99         [ "$PGV" ] && runthreads 10 $CMD $COUNT_100 -30 $PGV
100
101         runthreads 100 $CMD $COUNT_100 -30 $PG
102         [ "$PGV" ] && runthreads 100 $CMD $COUNT_1000 -30 $PGV
103 done
104
105 $OBDCTL --device \$$ECHONAME destroy $OID