Changes to attempt to silence bcc64x
[ACE_TAO.git] / TAO / orbsvcs / tests / Notify / Reconnecting / run_test.pl
blobc93e620213e71405d5eaa9a8df328986e470a49e
1 eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}'
2 & eval 'exec perl -S $0 $argv:q'
3 if 0;
5 # -*- perl -*-
7 # ******************************************************************
8 # Pragma Section
9 # ******************************************************************
11 use lib "$ENV{ACE_ROOT}/bin";
12 use PerlACE::TestTarget;
14 $status = 0;
15 $debug_level = '0';
17 foreach $i (@ARGV) {
18 if ($i eq '-debug') {
19 $debug_level = '10';
23 my $nfs = PerlACE::TestTarget::create_target (1) || die "Create target 1 failed\n";
24 my $sup = PerlACE::TestTarget::create_target (2) || die "Create target 2 failed\n";
25 my $con = PerlACE::TestTarget::create_target (3) || die "Create target 3 failed\n";
27 $sup->AddLibPath ('../lib');
28 $con->AddLibPath ('../lib');
31 # ******************************************************************
32 # Data Section
33 # ******************************************************************
35 my $eventType = '-any'; # your choice of -any -structured or -sequence
36 my $notify_port = $nfs->RandomPort ();
37 my $notify_host = $nfs->HostName ();
39 my $st_topo = "ns_st_topo.conf";
40 my $st_both = "ns_st_both.conf";
41 # File used to detect notification service startup
42 $nfsiorfile = "notify.ior";
43 # Hard coded file name in Consumer.cpp (for now)
44 $conidsfile = "consumer.ids";
45 # Hard coded file name in Supplier.cpp (for now)
46 $supidsfile = "supplier.ids";
47 # File used to communicate channel # from consumer to supplier
48 $channel_id = "channel_id";
49 # File used to save configuration for reconnect test
50 $save_xml = "reconnect_test.xml";
51 # File names comes from svc.conf (+.xml & .000)
52 $save_000 = "reconnect_test.000";
53 # File names comes from svc.conf (+.xml & .001)
54 $save_001 = "reconnect_test.001";
55 # Event persistent database file (from svc.conf)
56 $eventpersist = "event_persist.db";
57 # Hardcode filename written by the Supplier when it pauses.
58 $supplier_pause = "Supplier.paused";
60 my $nfs_nfsiorfile = $nfs->LocalFile ($nfsiorfile);
61 my $con_conidsfile = $con->LocalFile ($conidsfile);
62 my $sup_supidsfile = $sup->LocalFile ($supidsfile);
63 my $con_channel_id = $con->LocalFile ($channel_id);
64 my $sup_channel_id = $sup->LocalFile ($channel_id);
65 my $nfs_save_xml = $nfs->LocalFile ($save_xml);
66 my $nfs_save_000 = $nfs->LocalFile ($save_000);
67 my $nfs_save_001 = $nfs->LocalFile ($save_001);
68 my $nfs_eventpersist = $nfs->LocalFile ($eventpersist);
69 my $sup_supplier_pause = $sup->LocalFile ($supplier_pause);
70 my $nfs_svcconf = $nfs->LocalFile ($st_topo);
71 my $nfs_st_both = $nfs->LocalFile ($st_both);
72 $nfs->DeleteFile ($nfsiorfile);
73 $con->DeleteFile ($conidsfile);
74 $sup->DeleteFile ($supidsfile);
75 $con->DeleteFile ($channel_id);
76 $sup->DeleteFile ($channel_id);
77 $nfs->DeleteFile ($save_xml);
78 $nfs->DeleteFile ($save_000);
79 $nfs->DeleteFile ($save_001);
80 $nfs->DeleteFile ($eventpersist);
81 $sup->DeleteFile ($supplier_pause);
83 # ******************************************************************
84 # Main Section
85 # ******************************************************************
87 my $verbose = "";
88 my $discon = "";
90 # Process command line arguments
91 foreach my $i (@ARGV) {
92 if ($i eq '-any') {
93 $eventType = '-any';
95 elsif ($i eq '-str' or $i eq '-structured') {
96 $eventType = '-structured';
98 elsif ($i eq '-seq' or $i eq '-sequence') {
99 $eventType = '-sequence';
101 elsif ($i eq '-mt') {
102 $svcconf = 'ns_mt_topo.conf';
103 $nfs_svcconf = $nfs->LocalFile ($svcconf);
105 elsif ($i eq '-disconnect') {
106 $discon= '-disconnect';
108 elsif ($i eq '-v' or $i eq '-verbose') {
109 $verbose = '-v';
111 else {
112 print "TEST SCRIPT: unknown: $i\n";
113 print "TEST SCRIPT: usage: [-any|-str|-seq] -mt -v\n";
114 exit(-4);
118 my $client_args = "$eventType $verbose -NoNameSvc -ORBInitRef " .
119 "NotifyEventChannelFactory=corbaloc::" .
120 "$notify_host:$notify_port/NotifyEventChannelFactory ";
121 my $ns_base_args = "-ORBObjRefStyle url -NoNameSvc -Boot " .
122 "-IORoutput $nfs_nfsiorfile " .
123 "-ORBEndpoint iiop://:$notify_port ";
124 my $ns_args = "-ORBSvcConf $nfs_svcconf $ns_base_args";
126 # Delete the all of the files used in the test
128 # Define the processes first
129 my $NFS = $nfs->CreateProcess ("$ENV{TAO_ROOT}/orbsvcs/Notify_Service/tao_cosnotification");
130 my $CON = $con->CreateProcess ("Consumer");
131 my $SUP = $sup->CreateProcess ("Supplier");
133 ################
134 # begin test 1
135 ################
137 if ($verbose eq '-v') {
138 print "TEST SCRIPT: Starting Notify Service on port $notify_port\n";
140 $NFS->Arguments($ns_args);
141 if ($verbose eq '-v') {print "TEST SCRIPT: " . $NFS->CommandLine() . "\n";}
142 $NFS_status = $NFS->Spawn ();
143 if ($NFS_status != 0) {
144 print STDERR "ERROR: Notify Service returned $NFS_status\n";
145 exit 1;
147 if ($nfs->WaitForFileTimed ($nfsiorfile,$nfs->ProcessStartWaitInterval()) == -1) {
148 print STDERR "ERROR: cannot find file <$nfs_nfsiorfile>\n";
149 $NFS->Kill (); $NFS->TimedWait (1);
150 exit 1;
153 # start the consumer,
154 # write the channel number to channel.id for use by Supplier
155 # expect to receive 20 events of type any
157 $CON->Arguments("-channel $con_channel_id " .
158 "-expect 20 $discon $client_args");
159 print "TEST SCRIPT: ", $CON->CommandLine(), "\n" if ($verbose eq '-v');
160 $CON_status = $CON->Spawn ();
161 if ($CON_status != 0) {
162 print STDERR "ERROR: Consumer returned $CON_status\n";
163 $NFS->Kill (); $NFS->TimedWait (1);
164 exit 1;
166 if ($con->WaitForFileTimed ($channel_id,$con->ProcessStartWaitInterval()) == -1) {
167 print STDERR "ERROR: cannot find file <$con_channel_id>\n";
168 $CON->Kill (); $CON->TimedWait (1);
169 $NFS->Kill (); $NFS->TimedWait (1);
170 exit 1;
172 if ($con->GetFile ($channel_id) == -1) {
173 print STDERR "ERROR: cannot retrieve file <$con_channel_id>\n";
174 $CON->Kill (); $CON->TimedWait (1);
175 $NFS->Kill (); $NFS->TimedWait (1);
176 exit 1;
178 if ($sup->PutFile ($channel_id) == -1) {
179 print STDERR "ERROR: cannot set file <$sup_channel_id>\n";
180 $CON->Kill (); $CON->TimedWait (1);
181 $NFS->Kill (); $NFS->TimedWait (1);
182 exit 1;
185 # send 10 Any's, picking up the channel# from channel.id
186 $SUP->Arguments("-channel $sup_channel_id -send 10 $client_args");
187 print "TEST SCRIPT: ", $SUP->CommandLine(), "\n" if ($verbose eq '-v');
188 $SUP_status = $SUP->SpawnWaitKill ($sup->ProcessStartWaitInterval()+45);
189 if ($SUP_status != 0) {
190 print STDERR "ERROR: Supplier returned $SUP_status\n";
191 $CON->Kill (); $CON->TimedWait (1);
192 $NFS->Kill (); $NFS->TimedWait (1);
193 exit 1;
196 # forget the channel id, depend on the reconnect information
197 $con->DeleteFile ($channel_id);
198 $sup->DeleteFile ($channel_id);
200 $SUP->Arguments("-send 10 -serial_number 10 $discon $client_args");
201 if ($verbose eq '-v') {print "TEST SCRIPT: " . $SUP->CommandLine() . "\n";}
202 $SUP_status = $SUP->SpawnWaitKill ($sup->ProcessStartWaitInterval()+45);
203 if ($SUP_status != 0) {
204 print STDERR "ERROR: Supplier returned $SUP_status\n";
205 $CON->Kill (); $CON->TimedWait (1);
206 $NFS->Kill (); $NFS->TimedWait (1);
207 exit 1;
210 $CON_status = $CON->WaitKill ($con->ProcessStopWaitInterval()+45);
211 if ($CON_status != 0) {
212 print STDERR "ERROR: Consumer returned $CON_status\n";
213 $NFS->Kill (); $NFS->TimedWait (1);
214 exit 1;
217 print "TEST SCRIPT: ****Passed: Supplier reconnect test.\n";
219 ################
220 # end of test 1
221 ################
223 ################
224 # begin test 2
225 ################
226 # Now start the consumer again. Depending on reconnect this time
227 # Let it write the channel.id file so we know when it's up.
229 if ($verbose eq '-v') {print "TEST SCRIPT: " . $CON->CommandLine() . "\n";}
230 $CON_status = $CON->Spawn ();
231 if ($CON_status != 0) {
232 print STDERR "ERROR: Consumer returned $CON_status\n";
233 $NFS->Kill (); $NFS->TimedWait (1);
234 exit 1;
236 if ($con->WaitForFileTimed ($channel_id,$con->ProcessStartWaitInterval()) == -1) {
237 print STDERR "ERROR: cannot find file <$con_channel_id>\n";
238 $CON->Kill (); $CON->TimedWait (1);
239 $NFS->Kill (); $NFS->TimedWait (1);
240 exit 1;
242 if ($con->GetFile ($channel_id) == -1) {
243 print STDERR "ERROR: cannot retrieve file <$con_channel_id>\n";
244 $CON->Kill (); $CON->TimedWait (1);
245 $NFS->Kill (); $NFS->TimedWait (1);
246 exit 1;
248 if ($sup->PutFile ($channel_id) == -1) {
249 print STDERR "ERROR: cannot set file <$sup_channel_id>\n";
250 $CON->Kill (); $CON->TimedWait (1);
251 $NFS->Kill (); $NFS->TimedWait (1);
252 exit 1;
255 # forget the channel id, depend on the supplier reconnect information
256 $con->DeleteFile ($channel_id);
257 $sup->DeleteFile ($channel_id);
259 $SUP->Arguments("-send 20 -serial_number 0 $client_args");
260 if ($verbose eq '-v') {print "TEST SCRIPT: " . $SUP->CommandLine() . "\n";}
261 $SUP_status = $SUP->SpawnWaitKill ($sup->ProcessStartWaitInterval()+45);
262 if ($SUP_status != 0) {
263 print STDERR "ERROR: Supplier returned $SUP_status\n";
264 $CON->Kill (); $CON->TimedWait (1);
265 $NFS->Kill (); $NFS->TimedWait (1);
266 exit 1;
269 $CON_status = $CON->WaitKill ($con->ProcessStopWaitInterval()+45);
270 if ($CON_status != 0) {
271 print STDERR "ERROR: Consumer returned $CON_status\n";
272 $NFS->Kill (); $NFS->TimedWait (1);
273 exit 1;
276 print "TEST SCRIPT: ****Passed: Consumer reconnect test.\n";
278 ################
279 # end of test 2
280 ################
282 ################
283 # begin test 3
284 ################
286 if ($verbose eq '-v') {print "TEST SCRIPT: Stop the Notification Service\n";}
287 $NFS_status = $NFS->Kill ($nfs->ProcessStopWaitInterval());
288 if ($NFS_status != 0) {
289 print STDERR "ERROR: Notify Service returned $NFS_status\n";
290 exit 1;
292 $nfs->DeleteFile ($nfsiorfile);
294 if ($verbose eq '-v') {
295 print "TEST SCRIPT: Restarting Notify Service on port $notify_port\n",
296 "TEST SCRIPT: It should load topology from $nfs_save_xml\n";
299 # sleep to avoid socket-related problems
300 sleep(10 * $nfs->ProcessStartWaitInterval());
301 $NFS->Arguments($ns_args);
302 if ($verbose eq '-v') {print "TEST SCRIPT: " . $NFS->CommandLine() . "\n";}
303 $NFS_status = $NFS->Spawn ();
304 if ($NFS_status != 0) {
305 print STDERR "ERROR: Notify Service returned $NFS_status\n";
306 exit 1;
308 if ($nfs->WaitForFileTimed ($nfsiorfile,$nfs->ProcessStartWaitInterval()) == -1) {
309 print STDERR "ERROR: cannot find file <$nfs_nfsiorfile>\n";
310 $NFS->Kill (); $NFS->TimedWait (1);
311 exit 1;
314 # Now start the consumer again. It will use the reconnect info.
315 # Let it write the channel.id file so we know when it's up.
316 $con->DeleteFile ($channel_id);
317 $sup->DeleteFile ($channel_id);
319 if ($verbose eq '-v') {print "TEST SCRIPT: " . $CON->CommandLine() . "\n";}
320 $CON_status = $CON->Spawn ();
321 if ($CON_status != 0) {
322 print STDERR "ERROR: Consumer returned $CON_status\n";
323 $NFS->Kill (); $NFS->TimedWait (1);
324 exit 1;
326 if ($con->WaitForFileTimed ($channel_id,$con->ProcessStartWaitInterval()) == -1) {
327 print STDERR "ERROR: cannot find file <$con_channel_id>\n";
328 $CON->Kill (); $CON->TimedWait (1);
329 $NFS->Kill (); $NFS->TimedWait (1);
330 exit 1;
332 if ($con->GetFile ($channel_id) == -1) {
333 print STDERR "ERROR: cannot retrieve file <$con_channel_id>\n";
334 $CON->Kill (); $CON->TimedWait (1);
335 $NFS->Kill (); $NFS->TimedWait (1);
336 exit 1;
338 if ($sup->PutFile ($channel_id) == -1) {
339 print STDERR "ERROR: cannot set file <$sup_channel_id>\n";
340 $CON->Kill (); $CON->TimedWait (1);
341 $NFS->Kill (); $NFS->TimedWait (1);
342 exit 1;
345 # forget the channel id, depend on the supplier reconnect information
346 $con->DeleteFile ($channel_id);
347 $sup->DeleteFile ($channel_id);
349 $SUP->Arguments("-send 20 -serial_number 0 $client_args");
350 if ($verbose eq '-v') {print "TEST SCRIPT: " . $SUP->CommandLine() . "\n";}
351 $SUP_status = $SUP->SpawnWaitKill ($sup->ProcessStartWaitInterval()+45);
352 if ($SUP_status != 0) {
353 print STDERR "ERROR: Supplier returned $SUP_status\n";
354 $CON->Kill (); $CON->TimedWait (1);
355 $NFS->Kill (); $NFS->TimedWait (1);
356 exit 1;
359 $CON_status = $CON->WaitKill ($con->ProcessStopWaitInterval()+45);
360 if ($CON_status != 0) {
361 print STDERR "ERROR: Consumer returned $CON_status\n";
362 $NFS->Kill (); $NFS->TimedWait (1);
363 exit 1;
366 print "TEST SCRIPT: ****Passed: Topology Persistence Test.\n";
368 ################
369 # end of test 3
370 ################
372 ################
373 # begin test 4
374 ################
376 # Now start the consumer one more time
377 # Let it write the channel.id file so we know when it's up.
378 $con->DeleteFile ($channel_id);
379 $sup->DeleteFile ($channel_id);
381 if ($verbose eq '-v') {print "TEST SCRIPT: " . $CON->CommandLine() . "\n";}
382 $CON_status = $CON->Spawn ();
383 if ($CON_status != 0) {
384 print STDERR "ERROR: Consumer returned $CON_status\n";
385 $NFS->Kill (); $NFS->TimedWait (1);
386 exit 1;
388 if ($con->WaitForFileTimed ($channel_id,$con->ProcessStartWaitInterval()) == -1) {
389 print STDERR "ERROR: cannot find file <$con_channel_id>\n";
390 $CON->Kill (); $CON->TimedWait (1);
391 $NFS->Kill (); $NFS->TimedWait (1);
392 exit 1;
394 if ($con->GetFile ($channel_id) == -1) {
395 print STDERR "ERROR: cannot retrieve file <$con_channel_id>\n";
396 $CON->Kill (); $CON->TimedWait (1);
397 $NFS->Kill (); $NFS->TimedWait (1);
398 exit 1;
400 if ($sup->PutFile ($channel_id) == -1) {
401 print STDERR "ERROR: cannot set file <$sup_channel_id>\n";
402 $CON->Kill (); $CON->TimedWait (1);
403 $NFS->Kill (); $NFS->TimedWait (1);
404 exit 1;
407 # forget the channel id, depend on the supplier reconnect information
408 $con->DeleteFile ($channel_id);
409 $sup->DeleteFile ($channel_id);
411 # Start the Supplier, tell it to send 10 messages,
412 # pause until it is reconnected then send another 10.
413 $SUP->Arguments("-send 20 -pause 10 -serial_number 0 $client_args");
414 if ($verbose eq '-v') {print "TEST SCRIPT: " . $SUP->CommandLine() . "\n";}
415 $SUP_status = $SUP->Spawn ();
416 if ($SUP_status != 0) {
417 print STDERR "ERROR: Supplier returned $SUP_status\n";
418 $CON->Kill (); $CON->TimedWait (1);
419 $SUP->Kill (); $SUP->TimedWait (1);
420 $NFS->Kill (); $NFS->TimedWait (1);
421 exit 1;
423 if ($sup->WaitForFileTimed ($supplier_pause,$sup->ProcessStartWaitInterval()) == -1) {
424 print STDERR "ERROR: cannot find file <$sup_supplier_pause>\n";
425 $CON->Kill (); $CON->TimedWait (1);
426 $SUP->Kill (); $SUP->TimedWait (1);
427 $NFS->Kill (); $NFS->TimedWait (1);
428 exit 1;
431 if ($verbose eq '-v') {print "TEST SCRIPT: Stop the Notification Service\n";}
432 $NFS_status = $NFS->Kill ($nfs->ProcessStopWaitInterval());
433 if ($NFS_status != 0) {
434 print STDERR "ERROR: Notify Service returned $NFS_status\n";
435 exit 1;
437 $nfs->DeleteFile ($nfsiorfile);
439 if ($verbose eq '-v') {
440 print "TEST SCRIPT: Restarting Notify Service\n",
441 "TEST SCRIPT: It should load topology from $nfs_save_xml\n",
442 "TEST SCRIPT: and reconnect to registered clients.\n";
445 # sleep to avoid socket-related problems
446 sleep(10 * $nfs->ProcessStartWaitInterval());
448 if ($verbose eq '-v') {print "TEST SCRIPT: " . $NFS->CommandLine() . "\n";}
449 $NFS_status = $NFS->Spawn ();
450 if ($NFS_status != 0) {
451 print STDERR "ERROR: Notify Service returned $NFS_status\n";
452 exit 1;
454 if ($nfs->WaitForFileTimed ($nfsiorfile,$nfs->ProcessStartWaitInterval()) == -1) {
455 print STDERR "ERROR: cannot find file <$nfs_nfsiorfile>\n";
456 $NFS->Kill (); $NFS->TimedWait (1);
457 exit 1;
460 # at this point, both the consumer and the supplier should reconnect
461 # and the remaining events should be delivered
462 # eventually the consumer will finish
464 $CON_status = $CON->WaitKill ($con->ProcessStopWaitInterval()+5);
465 if ($CON_status != 0) {
466 print STDERR "ERROR: Consumer returned $CON_status\n";
467 $SUP->Kill (); $SUP->TimedWait (1);
468 $NFS->Kill (); $NFS->TimedWait (1);
469 exit 1;
472 $SUP_status = $SUP->TerminateWaitKill ($sup->ProcessStopWaitInterval());
473 if ($SUP_status != 0) {
474 print STDERR "ERROR: Supplier returned $SUP_status\n";
475 $NFS->Kill (); $NFS->TimedWait (1);
476 exit 1;
479 print "TEST SCRIPT: ****Passed: Reconnection Factory test.\n";
481 ################
482 # end of test 4
483 ################
485 ################
486 # begin test 5
487 ################
489 if ($verbose eq '-v') {print "TEST SCRIPT: Stop the Notification Service\n";}
490 $NFS_status = $NFS->Kill ($nfs->ProcessStopWaitInterval());
491 if ($NFS_status != 0) {
492 print STDERR "ERROR: Notify Service returned $NFS_status\n";
493 exit 1;
495 $nfs->DeleteFile ($nfsiorfile);
496 $con->DeleteFile ($conidsfile);
497 $sup->DeleteFile ($supidsfile);
498 $con->DeleteFile ($channel_id);
499 $sup->DeleteFile ($channel_id);
500 $nfs->DeleteFile ($save_xml);
501 $nfs->DeleteFile ($save_000);
502 $nfs->DeleteFile ($save_001);
503 $nfs->DeleteFile ($eventpersist);
504 $sup->DeleteFile ($supplier_pause);
506 sleep(10 * $nfs->ProcessStartWaitInterval()); ## avoid lingering sockets
507 # go back to normal ns args
508 $NFS->Arguments($ns_args);
509 if ($verbose eq '-v') {print "TEST SCRIPT: " . $NFS->CommandLine() . "\n";}
510 $NFS_status = $NFS->Spawn ();
511 if ($NFS_status != 0) {
512 print STDERR "ERROR: Notify Service returned $NFS_status\n";
513 exit 1;
515 if ($nfs->WaitForFileTimed ($nfsiorfile,$nfs->ProcessStartWaitInterval()) == -1) {
516 print STDERR "ERROR: cannot find file <$nfs_nfsiorfile>\n";
517 $NFS->Kill (); $NFS->TimedWait (1);
518 exit 1;
521 #configure the consumer to expect 20 events, fail (throw an exception
522 # after 8 events) then continue to listen for remaining events.
523 #The Notification service should automatically retry (but may discard)
524 # the failed events.
525 $CON->Arguments("-channel $con_channel_id " .
526 "-expect 20 -fail 8 $client_args");
527 if ($verbose eq '-v') {print "TEST SCRIPT: " . $CON->CommandLine() . "\n";}
528 $CON_status = $CON->Spawn ();
529 if ($CON_status != 0) {
530 print STDERR "ERROR: Consumer returned $CON_status\n";
531 $NFS->Kill (); $NFS->TimedWait (1);
532 exit 1;
534 if ($con->WaitForFileTimed ($channel_id,$con->ProcessStartWaitInterval()) == -1) {
535 print STDERR "ERROR: cannot find file <$con_channel_id>\n";
536 $CON->Kill (); $CON->TimedWait (1);
537 $NFS->Kill (); $NFS->TimedWait (1);
538 exit 1;
540 if ($con->GetFile ($channel_id) == -1) {
541 print STDERR "ERROR: cannot retrieve file <$con_channel_id>\n";
542 $CON->Kill (); $CON->TimedWait (1);
543 $NFS->Kill (); $NFS->TimedWait (1);
544 exit 1;
546 if ($sup->PutFile ($channel_id) == -1) {
547 print STDERR "ERROR: cannot set file <$sup_channel_id>\n";
548 $CON->Kill (); $CON->TimedWait (1);
549 $NFS->Kill (); $NFS->TimedWait (1);
550 exit 1;
553 $SUP->Arguments("-channel $sup_channel_id -send 20 $client_args");
554 if ($verbose eq '-v') {print "TEST SCRIPT: " . $SUP->CommandLine() . "\n";}
555 $SUP_status = $SUP->SpawnWaitKill ($sup->ProcessStartWaitInterval()+5);
556 if ($SUP_status != 0) {
557 print STDERR "ERROR: Supplier returned $SUP_status\n";
558 $CON->Kill (); $CON->TimedWait (1);
559 $NFS->Kill (); $NFS->TimedWait (1);
560 exit 1;
563 ## this is a slow test due to the reconnection
564 ## time, so give it enough time...
565 $CON_status = $CON->WaitKill ($con->ProcessStopWaitInterval()+225);
566 if ($CON_status != 0) {
567 print STDERR "ERROR: Consumer returned $CON_status\n";
568 $NFS->Kill (); $NFS->TimedWait (1);
569 exit 1;
572 print "TEST SCRIPT: ****Passed: Consumer recoverable exception test.\n";
574 ################
575 # end of test 5
576 ################
578 ################
579 # begin test 6
580 ################
582 print "TEST SCRIPT: Stop the Notification Service\n" if ($verbose eq '-v');
583 $NFS_status = $NFS->Kill ($nfs->ProcessStopWaitInterval());
584 if ($NFS_status != 0) {
585 print STDERR "ERROR: Notify Service returned $NFS_status\n";
586 exit 1;
588 $nfs->DeleteFile ($nfsiorfile);
589 $con->DeleteFile ($conidsfile);
590 $sup->DeleteFile ($supidsfile);
591 $con->DeleteFile ($channel_id);
592 $sup->DeleteFile ($channel_id);
593 $nfs->DeleteFile ($save_xml);
594 $nfs->DeleteFile ($save_000);
595 $nfs->DeleteFile ($save_001);
596 $nfs->DeleteFile ($eventpersist);
597 $sup->DeleteFile ($supplier_pause);
599 ## Wait a bit to avoid lingering sockets from the previous tao_cosnotification
600 sleep(3);
602 $NFS->Arguments("-ORBSvcConf $nfs_st_both $ns_base_args");
603 print "TEST SCRIPT: ", $NFS->CommandLine(), "\n" if ($verbose eq '-v');
604 $NFS_status = $NFS->Spawn ();
605 if ($NFS_status != 0) {
606 print STDERR "ERROR: Notify Service returned $NFS_status\n";
607 exit 1;
609 if ($nfs->WaitForFileTimed ($nfsiorfile,$nfs->ProcessStartWaitInterval()) == -1) {
610 print STDERR "ERROR: cannot find file <$nfs_nfsiorfile>\n";
611 $NFS->Kill (); $NFS->TimedWait (1);
612 exit 1;
615 my $expected = 10;
616 $CON->Arguments("-channel $con_channel_id " .
617 "-expect $expected $client_args");
618 print "TEST SCRIPT: ", $CON->CommandLine(), "\n" if ($verbose eq '-v');
619 $CON_status = $CON->Spawn ();
620 if ($CON_status != 0) {
621 print STDERR "ERROR: Consumer returned $CON_status\n";
622 $NFS->Kill (); $NFS->TimedWait (1);
623 exit 1;
625 if ($con->WaitForFileTimed ($channel_id,$con->ProcessStartWaitInterval()) == -1) {
626 print STDERR "ERROR: cannot find file <$con_channel_id>\n";
627 $CON->Kill (); $CON->TimedWait (1);
628 $NFS->Kill (); $NFS->TimedWait (1);
629 exit 1;
631 if ($con->GetFile ($channel_id) == -1) {
632 print STDERR "ERROR: cannot retrieve file <$con_channel_id>\n";
633 $CON->Kill (); $CON->TimedWait (1);
634 $NFS->Kill (); $NFS->TimedWait (1);
635 exit 1;
637 if ($sup->PutFile ($channel_id) == -1) {
638 print STDERR "ERROR: cannot set file <$sup_channel_id>\n";
639 $CON->Kill (); $CON->TimedWait (1);
640 $NFS->Kill (); $NFS->TimedWait (1);
641 exit 1;
644 $SUP->Arguments("-channel $sup_channel_id -send $expected $client_args");
645 print "TEST SCRIPT: ", $SUP->CommandLine(), "\n" if ($verbose eq '-v');
646 $SUP_status = $SUP->SpawnWaitKill ($sup->ProcessStartWaitInterval()+45);
647 if ($SUP_status != 0) {
648 print STDERR "ERROR: Supplier returned $SUP_status\n";
649 $CON->Kill (); $CON->TimedWait (1);
650 $NFS->Kill (); $NFS->TimedWait (1);
651 exit 1;
654 $CON_status = $CON->WaitKill ($con->ProcessStopWaitInterval()+15);
655 if ($CON_status != 0) {
656 print STDERR "ERROR: Consumer returned $CON_status\n";
657 $NFS->Kill (); $NFS->TimedWait (1);
658 exit 1;
661 my $next_expected = 3;
662 $SUP->Arguments("-channel $sup_channel_id -send 3 " .
663 "-serial_number $expected $client_args");
664 print "TEST SCRIPT: ", $SUP->CommandLine(), "\n" if ($verbose eq '-v');
665 $SUP_status = $SUP->SpawnWaitKill ($sup->ProcessStartWaitInterval()+45);
666 if ($SUP_status != 0) {
667 print STDERR "ERROR: Supplier returned $SUP_status\n";
668 $CON->Kill (); $CON->TimedWait (1);
669 $NFS->Kill (); $NFS->TimedWait (1);
670 exit 1;
673 $CON->Arguments("-channel $con_channel_id -expect $next_expected " .
674 "-serial_number $expected $client_args");
675 print "TEST SCRIPT: ", $CON->CommandLine(), "\n" if ($verbose eq '-v');
676 $CON_status = $CON->SpawnWaitKill ($con->ProcessStartWaitInterval()+15);
677 if ($CON_status != 0) {
678 print STDERR "ERROR: Consumer returned $CON_status\n";
679 $NFS->Kill (); $NFS->TimedWait (1);
680 $status = 1;
683 $NFS_status = $NFS->Kill ($nfs->ProcessStopWaitInterval());
684 if ($NFS_status != 0) {
685 print STDERR "ERROR: Notify Service returned $NFS_status\n";
686 $status = 1;
689 ################
690 # end of test 6
691 ################
693 $nfs->DeleteFile ($nfsiorfile);
694 $con->DeleteFile ($conidsfile);
695 $sup->DeleteFile ($supidsfile);
696 $con->DeleteFile ($channel_id);
697 $sup->DeleteFile ($channel_id);
698 $nfs->DeleteFile ($save_xml);
699 $nfs->DeleteFile ($save_000);
700 $nfs->DeleteFile ($save_001);
701 $nfs->DeleteFile ($eventpersist);
702 $sup->DeleteFile ($supplier_pause);
704 exit $status;