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