Changes to attempt to silence bcc64x
[ACE_TAO.git] / TAO / orbsvcs / tests / Notify / Bug_2415_Regression / run_test.pl
blob4680033d4e9c3567d5642c2d7cc311219887e94e
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 foreach $i (@ARGV) {
14 if ($i eq '-debug') {
15 $debug_level = '10';
19 my $ns = PerlACE::TestTarget::create_target (1) || die "Create target 1 failed\n";
20 my $nfs = PerlACE::TestTarget::create_target (2) || die "Create target 2 failed\n";
21 my $sup = PerlACE::TestTarget::create_target (3) || die "Create target 3 failed\n";
22 my $con = PerlACE::TestTarget::create_target (4) || die "Create target 4 failed\n";
24 $sup->AddLibPath ('../lib');
25 $con->AddLibPath ('../lib');
27 $domain1 = "domain1";
28 $domain2 = "domain2";
29 $expect_pass = "0";
30 $expect_fail = "1";
31 $ns_port = $ns->RandomPort ();
32 $ns_host = $ns->HostName ();
34 $supiorfile = "supplier.ior";
35 $nfsiorfile = "notify.ior";
36 $nfsconffile = "notify$PerlACE::svcconf_ext";
37 $nfs2conffile = "notify2$PerlACE::svcconf_ext";
39 my $nfs_nfsiorfile = $nfs->LocalFile ($nfsiorfile);
40 my $nfs_nfsconffile = $nfs->LocalFile ($nfsconffile);
41 my $nfs_nfs2conffile = $nfs->LocalFile ($nfs2conffile);
42 my $sup_supiorfile = $sup->LocalFile ($supiorfile);
43 my $con_supiorfile = $con->LocalFile ($supiorfile);
44 $nfs->DeleteFile ($nfsiorfile);
45 $sup->DeleteFile ($supiorfile);
46 $con->DeleteFile ($supiorfile);
48 $NS = $ns->CreateProcess ("$ENV{TAO_ROOT}/orbsvcs/Naming_Service/tao_cosnaming",
49 " -ORBEndpoint iiop://$ns_host:$ns_port");
51 $NFS = $nfs->CreateProcess ("$ENV{TAO_ROOT}/orbsvcs/Notify_Service/tao_cosnotification",
52 "-ORBInitRef NameService=corbaloc::" .
53 "$ns_host:$ns_port/NameService " .
54 "-IORoutput $nfs_nfsiorfile -ORBSvcConf " .
55 "$nfs_nfsconffile");
57 $SUP = $sup->CreateProcess ("Supplier",
58 "-ORBDebugLevel $debug_level " .
59 "-ORBInitRef NameService=iioploc://" .
60 "$ns_host:$ns_port/NameService -d $domain1 ".
61 "-o $sup_supiorfile");
63 $CON = $con->CreateProcess ("Consumer");
64 $CON_Args = "-ORBInitRef NameService=corbaloc::$ns_host:" .
65 "$ns_port/NameService -f $expect_pass ".
66 "-k file://$con_supiorfile";
68 $NS_status = $NS->Spawn ();
69 if ($NS_status != 0) {
70 print STDERR "ERROR: Name Service returned $NS_status\n";
71 exit 1;
74 $NFS_status = $NFS->Spawn ();
75 if ($NFS_status != 0) {
76 print STDERR "ERROR: Notify Service returned $NFS_status\n";
77 exit 1;
79 if ($nfs->WaitForFileTimed ($nfsiorfile,$nfs->ProcessStartWaitInterval()+5) == -1) {
80 print STDERR "ERROR: cannot find file <$nfs_nfsiorfile>\n";
81 $NS->Kill (); $NS->TimedWait (1);
82 $NFS->Kill (); $NFS->TimedWait (1);
83 exit 1;
86 print "************** Running Consumer 1 ************\n";
88 $SUP_status = $SUP->Spawn ();
89 if ($SUP_status != 0) {
90 print STDERR "ERROR: Supplier returned $SUP_status\n";
91 exit 1;
93 if ($sup->WaitForFileTimed ($supiorfile,$sup->ProcessStartWaitInterval()+5) == -1) {
94 print STDERR "ERROR: cannot find file <$sup_supiorfile>\n";
95 $SUP->Kill (); $SUP->TimedWait (1);
96 $NS->Kill (); $NS->TimedWait (1);
97 $NFS->Kill (); $NFS->TimedWait (1);
98 exit 1;
100 if ($sup->GetFile ($supiorfile) == -1) {
101 print STDERR "ERROR: cannot retrieve file <$sup_supiorfile>\n";
102 $SUP->Kill (); $SUP->TimedWait (1);
103 $NS->Kill (); $NS->TimedWait (1);
104 $NFS->Kill (); $NFS->TimedWait (1);
105 exit 1;
107 if ($con->PutFile ($supiorfile) == -1) {
108 print STDERR "ERROR: cannot set file <$con_suporfile>\n";
109 $SUP->Kill (); $SUP->TimedWait (1);
110 $NS->Kill (); $NS->TimedWait (1);
111 $NFS->Kill (); $NFS->TimedWait (1);
112 exit 1;
115 $CON->Arguments($CON_Args);
116 $CON_status = $CON->SpawnWaitKill ($con->ProcessStartWaitInterval()+45);
117 if ($CON_status != 0) {
118 print STDERR "ERROR: Consumer returned $CON_status\n";
119 $SUP->Kill (); $SUP->TimedWait (1);
120 $NS->Kill (); $NS->TimedWait (1);
121 $NFS->Kill (); $NFS->TimedWait (1);
122 exit 1;
125 $SUP_status = $SUP->WaitKill ($sup->ProcessStopWaitInterval());
126 if ($SUP_status != 0) {
127 print STDERR "ERROR: Supplier returned $SUP_status\n";
128 $NS->Kill (); $NS->TimedWait (1);
129 $NFS->Kill (); $NFS->TimedWait (1);
130 exit 1;
133 $sup->DeleteFile ($supiorfile);
134 $con->DeleteFile ($supiorfile);
136 $SUP = $sup->CreateProcess ("Supplier",
137 "-ORBDebugLevel $debug_level " .
138 "-ORBInitRef NameService=iioploc://" .
139 "$ns_host:$ns_port/NameService -d $domain2 ".
140 "-o $sup_supiorfile");
142 $CON = $con->CreateProcess ("Consumer");
143 $CON_Args = "-ORBInitRef NameService=corbaloc::$ns_host:" .
144 "$ns_port/NameService -f $expect_fail ".
145 "-k file://$con_supiorfile";
147 print "************** Running Consumer 2 ************\n";
149 $SUP_status = $SUP->Spawn ();
150 if ($SUP_status != 0) {
151 print STDERR "ERROR: Supplier returned $SUP_status\n";
152 exit 1;
154 if ($sup->WaitForFileTimed ($supiorfile,$sup->ProcessStartWaitInterval()+5) == -1) {
155 print STDERR "ERROR: cannot find file <$sup_supiorfile>\n";
156 $SUP->Kill (); $SUP->TimedWait (1);
157 $NS->Kill (); $NS->TimedWait (1);
158 $NFS->Kill (); $NFS->TimedWait (1);
159 exit 1;
161 if ($sup->GetFile ($supiorfile) == -1) {
162 print STDERR "ERROR: cannot retrieve file <$sup_supiorfile>\n";
163 $SUP->Kill (); $SUP->TimedWait (1);
164 $NS->Kill (); $NS->TimedWait (1);
165 $NFS->Kill (); $NFS->TimedWait (1);
166 exit 1;
168 if ($con->PutFile ($supiorfile) == -1) {
169 print STDERR "ERROR: cannot set file <$con_suporfile>\n";
170 $SUP->Kill (); $SUP->TimedWait (1);
171 $NS->Kill (); $NS->TimedWait (1);
172 $NFS->Kill (); $NFS->TimedWait (1);
173 exit 1;
176 $CON->Arguments($CON_Args);
177 $CON_status = $CON->SpawnWaitKill ($con->ProcessStartWaitInterval()+45);
178 if ($CON_status != 0) {
179 print STDERR "ERROR: Consumer returned $CON_status\n";
180 $SUP->Kill (); $SUP->TimedWait (1);
181 $NS->Kill (); $NS->TimedWait (1);
182 $NFS->Kill (); $NFS->TimedWait (1);
183 exit 1;
186 $SUP_status = $SUP->WaitKill ($sup->ProcessStopWaitInterval());
187 if ($SUP_status != 0) {
188 print STDERR "ERROR: Supplier returned $SUP_status\n";
189 $NS->Kill (); $NS->TimedWait (1);
190 $NFS->Kill (); $NFS->TimedWait (1);
191 exit 1;
194 $NFS_status = $NFS->Kill ($nfs->ProcessStopWaitInterval());
195 if ($NFS_status != 0) {
196 print STDERR "ERROR: Notify Service returned $NFS_status\n";
197 $NS->Kill (); $NS->TimedWait (1);
198 exit 1;
201 $sup->DeleteFile ($supiorfile);
202 $con->DeleteFile ($supiorfile);
203 $nfs->DeleteFile ($nfsiorfile);
205 $NFS = $nfs->CreateProcess ("$ENV{TAO_ROOT}/orbsvcs/Notify_Service/tao_cosnotification",
206 "-ORBInitRef NameService=corbaloc::" .
207 "$ns_host:$ns_port/NameService " .
208 "-IORoutput $nfs_nfsiorfile -ORBSvcConf " .
209 "$nfs_nfs2conffile");
211 $SUP = $sup->CreateProcess ("Supplier",
212 "-ORBDebugLevel $debug_level " .
213 "-ORBInitRef NameService=iioploc://" .
214 "$ns_host:$ns_port/NameService -d $domain1 ".
215 "-o $sup_supiorfile");
217 $CON = $con->CreateProcess ("Consumer");
218 $CON_Args = "-ORBInitRef NameService=corbaloc::$ns_host:" .
219 "$ns_port/NameService -f $expect_pass ".
220 "-k file://$con_supiorfile";
223 $NFS_status = $NFS->Spawn ();
224 if ($NFS_status != 0) {
225 print STDERR "ERROR: Notify Service returned $NFS_status\n";
226 exit 1;
228 if ($nfs->WaitForFileTimed ($nfsiorfile,$nfs->ProcessStartWaitInterval()+5) == -1) {
229 print STDERR "ERROR: cannot find file <$nfs_nfsiorfile>\n";
230 $NS->Kill (); $NS->TimedWait (1);
231 $NFS->Kill (); $NFS->TimedWait (1);
232 exit 1;
235 print "************** Running Consumer 3 ************\n";
237 $SUP_status = $SUP->Spawn ();
238 if ($SUP_status != 0) {
239 print STDERR "ERROR: Supplier returned $SUP_status\n";
240 exit 1;
242 if ($sup->WaitForFileTimed ($supiorfile,$sup->ProcessStartWaitInterval()+5) == -1) {
243 print STDERR "ERROR: cannot find file <$sup_supiorfile>\n";
244 $SUP->Kill (); $SUP->TimedWait (1);
245 $NS->Kill (); $NS->TimedWait (1);
246 $NFS->Kill (); $NFS->TimedWait (1);
247 exit 1;
249 if ($sup->GetFile ($supiorfile) == -1) {
250 print STDERR "ERROR: cannot retrieve file <$sup_supiorfile>\n";
251 $SUP->Kill (); $SUP->TimedWait (1);
252 $NS->Kill (); $NS->TimedWait (1);
253 $NFS->Kill (); $NFS->TimedWait (1);
254 exit 1;
256 if ($con->PutFile ($supiorfile) == -1) {
257 print STDERR "ERROR: cannot set file <$con_suporfile>\n";
258 $SUP->Kill (); $SUP->TimedWait (1);
259 $NS->Kill (); $NS->TimedWait (1);
260 $NFS->Kill (); $NFS->TimedWait (1);
261 exit 1;
264 $CON->Arguments($CON_Args);
265 $CON_status = $CON->SpawnWaitKill ($con->ProcessStartWaitInterval()+45);
266 if ($CON_status != 0) {
267 print STDERR "ERROR: Consumer returned $CON_status\n";
268 $SUP->Kill (); $SUP->TimedWait (1);
269 $NS->Kill (); $NS->TimedWait (1);
270 $NFS->Kill (); $NFS->TimedWait (1);
271 exit 1;
274 $SUP_status = $SUP->WaitKill ($sup->ProcessStopWaitInterval());
275 if ($SUP_status != 0) {
276 print STDERR "ERROR: Supplier returned $SUP_status\n";
277 $NS->Kill (); $NS->TimedWait (1);
278 $NFS->Kill (); $NFS->TimedWait (1);
279 exit 1;
282 $sup->DeleteFile ($supiorfile);
283 $con->DeleteFile ($supiorfile);
285 $SUP = $sup->CreateProcess ("Supplier",
286 "-ORBDebugLevel $debug_level " .
287 "-ORBInitRef NameService=iioploc://" .
288 "$ns_host:$ns_port/NameService -d $domain2 ".
289 "-o $sup_supiorfile");
291 $CON = $con->CreateProcess ("Consumer");
292 $CON_Args = "-ORBInitRef NameService=corbaloc::$ns_host:" .
293 "$ns_port/NameService -f $expect_pass ".
294 "-k file://$con_supiorfile";
296 print "************** Running Consumer 4 ************\n";
298 $SUP_status = $SUP->Spawn ();
299 if ($SUP_status != 0) {
300 print STDERR "ERROR: Supplier returned $SUP_status\n";
301 exit 1;
303 if ($sup->WaitForFileTimed ($supiorfile,$sup->ProcessStartWaitInterval()+5) == -1) {
304 print STDERR "ERROR: cannot find file <$sup_supiorfile>\n";
305 $SUP->Kill (); $SUP->TimedWait (1);
306 $NS->Kill (); $NS->TimedWait (1);
307 $NFS->Kill (); $NFS->TimedWait (1);
308 exit 1;
310 if ($sup->GetFile ($supiorfile) == -1) {
311 print STDERR "ERROR: cannot retrieve file <$sup_supiorfile>\n";
312 $SUP->Kill (); $SUP->TimedWait (1);
313 $NS->Kill (); $NS->TimedWait (1);
314 $NFS->Kill (); $NFS->TimedWait (1);
315 exit 1;
317 if ($con->PutFile ($supiorfile) == -1) {
318 print STDERR "ERROR: cannot set file <$con_suporfile>\n";
319 $SUP->Kill (); $SUP->TimedWait (1);
320 $NS->Kill (); $NS->TimedWait (1);
321 $NFS->Kill (); $NFS->TimedWait (1);
322 exit 1;
325 $CON->Arguments($CON_Args);
326 $CON_status = $CON->SpawnWaitKill ($con->ProcessStartWaitInterval()+45);
327 if ($CON_status != 0) {
328 print STDERR "ERROR: Consumer returned $CON_status\n";
329 $status = 1;
332 $SUP_status = $SUP->WaitKill ($sup->ProcessStopWaitInterval());
333 if ($SUP_status != 0) {
334 print STDERR "ERROR: Supplier returned $SUP_status\n";
335 $status = 1;
338 $NFS_status = $NFS->Kill ($nfs->ProcessStopWaitInterval());
339 if ($NFS_status != 0) {
340 print STDERR "ERROR: Notify Service returned $NFS_status\n";
341 $status = 1;
344 $NS_status = $NS->TerminateWaitKill ($ns->ProcessStopWaitInterval());
345 if ($NS_status != 0) {
346 print STDERR "ERROR: Naming Service returned $NS_status\n";
347 $status = 1;
350 $nfs->DeleteFile ($nfsiorfile);
351 $sup->DeleteFile ($supiorfile);
352 $con->DeleteFile ($supiorfile);
354 exit $status;