File: client-controller

package info (click to toggle)
polyorb 2.11~20140418-3
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 30,012 kB
  • ctags: 465
  • sloc: ada: 273,015; sh: 4,507; makefile: 4,265; python: 1,332; cpp: 1,213; java: 507; ansic: 274; xml: 30; perl: 23; exp: 6
file content (168 lines) | stat: -rwxr-xr-x 4,508 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
#! /bin/sh

# A simple script to launch an automated test run.
# Highly dependant on the local setup.
# $Id: client-controller 34164 2002-12-04 01:18:53Z quinot $

ab_names=/infres/shalmaneser/quinot/projects/droopi/cos/naming/ab_names
serverp=/infres/shalmaneser/quinot/projects/droopi/examples/bbs/serverp
serverp_conf=/infres/shalmaneser/quinot/projects/droopi/examples/bbs/serverp.conf
evolutedp=/infres/ir10/astre/quinot/polyorb-sparc/build/examples/bbs/evolutedp
evolutedp_conf=/infres/shalmaneser/quinot/projects/droopi/examples/bbs/evolutedp.conf
output=/infres/shalmaneser/quinot/polyorb-output

Revolutedp_pids=""

sol8_hosts=valjean:cosette:fadette:roland:isengrin:candide:fracasse:donjuan:chimene:elvire:gavroche:lantier:folcoche:quasimodo:
#cyrano:

sol9_hosts=nadja:blizzard:aurelien:goriot:esmeralda:esmeralda2:rodrigue:vautrin:arsene:javert:

hosts=$sol8_hosts

nhosts=`echo $hosts | tr -cd : | wc -c`
size=100
count=100
cli_per_host=1
nmax=$nhosts
ulimit -c unlimited
kill=false
broadcast=""

while getopts bks:c:n:N: opt; do
  case "$opt" in
    k) kill=true ;;
    b) broadcast="-b" ;;
    s) size=$OPTARG ;;
    c) count=$OPTARG ;;
    N) cli_per_host=$OPTARG ;;
    n) nmax=$OPTARG ;;
    *) echo "invalid parameter"; exit 1;;
  esac
done

if [ "$nmax" -gt `expr "$nhosts" '*' "$cli_per_host"` ]; then
  echo "Too many total clients ($nhosts hosts, $cli_per_host clients each".
  exit 1
fi

if $kill; then
  IFS=:
  for h in $hosts; do
    if [ "$h" != "" ]; then
      echo $h
      rsh $h "/usr/ucb/ps axuw|grep 'quinot.*$evolutedp' | grep -v grep \
         | awk '{print \$2}' | xargs kill -9 2> /dev/null || echo ---"
    fi
  done
  ps axw|grep "tail -f /tmp/cli"|awk '{print $1}'|xargs kill 2> /dev/null
  exit 0
fi

now=`date +"%F_%T" | tr -d :`
output=$output/$now
mkdir $output

(
  echo "output=$output"
  echo "size=$size"
  echo "count=$count"
  echo "nmax=$nmax"
  echo "cli_per_host=$cli_per_host"
  if [ "$brodcast" = "-b" ]; then
    echo "broadcast=true"
  else
    echo "broadcast=false"
  fi
) > $output/00PARAMETERS

echo "000 init"
sed "s/^/    /" $output/00PARAMETERS
cp $ab_names_conf $serverp_conf $evolutedp_conf $output 2> /dev/null || true
trap 'echo kill $ab_names_pid $serverp_pid $Revolutedp_pids;
           kill -9 $ab_names_pid $serverp_pid $Revolutedp_pids;
           exit' 0 2 15

echo "001 Starting name server..."

touch $output/ab_names.out
POLYORB_CONF=$ab_names_conf $ab_names > $output/ab_names.out 2> /dev/null &
ab_names_pid=$!
while ! grep POLYORB_CORBA_NAMING_IOR $output/ab_names.out; do
  sleep 5
done
. $output/ab_names.out
export POLYORB_CORBA_NAMING_IOR

echo "002 Starting server partition..."
POLYORB_CONF=$serverp_conf $serverp > $output/serverp.out 2>&1 &
serverp_pid=$!
sleep 5

clinumber=0
hostnumber=0
while [ "$hostnumber" -lt "$nhosts" -a "$clinumber" -lt "$nmax" ]; do
  eval `echo $hosts | sed 's/^\([^:]*\):\(.*\)$/host=\1;hosts=\2/'`
  ping -c 2 $host > /dev/null || continue

  cli_thishost=0
  while [ "$cli_thishost" -lt "$cli_per_host" -a "$clinumber" -lt "$nmax" ]; do
    ctl=/tmp/cli${clinumber}_ctl
    rm -f $ctl
    mkfifo $ctl
    cliout=$output/cli$clinumber-$host 
    touch $cliout
    cliouts="$cliouts $cliout"
    echo `expr 100 + $clinumber`" Starting client $clinumber on $host"
    sh -c "tail -f $ctl | rsh $host \"ulimit -c unlimited;TERM=dumb \
      POLYORB_CORBA_NAMING_IOR=$POLYORB_CORBA_NAMING_IOR \
      POLYORB_CONF=$evolutedp_conf \
      LD_LIBRARY_PATH=/usr/local/lib \
      $evolutedp $broadcast -n $nmax -c $count -s $size TEST_$clinumber 2>&1 \" \
        >> $cliout" &
    Revolutedp_pids="$Revolutedp_pids $!"
    eval "cli_host_$clinumber=$h"
    clinumber=`expr $clinumber + 1`
    cli_thishost=`expr $cli_thishost + 1`
  done
done

echo "200 Waiting for clients to become ready."
retries=0
while [ "`grep -L Ready $cliouts`" != "" -a "$retries" -lt 60 ]; do
  retries=`expr $retries + 1`
  sleep 2
done
if [ "$retries" -ge 60 ]; then
  echo "222 Timed out"
  $0 -k
  exit 1
fi

echo "201 GO!"
date
i=0
while [ $i -lt $clinumber ]; do
  echo "" > /tmp/cli${i}_ctl &
  i=`expr $i + 1`
done
date

echo "202 Waiting for clients to complete."
while true; do
  if [ "`grep -L 'Elapsed :' $cliouts`" = "" ]; then
     echo "555 Success."
     echo OK > $output/98STATUS
     break
  fi

  if egrep -i 'Raised|STORAGE|ASSERT' $cliouts > /dev/null; then
    echo "666 Exception."
    echo FAIL > $output/98STATUS
    break
  fi
  sleep 5
done
date
echo "888 Completed, cleaning up."
$0 -k