Merge pull request #2309 from mitza-oci/warnings
[ACE_TAO.git] / TAO / orbsvcs / DevGuideExamples / NotifyService / QoSProperties / run_test.pl
blob5ba60e69a7f3a909621ee211d603034e97d4797f
2 eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}'
3 & eval 'exec perl -S $0 $argv:q'
4 if 0;
6 use lib "$ENV{ACE_ROOT}/bin";
7 use PerlACE::TestTarget;
9 $status = 0;
10 $debug_level = '0';
12 foreach $i (@ARGV) {
13 if ($i eq '-debug') {
14 $debug_level = '10';
18 my $ns = PerlACE::TestTarget::create_target (1) || die "Create target 1 failed\n";
19 my $nfs = PerlACE::TestTarget::create_target (2) || die "Create target 2 failed\n";
20 my $srv = PerlACE::TestTarget::create_target (3) || die "Create target 3 failed\n";
21 my $con = PerlACE::TestTarget::create_target (4) || die "Create target 4 failed\n";
22 my $cli = PerlACE::TestTarget::create_target (5) || die "Create target 5 failed\n";
24 $nsiorfile = "ns.ior";
25 $srviorfile = "Messenger.ior";
26 $nfsiorfile = "notify.ior";
28 my $ns_nsiorfile = $ns->LocalFile ($nsiorfile);
29 my $nfs_nsiorfile = $nfs->LocalFile ($nsiorfile);
30 my $srv_nsiorfile = $srv->LocalFile ($nsiorfile);
31 my $con_nsiorfile = $con->LocalFile ($nsiorfile);
32 my $cli_nsiorfile = $cli->LocalFile ($nsiorfile);
33 my $nfs_nfsiorfile = $nfs->LocalFile ($nfsiorfile);
34 my $srv_srviorfile = $srv->LocalFile ($srviorfile);
35 my $cli_srviorfile = $cli->LocalFile ($srviorfile);
36 $ns->DeleteFile ($nsiorfile);
37 $nfs->DeleteFile ($nsiorfile);
38 $srv->DeleteFile ($nsiorfile);
39 $con->DeleteFile ($nsiorfile);
40 $cli->DeleteFile ($nsiorfile);
41 $nfs->DeleteFile ($nfsiorfile);
42 $srv->DeleteFile ($srviorfile);
43 $cli->DeleteFile ($srviorfile);
45 $NameService = "$ENV{TAO_ROOT}/orbsvcs/Naming_Service/tao_cosnaming";
46 $NS = $ns->CreateProcess ($NameService, " -o $ns_nsiorfile");
49 $NotifyService = "$ENV{TAO_ROOT}/orbsvcs/Notify_Service/tao_cosnotification";
50 $NFS = $nfs->CreateProcess ($NotifyService, "-ORBInitRef NameService=file://$nfs_nsiorfile ".
51 "-IORoutput $nfs_nfsiorfile");
52 $SRV = $srv->CreateProcess ("MessengerServer", "-ORBdebuglevel $debug_level ".
53 "-o $srv_srviorfile ".
54 "-ORBInitRef NameService=file://$srv_nsiorfile");
55 $CON = $con->CreateProcess ("MessengerConsumer", "-ORBInitRef NameService=file://$con_nsiorfile");
56 $CLI = $cli->CreateProcess ("MessengerClient", "-ORBInitRef NameService=file://$cli_nsiorfile ".
57 "-k file://$cli_srviorfile");
59 # start Naming Service
60 $NS_status = $NS->Spawn ();
62 if ($NS_status != 0) {
63 print STDERR "ERROR: Name Service returned $NS_status\n";
64 exit 1;
67 if ($ns->WaitForFileTimed ($nsiorfile,$ns->ProcessStartWaitInterval()) == -1) {
68 print STDERR "ERROR: cannot find file <$ns_nsiorfile>\n";
69 $NS->Kill (); $NS->TimedWait (1);
70 exit 1;
73 if ($ns->GetFile ($nsiorfile) == -1) {
74 print STDERR "ERROR: cannot retrieve file <$ns_nsiorfile>\n";
75 $NS->Kill (); $NS->TimedWait (1);
76 exit 1;
78 if ($nfs->PutFile ($nsiorfile) == -1) {
79 print STDERR "ERROR: cannot set file <$nfs_nsiorfile>\n";
80 $NS->Kill (); $NS->TimedWait (1);
81 exit 1;
83 if ($srv->PutFile ($nsiorfile) == -1) {
84 print STDERR "ERROR: cannot set file <$srv_nsiorfile>\n";
85 $NS->Kill (); $NS->TimedWait (1);
86 exit 1;
88 if ($con->PutFile ($nsiorfile) == -1) {
89 print STDERR "ERROR: cannot set file <$con_nsiorfile>\n";
90 $NS->Kill (); $NS->TimedWait (1);
91 exit 1;
93 if ($cli->PutFile ($nsiorfile) == -1) {
94 print STDERR "ERROR: cannot set file <$cli_nsiorfile>\n";
95 $NS->Kill (); $NS->TimedWait (1);
96 exit 1;
99 # start Notification Service
100 $NFS_status = $NFS->Spawn ();
102 if ($NFS_status != 0) {
103 print STDERR "ERROR: Notify Service returned $NFS_status\n";
104 exit 1;
107 if ($nfs->WaitForFileTimed ($nfsiorfile,$nfs->ProcessStartWaitInterval()) == -1) {
108 print STDERR "ERROR: cannot find file <$nfs_nfsiorfile>\n";
109 $NS->Kill (); $NS->TimedWait (1);
110 $NFS->Kill (); $NFS->TimedWait (1);
111 exit 1;
114 # start MessengerServer
115 $SRV_status = $SRV->Spawn ();
117 if ($SRV_status != 0) {
118 print STDERR "ERROR: Server returned $SRV_status\n";
119 exit 1;
122 if ($srv->WaitForFileTimed ($srviorfile,$srv->ProcessStartWaitInterval()) == -1) {
123 print STDERR "ERROR: cannot find file <$srv_srviorfile>\n";
124 $SRV->Kill (); $SRV->TimedWait (1);
125 $NS->Kill (); $NS->TimedWait (1);
126 $NFS->Kill (); $NFS->TimedWait (1);
127 exit 1;
130 if ($srv->GetFile ($srviorfile) == -1) {
131 print STDERR "ERROR: cannot retrieve file <$srv_srviorfile>\n";
132 $SRV->Kill (); $SRV->TimedWait (1);
133 $NS->Kill (); $NS->TimedWait (1);
134 $NFS->Kill (); $NFS->TimedWait (1);
135 exit 1;
137 if ($cli->PutFile ($srviorfile) == -1) {
138 print STDERR "ERROR: cannot set file <$cli_srviorfile>\n";
139 $SRV->Kill (); $SRV->TimedWait (1);
140 $NS->Kill (); $NS->TimedWait (1);
141 $NFS->Kill (); $NFS->TimedWait (1);
142 exit 1;
145 # start MessengerConsumer
146 $CON_status = $CON->Spawn ();
148 if ($CON_status != 0) {
149 print STDERR "ERROR: Consumer returned $CON_status\n";
150 exit 1;
153 # start MessengerClient
154 $CLI_status = $CLI->SpawnWaitKill ($cli->ProcessStartWaitInterval());
156 if ($CLI_status != 0) {
157 print STDERR "ERROR: Messenger Client returned $CLI_status\n";
158 $CON->Kill (); $CON->TimedWait (1);
159 $SRV->Kill (); $SRV->TimedWait (1);
160 $NFS->Kill (); $NFS->TimedWait (1);
161 $NS->Kill (); $NS->TimedWait (1);
162 $status = 1;
165 $CON_status = $CON->TerminateWaitKill ($con->ProcessStopWaitInterval());
167 if ($CON_status != 0) {
168 print STDERR "ERROR: Messenger Consumer returned $CON_status\n";
169 $status = 1;
172 $SRV_status = $SRV->TerminateWaitKill ($srv->ProcessStopWaitInterval());
174 if ($SRV_status != 0) {
175 print STDERR "ERROR: Messenger Server returned $SRV_status\n";
176 $status = 1;
178 $NFS_status = $NFS->TerminateWaitKill ($nfs->ProcessStopWaitInterval());
180 if ($NFS_status != 0) {
181 print STDERR "ERROR: Notification Service returned $NFS_status\n";
182 $status = 1;
185 $NS_status = $NS->TerminateWaitKill ($ns->ProcessStopWaitInterval());
187 if ($NS_status != 0) {
188 print STDERR "ERROR: Name Service returned $NS_status\n";
189 $status = 1;
192 $ns->DeleteFile ($nsiorfile);
193 $nfs->DeleteFile ($nsiorfile);
194 $srv->DeleteFile ($nsiorfile);
195 $con->DeleteFile ($nsiorfile);
196 $cli->DeleteFile ($nsiorfile);
197 $nfs->DeleteFile ($nfsiorfile);
198 $srv->DeleteFile ($srviorfile);
199 $cli->DeleteFile ($srviorfile);
201 exit $status;