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