Merge pull request #1551 from DOCGroup/plm_jira_333
[ACE_TAO.git] / TAO / orbsvcs / tests / Notify / Bug_3688_Regression / run_test.pl
blobf67607d2a255966f2f76e70bbd15af3471b17d3a
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;
10 $status = 0;
11 $debug_level = '0';
13 my $persistent_test = 0;
14 my $svcconf = "";
15 my $consumer_runtime = 10;
17 foreach $i (@ARGV) {
18 if ($i eq '-debug') {
19 $debug_level = '10';
23 my $server1 = PerlACE::TestTarget::create_target (1) || die "Create target 1 failed\n";
24 my $server2 = PerlACE::TestTarget::create_target (2) || die "Create target 2 failed\n";
25 my $client = PerlACE::TestTarget::create_target (3) || die "Create target 3 failed\n";
27 my $ior1file = "ecf.ior";
29 #Files which used by server1
30 my $server1_ior1file = $server1->LocalFile ($ior1file);
31 $server1->DeleteFile($ior1file);
33 $hostname = $server1->HostName ();
34 $port = $server1->RandomPort ();
36 $SV1 = $server1->CreateProcess ("$ENV{TAO_ROOT}/orbsvcs/Notify_Service/tao_cosnotification",
37 "-ORBdebuglevel $debug_level " .
38 "-NoNameSvc -IORoutput $server1_ior1file $svcconf " .
39 "-ORBEndpoint iiop://$hostname:$port");
41 $SV2 = $server2->CreateProcess ("supplier",
42 "-ORBdebuglevel $debug_level " .
43 "NotifyService=iioploc://$hostname:$port/NotifyService");
45 $CL = $client->CreateProcess ("consumer",
46 "-ORBdebuglevel $debug_level " .
47 "NotifyService=iioploc://$hostname:$port/NotifyService " .
48 "-t $consumer_runtime");
51 print "\n*********** Starting the Notify Service ***********\n\n";
52 print $SV1->CommandLine ()."\n";
54 $server_status = $SV1->Spawn ();
56 if ($server_status != 0) {
57 print STDERR "ERROR: server returned $server_status\n";
58 exit 1;
61 if ($server1->WaitForFileTimed ($ior1file,
62 $server1->ProcessStartWaitInterval()) == -1) {
63 print STDERR "ERROR: cannot find file <$server1_ior1file>\n";
64 $SV1->Kill (); $SV1->TimedWait (1);
65 exit 1;
68 print "\n*********** Starting the notification Consumer ***********\n\n";
69 print STDERR $SV2->CommandLine (). "\n";
71 $server_status = $SV2->Spawn ();
73 if ($server_status != 0) {
74 print STDERR "ERROR: server returned $server_status\n";
75 exit 1;
78 sleep ($server1->ProcessStartWaitInterval() / 3);
81 print "\n*********** Starting the notification Supplier ***********\n\n";
82 print STDERR $CL->CommandLine (). "\n";
84 $client_status = $CL->SpawnWaitKill ($client->ProcessStartWaitInterval());
86 if ($client_status != 0) {
87 print STDERR "ERROR: client returned $client_status\n";
88 $status = 1;
91 $server_status = $SV2->WaitKill ($server2->ProcessStopWaitInterval());
93 if ($server_status != 0) {
94 print STDERR "ERROR: server returned $server_status\n";
95 $status = 1;
98 $SV1-> Kill ();
100 $server1->DeleteFile($ior1file);
102 exit $status;