Merge pull request #2309 from mitza-oci/warnings
[ACE_TAO.git] / TAO / orbsvcs / tests / AVStreams / Component_Switching / run_test.pl
blob253923f098bf54aa08fb425ea44438b0dd4cbd97
1 eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}'
2 & eval 'exec perl -S $0 $argv:q'
3 if 0;
5 # -*- perl -*-
7 use lib "$ENV{ACE_ROOT}/bin";
8 use PerlACE::TestTarget;
9 use File::stat;
11 $status = 0;
12 $debug_level = '0';
14 foreach $i (@ARGV) {
15 if ($i eq '-debug') {
16 $debug_level = '10';
20 my $ns = PerlACE::TestTarget::create_target (1) || die "Create target 1 failed\n";
21 my $sv1 = PerlACE::TestTarget::create_target (2) || die "Create target 2 failed\n";
22 my $sv2 = PerlACE::TestTarget::create_target (3) || die "Create target 3 failed\n";
23 my $sv3 = PerlACE::TestTarget::create_target (4) || die "Create target 4 failed\n";
24 my $re1 = PerlACE::TestTarget::create_target (5) || die "Create target 5 failed\n";
25 my $re2 = PerlACE::TestTarget::create_target (6) || die "Create target 6 failed\n";
26 my $di1 = PerlACE::TestTarget::create_target (7) || die "Create target 7 failed\n";
27 my $di2 = PerlACE::TestTarget::create_target (8) || die "Create target 8 failed\n";
28 my $di3 = PerlACE::TestTarget::create_target (9) || die "Create target 9 failed\n";
29 my $di4 = PerlACE::TestTarget::create_target (10) || die "Create target 10 failed\n";
31 # amount of delay between running the servers
33 $sleeptime = 10;
34 $distributor_time = 8;
35 $sender_time = 8;
37 $nsiorfile = "ns.ior";
38 $outputfile1 = "output1";
39 $outputfile2 = "output2";
40 $inputfile = "test_input";
41 $conffile = "components_svc".$PerlACE::svcconf_ext;
43 my $ns_nsiorfile = $ns->LocalFile ($nsiorfile);
44 my $sv1_nsiorfile = $sv1->LocalFile ($nsiorfile);
45 my $sv2_nsiorfile = $sv2->LocalFile ($nsiorfile);
46 my $sv3_nsiorfile = $sv3->LocalFile ($nsiorfile);
47 my $re1_nsiorfile = $re1->LocalFile ($nsiorfile);
48 my $re2_nsiorfile = $re2->LocalFile ($nsiorfile);
49 my $di1_nsiorfile = $di1->LocalFile ($nsiorfile);
50 my $di2_nsiorfile = $di2->LocalFile ($nsiorfile);
51 my $di3_nsiorfile = $di3->LocalFile ($nsiorfile);
52 my $di4_nsiorfile = $di4->LocalFile ($nsiorfile);
53 my $sv1_conffile = $sv1->LocalFile ($conffile);
54 my $sv2_conffile = $sv2->LocalFile ($conffile);
55 my $sv3_conffile = $sv3->LocalFile ($conffile);
56 my $re1_conffile = $re1->LocalFile ($conffile);
57 my $re2_conffile = $re2->LocalFile ($conffile);
58 my $di1_conffile = $di1->LocalFile ($conffile);
59 my $di2_conffile = $di2->LocalFile ($conffile);
60 my $di3_conffile = $di3->LocalFile ($conffile);
61 my $di4_conffile = $di4->LocalFile ($conffile);
62 my $re1_outputfile1 = $re1->LocalFile ($outputfile1);
63 my $re2_outputfile2 = $re2->LocalFile ($outputfile2);
64 $ns->DeleteFile ($nsiorfile);
65 $sv1->DeleteFile ($nsiorfile);
66 $sv2->DeleteFile ($nsiorfile);
67 $sv3->DeleteFile ($nsiorfile);
68 $re1->DeleteFile ($nfsiorfile);
69 $re2->DeleteFile ($nfsiorfile);
70 $di1->DeleteFile ($nfsiorfile);
71 $di2->DeleteFile ($nfsiorfile);
72 $di3->DeleteFile ($nfsiorfile);
73 $di4->DeleteFile ($nfsiorfile);
74 $sv1->DeleteFile ($inputfile);
75 $sv2->DeleteFile ($inputfile);
76 $sv3->DeleteFile ($inputfile);
77 $re1->DeleteFile ($outputfile1);
78 $re2->DeleteFile ($outputfile2);
80 # generate test stream data
81 $inputfile = PerlACE::generate_test_file($inputfile, 102400);
82 my $sv1_inputfile = $sv1->LocalFile ($inputfile);
83 my $sv2_inputfile = $sv2->LocalFile ($inputfile);
84 my $sv3_inputfile = $sv3->LocalFile ($inputfile);
85 if ($sv1->PutFile ($inputfile) == -1) {
86 print STDERR "ERROR: cannot set file <$sv1_inputfile>\n";
87 exit 1;
89 if ($sv2->PutFile ($inputfile) == -1) {
90 print STDERR "ERROR: cannot set file <$sv2_inputfile>\n";
91 exit 1;
93 if ($sv3->PutFile ($inputfile) == -1) {
94 print STDERR "ERROR: cannot set file <$sv3_inputfile>\n";
95 exit 1;
98 $NS = $ns->CreateProcess ("$ENV{TAO_ROOT}/orbsvcs/Naming_Service/tao_cosnaming",
99 "-ORBDottedDecimalAddresses 1 ".
100 " -o $ns_nsiorfile");
101 $SV1 = $sv1->CreateProcess ("sender",
102 " -ORBDebugLevel $debug_level ".
103 "-ORBDottedDecimalAddresses 1 ".
104 " -ORBSvcConf $sv1_conffile ".
105 "-ORBInitRef NameService=file://$sv1_nsiorfile ".
106 "-s sender -r 30 ".
107 "-f $sv1_inputfile");
108 $SV2 = $sv2->CreateProcess ("sender",
109 " -ORBDebugLevel $debug_level ".
110 "-ORBDottedDecimalAddresses 1 ".
111 " -ORBSvcConf $sv2_conffile ".
112 "-ORBInitRef NameService=file://$sv2_nsiorfile ".
113 "-s sender -r 30 ".
114 "-f $sv2_inputfile");
115 $SV3 = $sv3->CreateProcess ("sender",
116 " -ORBDebugLevel $debug_level ".
117 "-ORBDottedDecimalAddresses 1 ".
118 " -ORBSvcConf $sv3_conffile ".
119 "-ORBInitRef NameService=file://$sv3_nsiorfile ".
120 "-s sender -r 30 ".
121 "-f $sv3_inputfile");
122 $RE1 = $re1->CreateProcess ("receiver",
123 "-ORBDottedDecimalAddresses 1 ".
124 " -ORBSvcConf $re1_conffile ".
125 "-ORBInitRef NameService=file://$re1_nsiorfile ".
126 "-s distributer -r receiver1 ".
127 "-f $re1_outputfile1");
128 $RE2 = $re2->CreateProcess ("receiver",
129 "-ORBDottedDecimalAddresses 1 ".
130 " -ORBSvcConf $re2_conffile ".
131 "-ORBInitRef NameService=file://$re2_nsiorfile ".
132 "-s distributer -r receiver2 ".
133 "-f $re2_outputfile2");
134 $DI1 = $di1->CreateProcess ("distributer",
135 "-ORBDottedDecimalAddresses 1 ".
136 " -ORBSvcConf $di1_conffile ".
137 "-ORBInitRef NameService=file://$di1_nsiorfile ".
138 "-s sender -r distributer ");
139 $DI2 = $di2->CreateProcess ("distributer",
140 "-ORBDottedDecimalAddresses 1 ".
141 " -ORBSvcConf $di2_conffile ".
142 "-ORBInitRef NameService=file://$di2_nsiorfile ".
143 "-s sender -r distributer ");
144 $DI3 = $di3->CreateProcess ("distributer",
145 "-ORBDottedDecimalAddresses 1 ".
146 " -ORBSvcConf $di3_conffile ".
147 "-ORBInitRef NameService=file://$di3_nsiorfile ".
148 "-s sender -r distributer ");
149 $DI4 = $di4->CreateProcess ("distributer",
150 "-ORBDottedDecimalAddresses 1 ".
151 " -ORBSvcConf $di4_conffile ".
152 "-ORBInitRef NameService=file://$di4_nsiorfile ".
153 "-s sender -r distributer ");
155 print STDERR "\nReceiver 1 --> Receiver 2 --> Distributer 1 --> Sender1 --> Distributer 2 --> Distributer 3 --> Sender2 --> Sender3 --> Distributer4\n\n";
157 print STDERR "Starting Naming Service\n";
158 $NS_status = $NS->Spawn ();
159 if ($NS_status != 0) {
160 print STDERR "ERROR: Name Service returned $NS_status\n";
161 exit 1;
163 if ($ns->WaitForFileTimed ($nsiorfile,$ns->ProcessStartWaitInterval()+45) == -1) {
164 print STDERR "ERROR: cannot find file <$ns_nsiorfile>\n";
165 $NS->Kill (); $NS->TimedWait (1);
166 exit 1;
169 if ($ns->GetFile ($nsiorfile) == -1) {
170 print STDERR "ERROR: cannot retrieve file <$ns_nsiorfile>\n";
171 $NS->Kill (); $NS->TimedWait (1);
172 exit 1;
174 if ($sv1->PutFile ($nsiorfile) == -1) {
175 print STDERR "ERROR: cannot set file <$sv1_nsiorfile>\n";
176 $NS->Kill (); $NS->TimedWait (1);
177 exit 1;
179 if ($sv2->PutFile ($nsiorfile) == -1) {
180 print STDERR "ERROR: cannot set file <$sv2_nsiorfile>\n";
181 $NS->Kill (); $NS->TimedWait (1);
182 exit 1;
184 if ($sv3->PutFile ($nsiorfile) == -1) {
185 print STDERR "ERROR: cannot set file <$sv3_nsiorfile>\n";
186 $NS->Kill (); $NS->TimedWait (1);
187 exit 1;
189 if ($re1->PutFile ($nsiorfile) == -1) {
190 print STDERR "ERROR: cannot set file <$re1_nsiorfile>\n";
191 $NS->Kill (); $NS->TimedWait (1);
192 exit 1;
194 if ($re2->PutFile ($nsiorfile) == -1) {
195 print STDERR "ERROR: cannot set file <$re2_nsiorfile>\n";
196 $NS->Kill (); $NS->TimedWait (1);
197 exit 1;
199 if ($di1->PutFile ($nsiorfile) == -1) {
200 print STDERR "ERROR: cannot set file <$di1_nsiorfile>\n";
201 $NS->Kill (); $NS->TimedWait (1);
202 exit 1;
204 if ($di2->PutFile ($nsiorfile) == -1) {
205 print STDERR "ERROR: cannot set file <$di2_nsiorfile>\n";
206 $NS->Kill (); $NS->TimedWait (1);
207 exit 1;
209 if ($di3->PutFile ($nsiorfile) == -1) {
210 print STDERR "ERROR: cannot set file <$di3_nsiorfile>\n";
211 $NS->Kill (); $NS->TimedWait (1);
212 exit 1;
214 if ($di4->PutFile ($nsiorfile) == -1) {
215 print STDERR "ERROR: cannot set file <$di4_nsiorfile>\n";
216 $NS->Kill (); $NS->TimedWait (1);
217 exit 1;
220 print STDERR "Starting Receiver 1\n";
221 $RE1_status = $RE1->Spawn ();
222 if ($RE1_status != 0) {
223 print STDERR "ERROR: Receiver 1 returned $RE1_status\n";
224 $RE1->Kill (); $RE1->TimedWait (1);
225 $NS->Kill (); $NS->TimedWait (1);
226 exit 1;
228 sleep $sleeptime;
230 print STDERR "Starting Receiver 2\n";
231 $RE2_status = $RE2->Spawn ();
232 if ($RE2_status != 0) {
233 print STDERR "ERROR: Receiver 2 returned $RE2_status\n";
234 $RE2->Kill (); $RE2->TimedWait (1);
235 $RE1->Kill (); $RE1->TimedWait (1);
236 $NS->Kill (); $NS->TimedWait (1);
237 exit 1;
239 sleep $sleeptime;
241 print STDERR "Starting Distributer 1\n";
242 $DI1_status = $DI1->Spawn ();
243 if ($DI1_status != 0) {
244 print STDERR "ERROR: Distributer 1 returned $DI1_status\n";
245 $DI1->Kill (); $DI1->TimedWait (1);
246 $RE2->Kill (); $RE2->TimedWait (1);
247 $RE1->Kill (); $RE1->TimedWait (1);
248 $NS->Kill (); $NS->TimedWait (1);
249 exit 1;
251 sleep $sleeptime;
253 print STDERR "Starting Sender1\n";
254 $SV1_status = $SV1->Spawn ();
255 if ($SV1_status != 0) {
256 print STDERR "ERROR: Sender 1 returned $SV1_status\n";
257 $SV1->Kill (); $SV1->TimedWait (1);
258 $DI1->Kill (); $DI1->TimedWait (1);
259 $RE2->Kill (); $RE2->TimedWait (1);
260 $RE1->Kill (); $RE1->TimedWait (1);
261 $NS->Kill (); $NS->TimedWait (1);
262 exit 1;
264 sleep $distributor_time;
266 print STDERR "\nStarting Distributer 2\n\n";
267 $DI2_status = $DI2->Spawn ();
268 if ($DI2_status != 0) {
269 print STDERR "ERROR: Distributer 2 returned $DI2_status\n";
270 $DI2->Kill (); $DI2->TimedWait (1);
271 $SV1->Kill (); $SV1->TimedWait (1);
272 $DI1->Kill (); $DI1->TimedWait (1);
273 $RE2->Kill (); $RE2->TimedWait (1);
274 $RE1->Kill (); $RE1->TimedWait (1);
275 $NS->Kill (); $NS->TimedWait (1);
276 exit 1;
278 sleep $distributor_time;
280 print STDERR "\nStarting Distributer 3\n\n";
281 $DI3_status = $DI3->Spawn ();
282 if ($DI3_status != 0) {
283 print STDERR "ERROR: Distributer 3 returned $DI3_status\n";
284 $DI3->Kill (); $DI3->TimedWait (1);
285 $DI2->Kill (); $DI2->TimedWait (1);
286 $SV1->Kill (); $SV1->TimedWait (1);
287 $DI1->Kill (); $DI1->TimedWait (1);
288 $RE2->Kill (); $RE2->TimedWait (1);
289 $RE1->Kill (); $RE1->TimedWait (1);
290 $NS->Kill (); $NS->TimedWait (1);
291 exit 1;
293 sleep $sender_time;
295 print STDERR "Starting Sender2\n";
296 $SV2_status = $SV2->Spawn ();
297 if ($SV2_status != 0) {
298 print STDERR "ERROR: Sender 2 returned $SV2_status\n";
299 $SV2->Kill (); $SV2->TimedWait (1);
300 $DI3->Kill (); $DI3->TimedWait (1);
301 $DI2->Kill (); $DI2->TimedWait (1);
302 $SV1->Kill (); $SV1->TimedWait (1);
303 $DI1->Kill (); $DI1->TimedWait (1);
304 $RE2->Kill (); $RE2->TimedWait (1);
305 $RE1->Kill (); $RE1->TimedWait (1);
306 $NS->Kill (); $NS->TimedWait (1);
307 exit 1;
309 sleep $sender_time;
311 print STDERR "Starting Sender3\n";
312 $SV3_status = $SV3->Spawn ();
313 if ($SV3_status != 0) {
314 print STDERR "ERROR: Sender 3 returned $SV3_status\n";
315 $SV3->Kill (); $SV3->TimedWait (1);
316 $SV2->Kill (); $SV2->TimedWait (1);
317 $DI3->Kill (); $DI3->TimedWait (1);
318 $DI2->Kill (); $DI2->TimedWait (1);
319 $SV1->Kill (); $SV1->TimedWait (1);
320 $DI1->Kill (); $DI1->TimedWait (1);
321 $RE2->Kill (); $RE2->TimedWait (1);
322 $RE1->Kill (); $RE1->TimedWait (1);
323 $NS->Kill (); $NS->TimedWait (1);
324 exit 1;
326 sleep $distributor_time;
328 print STDERR "\nStarting Distributer 4\n\n";
329 $DI4_status = $DI4->Spawn ();
330 if ($DI4_status != 0) {
331 print STDERR "ERROR: Distributer 4 returned $DI4_status\n";
332 $DI4->Kill (); $DI4->TimedWait (1);
333 $SV3->Kill (); $SV3->TimedWait (1);
334 $SV2->Kill (); $SV2->TimedWait (1);
335 $DI3->Kill (); $DI3->TimedWait (1);
336 $DI2->Kill (); $DI2->TimedWait (1);
337 $SV1->Kill (); $SV1->TimedWait (1);
338 $DI1->Kill (); $DI1->TimedWait (1);
339 $RE2->Kill (); $RE2->TimedWait (1);
340 $RE1->Kill (); $RE1->TimedWait (1);
341 $NS->Kill (); $NS->TimedWait (1);
342 exit 1;
345 $SV2_status = $SV2->WaitKill ($sv2->ProcessStartWaitInterval()+285);
346 if ($SV2_status != 0) {
347 print STDERR "ERROR: Sender 2 returned $SV2_status\n";
348 $status = 1;
351 $SV3_status = $SV3->WaitKill ($sv3->ProcessStartWaitInterval()+285);
352 if ($SV3_status != 0) {
353 print STDERR "ERROR: Sender 3 returned $SV3_status\n";
354 $status = 1;
357 $SV1_status = $SV1->WaitKill ($sv1->ProcessStartWaitInterval()+285);
358 if ($SV1_status != 0) {
359 print STDERR "ERROR: Sender 1 returned $SV1_status\n";
360 $status = 1;
363 $DI3_status = $DI3->TerminateWaitKill ($di3->ProcessStopWaitInterval());
364 if ($DI3_status != 0) {
365 print STDERR "ERROR: distributer 3 returned $DI3_status\n";
366 $status = 1;
369 $DI2_status = $DI2->TerminateWaitKill ($di2->ProcessStopWaitInterval());
370 if ($DI2_status != 0) {
371 print STDERR "ERROR: distributer 2 returned $DI2_status\n";
372 $status = 1;
375 $DI1_status = $DI1->TerminateWaitKill ($di1->ProcessStopWaitInterval());
376 if ($DI1_status != 0) {
377 print STDERR "ERROR: distributer 1 returned $DI1_status\n";
378 $status = 1;
381 $RE1_status = $RE1->TerminateWaitKill ($re1->ProcessStopWaitInterval());
382 if ($RE1_status != 0) {
383 print STDERR "ERROR: receiver 1 returned $RE1_status\n";
384 $status = 1;
387 $RE2_status = $RE2->TerminateWaitKill ($re2->ProcessStopWaitInterval());
388 if ($RE2_status != 0) {
389 print STDERR "ERROR: receiver 2 returned $RE2_status\n";
390 $status = 1;
393 $DI4_status = $DI4->TerminateWaitKill ($di4->ProcessStopWaitInterval());
394 if ($DI4_status != 0) {
395 print STDERR "ERROR: distributer 4 returned $DI4_status\n";
396 $status = 1;
399 $NS_status = $NS->TerminateWaitKill ($ns->ProcessStopWaitInterval());
400 if ($NS_status != 0) {
401 print STDERR "ERROR: Naming Service returned $NS_status\n";
402 $status = 1;
405 $ns->DeleteFile ($nsiorfile);
406 $sv1->DeleteFile ($nsiorfile);
407 $sv2->DeleteFile ($nsiorfile);
408 $sv3->DeleteFile ($nsiorfile);
409 $re1->DeleteFile ($nfsiorfile);
410 $re2->DeleteFile ($nfsiorfile);
411 $di1->DeleteFile ($nfsiorfile);
412 $di2->DeleteFile ($nfsiorfile);
413 $di3->DeleteFile ($nfsiorfile);
414 $di4->DeleteFile ($nfsiorfile);
415 $sv1->DeleteFile ($inputfile);
416 $sv2->DeleteFile ($inputfile);
417 $sv3->DeleteFile ($inputfile);
418 $re1->DeleteFile ($outputfile1);
419 $re2->DeleteFile ($outputfile2);
421 exit $status;