1 eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}'
2 & eval 'exec perl -S $0 $argv:q'
7 use lib
"$ENV{ACE_ROOT}/bin";
8 use PerlACE
::TestTarget
;
19 my $server = PerlACE
::TestTarget
::create_target
(1) || die "Create target 1 failed\n";
20 my $client1 = PerlACE
::TestTarget
::create_target
(2) || die "Create target 2 failed\n";
21 my $client2 = PerlACE
::TestTarget
::create_target
(3) || die "Create target 3 failed\n";
22 my $client3 = PerlACE
::TestTarget
::create_target
(4) || die "Create target 4 failed\n";
23 my $client4 = PerlACE
::TestTarget
::create_target
(5) || die "Create target 5 failed\n";
24 my $client5 = PerlACE
::TestTarget
::create_target
(6) || die "Create target 6 failed\n";
25 my $client6 = PerlACE
::TestTarget
::create_target
(7) || die "Create target 7 failed\n";
26 my $client7 = PerlACE
::TestTarget
::create_target
(8) || die "Create target 8 failed\n";
27 my $client8 = PerlACE
::TestTarget
::create_target
(9) || die "Create target 9 failed\n";
28 my $client9 = PerlACE
::TestTarget
::create_target
(10) || die "Create target 10 failed\n";
30 my $iorbase = "server.ior";
31 my $server_iorfile = $server->LocalFile ($iorbase);
32 my $client1_iorfile = $client1->LocalFile ($iorbase);
33 my $client2_iorfile = $client2->LocalFile ($iorbase);
34 my $client3_iorfile = $client3->LocalFile ($iorbase);
35 my $client4_iorfile = $client4->LocalFile ($iorbase);
36 my $client5_iorfile = $client5->LocalFile ($iorbase);
37 my $client6_iorfile = $client6->LocalFile ($iorbase);
38 my $client7_iorfile = $client7->LocalFile ($iorbase);
39 my $client8_iorfile = $client8->LocalFile ($iorbase);
40 my $client9_iorfile = $client9->LocalFile ($iorbase);
41 $server->DeleteFile($iorbase);
42 $client1->DeleteFile($iorbase);
43 $client2->DeleteFile($iorbase);
44 $client3->DeleteFile($iorbase);
45 $client4->DeleteFile($iorbase);
46 $client5->DeleteFile($iorbase);
47 $client6->DeleteFile($iorbase);
48 $client7->DeleteFile($iorbase);
49 $client8->DeleteFile($iorbase);
50 $client9->DeleteFile($iorbase);
52 my $hostname = $server->HostName ();
54 $SV = $server->CreateProcess ("MessengerServer",
55 "-ORBdebuglevel $debug_level " .
56 "-ORBListenEndpoints iiop://$hostname " .
57 "-o $server_iorfile");
58 $CL1 = $client1->CreateProcess ("MessengerClient", "-k file://$client1_iorfile");
59 $CL2 = $client2->CreateProcess ("MessengerClient", "-k file://$client2_iorfile");
60 $CL3 = $client3->CreateProcess ("MessengerClient", "-k file://$client3_iorfile");
61 $CL4 = $client4->CreateProcess ("MessengerClient", "-k file://$client4_iorfile");
62 $CL5 = $client5->CreateProcess ("MessengerClient", "-k file://$client5_iorfile");
63 $CL6 = $client6->CreateProcess ("MessengerClient", "-k file://$client6_iorfile");
64 $CL7 = $client7->CreateProcess ("MessengerClient", "-k file://$client7_iorfile");
65 $CL8 = $client8->CreateProcess ("MessengerClient", "-k file://$client8_iorfile");
66 $CL9 = $client9->CreateProcess ("MessengerClient", "-k file://$client9_iorfile");
68 print STDOUT
"Starting MessengerServer\n";
69 $server_status = $SV->Spawn ();
71 if ($server_status != 0) {
72 print STDERR
"ERROR: server returned $server_status\n";
76 if ($server->WaitForFileTimed ($iorbase,
77 $server->ProcessStartWaitInterval()) == -1) {
78 print STDERR
"ERROR: cannot find file <$server_iorfile>\n";
79 $SV->Kill (); $SV->TimedWait (1);
83 if ($server->GetFile ($iorbase) == -1) {
84 print STDERR
"ERROR: cannot retrieve file <$server_iorfile>\n";
85 $SV->Kill (); $SV->TimedWait (1);
88 if ($client1->PutFile ($iorbase) == -1) {
89 print STDERR
"ERROR: cannot set file <$client1_iorfile>\n";
90 $SV->Kill (); $SV->TimedWait (1);
93 if ($client2->PutFile ($iorbase) == -1) {
94 print STDERR
"ERROR: cannot set file <$client2_iorfile>\n";
95 $SV->Kill (); $SV->TimedWait (1);
98 if ($client3->PutFile ($iorbase) == -1) {
99 print STDERR
"ERROR: cannot set file <$client3_iorfile>\n";
100 $SV->Kill (); $SV->TimedWait (1);
103 if ($client4->PutFile ($iorbase) == -1) {
104 print STDERR
"ERROR: cannot set file <$client4_iorfile>\n";
105 $SV->Kill (); $SV->TimedWait (1);
108 if ($client5->PutFile ($iorbase) == -1) {
109 print STDERR
"ERROR: cannot set file <$client5_iorfile>\n";
110 $SV->Kill (); $SV->TimedWait (1);
113 if ($client6->PutFile ($iorbase) == -1) {
114 print STDERR
"ERROR: cannot set file <$client6_iorfile>\n";
115 $SV->Kill (); $SV->TimedWait (1);
118 if ($client7->PutFile ($iorbase) == -1) {
119 print STDERR
"ERROR: cannot set file <$client7_iorfile>\n";
120 $SV->Kill (); $SV->TimedWait (1);
123 if ($client8->PutFile ($iorbase) == -1) {
124 print STDERR
"ERROR: cannot set file <$client8_iorfile>\n";
125 $SV->Kill (); $SV->TimedWait (1);
128 if ($client9->PutFile ($iorbase) == -1) {
129 print STDERR
"ERROR: cannot set file <$client9_iorfile>\n";
130 $SV->Kill (); $SV->TimedWait (1);
134 print STDOUT
"\n\nStarting 9 MessengerClients.\n";
135 print STDOUT
"The server should use different threads to handle requests.\n\n";
137 $client_status = $CL1->Spawn ();
139 if ($client_status != 0) {
140 print STDERR
"ERROR: client returned $client_status\n";
141 $SV->Kill (); $SV->TimedWait (1);
145 $client_status = $CL2->Spawn ();
147 if ($client_status != 0) {
148 print STDERR
"ERROR: client returned $client_status\n";
149 $SV->Kill (); $SV->TimedWait (1);
150 $CL1->Kill (); $CL1->TimedWait (1);
154 $client_status = $CL3->Spawn ();
156 if ($client_status != 0) {
157 print STDERR
"ERROR: client returned $client_status\n";
158 $SV->Kill (); $SV->TimedWait (1);
159 $CL1->Kill (); $CL1->TimedWait (1);
160 $CL2->Kill (); $CL2->TimedWait (1);
164 $client_status = $CL4->Spawn ();
166 if ($client_status != 0) {
167 print STDERR
"ERROR: client returned $client_status\n";
168 $SV->Kill (); $SV->TimedWait (1);
169 $CL1->Kill (); $CL1->TimedWait (1);
170 $CL2->Kill (); $CL2->TimedWait (1);
171 $CL3->Kill (); $CL3->TimedWait (1);
175 $client_status = $CL5->Spawn ();
177 if ($client_status != 0) {
178 print STDERR
"ERROR: client returned $client_status\n";
179 $SV->Kill (); $SV->TimedWait (1);
180 $CL1->Kill (); $CL1->TimedWait (1);
181 $CL2->Kill (); $CL2->TimedWait (1);
182 $CL3->Kill (); $CL3->TimedWait (1);
183 $CL4->Kill (); $CL4->TimedWait (1);
187 $client_status = $CL6->Spawn ();
189 if ($client_status != 0) {
190 print STDERR
"ERROR: client returned $client_status\n";
191 $SV->Kill (); $SV->TimedWait (1);
192 $CL1->Kill (); $CL1->TimedWait (1);
193 $CL2->Kill (); $CL2->TimedWait (1);
194 $CL3->Kill (); $CL3->TimedWait (1);
195 $CL4->Kill (); $CL4->TimedWait (1);
196 $CL5->Kill (); $CL5->TimedWait (1);
200 $client_status = $CL7->Spawn ();
202 if ($client_status != 0) {
203 print STDERR
"ERROR: client returned $client_status\n";
204 $SV->Kill (); $SV->TimedWait (1);
205 $CL1->Kill (); $CL1->TimedWait (1);
206 $CL2->Kill (); $CL2->TimedWait (1);
207 $CL3->Kill (); $CL3->TimedWait (1);
208 $CL4->Kill (); $CL4->TimedWait (1);
209 $CL5->Kill (); $CL5->TimedWait (1);
210 $CL6->Kill (); $CL6->TimedWait (1);
214 $client_status = $CL8->Spawn ();
216 if ($client_status != 0) {
217 print STDERR
"ERROR: client returned $client_status\n";
218 $SV->Kill (); $SV->TimedWait (1);
219 $CL1->Kill (); $CL1->TimedWait (1);
220 $CL2->Kill (); $CL2->TimedWait (1);
221 $CL3->Kill (); $CL3->TimedWait (1);
222 $CL4->Kill (); $CL4->TimedWait (1);
223 $CL5->Kill (); $CL5->TimedWait (1);
224 $CL6->Kill (); $CL6->TimedWait (1);
225 $CL7->Kill (); $CL7->TimedWait (1);
229 $client_status = $CL9->Spawn ();
231 if ($client_status != 0) {
232 print STDERR
"ERROR: client returned $client_status\n";
233 $SV->Kill (); $SV->TimedWait (1);
234 $CL1->Kill (); $CL1->TimedWait (1);
235 $CL2->Kill (); $CL2->TimedWait (1);
236 $CL3->Kill (); $CL3->TimedWait (1);
237 $CL4->Kill (); $CL4->TimedWait (1);
238 $CL5->Kill (); $CL5->TimedWait (1);
239 $CL6->Kill (); $CL6->TimedWait (1);
240 $CL7->Kill (); $CL7->TimedWait (1);
241 $CL8->Kill (); $CL8->TimedWait (1);
245 $client_status = $CL1->WaitKill ($client1->ProcessStopWaitInterval());
247 if ($client_status != 0) {
248 print STDERR
"ERROR: client returned $client_status\n";
252 $client_status = $CL2->WaitKill ($client2->ProcessStopWaitInterval());
254 if ($client_status != 0) {
255 print STDERR
"ERROR: client returned $client_status\n";
259 $client_status = $CL3->WaitKill ($client3->ProcessStopWaitInterval());
261 if ($client_status != 0) {
262 print STDERR
"ERROR: client returned $client_status\n";
266 $client_status = $CL4->WaitKill ($client4->ProcessStopWaitInterval());
268 if ($client_status != 0) {
269 print STDERR
"ERROR: client returned $client_status\n";
273 $client_status = $CL5->WaitKill ($client5->ProcessStopWaitInterval());
275 if ($client_status != 0) {
276 print STDERR
"ERROR: client returned $client_status\n";
280 $client_status = $CL6->WaitKill ($client6->ProcessStopWaitInterval());
282 if ($client_status != 0) {
283 print STDERR
"ERROR: client returned $client_status\n";
287 $client_status = $CL7->WaitKill ($client7->ProcessStopWaitInterval());
289 if ($client_status != 0) {
290 print STDERR
"ERROR: client returned $client_status\n";
294 $client_status = $CL8->WaitKill ($client8->ProcessStopWaitInterval());
296 if ($client_status != 0) {
297 print STDERR
"ERROR: client returned $client_status\n";
301 $client_status = $CL9->WaitKill ($client9->ProcessStopWaitInterval());
303 if ($client_status != 0) {
304 print STDERR
"ERROR: client returned $client_status\n";
310 $server->DeleteFile($iorbase);
311 $client1->DeleteFile($iorbase);
312 $client2->DeleteFile($iorbase);
313 $client3->DeleteFile($iorbase);
314 $client4->DeleteFile($iorbase);
315 $client5->DeleteFile($iorbase);
316 $client6->DeleteFile($iorbase);
317 $client7->DeleteFile($iorbase);
318 $client8->DeleteFile($iorbase);
319 $client9->DeleteFile($iorbase);