Changes to attempt to silence bcc64x
[ACE_TAO.git] / TAO / orbsvcs / tests / Notify / Discarding / run_test.pl
blob94b32ace8886b5d3d067af93ea4b05374a68b6a4
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 $sts = PerlACE::TestTarget::create_target (3) || die "Create target 3 failed\n";
22 my $stc = PerlACE::TestTarget::create_target (4) || die "Create target 4 failed\n";
23 my $ses = PerlACE::TestTarget::create_target (5) || die "Create target 5 failed\n";
24 my $sec = PerlACE::TestTarget::create_target (6) || die "Create target 6 failed\n";
26 $sts->AddLibPath ('../lib');
27 $stc->AddLibPath ('../lib');
28 $ses->AddLibPath ('../lib');
29 $sec->AddLibPath ('../lib');
31 $port = $ns->RandomPort ();
32 $host = $ns->HostName ();
33 $deadline = 0;
35 $iorbase = "supplier.ior";
36 $nfsiorfile = "notify.ior";
37 $nsiorfile = "naming.ior";
38 $nfsconffile = "notify$PerlACE::svcconf_ext";
40 my $ns_nsiorfile = $ns->LocalFile ($nsiorfile);
41 my $nfs_nfsiorfile = $nfs->LocalFile ($nfsiorfile);
42 my $sts_iorfile = $sts->LocalFile ($iorbase);
43 my $stc_iorfile = $stc->LocalFile ($iorbase);
44 my $sec_iorfile = $sec->LocalFile ($iorbase);
45 my $ses_iorfile = $ses->LocalFile ($iorbase);
46 my $nfs_nfsconffile = $nfs->LocalFile ($nfsconffile);
47 $ns->DeleteFile ($nsiorfile);
48 $nfs->DeleteFile ($nfsiorfile);
49 $sts->DeleteFile ($iorbase);
50 $stc->DeleteFile ($iorbase);
51 $sec->DeleteFile ($iorbase);
52 $ses->DeleteFile ($iorbase);
54 foreach my $arg (@ARGV) {
55 if ($arg eq "-d") {
56 $deadline = 1;
58 else {
59 print "Usage: $0 [-d]\n" .
60 " -d specifies that deadline discarding be tested.\n";
61 exit(0);
65 $NS = $ns->CreateProcess ("$ENV{TAO_ROOT}/orbsvcs/Naming_Service/tao_cosnaming",
66 "-ORBEndpoint iiop://$host:$port -o $ns_nsiorfile");
68 $NFS = $nfs->CreateProcess ("$ENV{TAO_ROOT}/orbsvcs/Notify_Service/tao_cosnotification",
69 "-ORBInitRef NameService=iioploc://" .
70 "$host:$port/NameService " .
71 "-IORoutput $nfs_nfsiorfile -ORBSvcConf " .
72 "$nfs_nfsconffile");
74 $STS = $sts->CreateProcess ("Structured_Supplier",
75 "-ORBDebugLevel $debug_level ".
76 "-ORBInitRef NameService=iioploc://".
77 "$host:$port/NameService ".
78 "-o $sts_iorfile");
80 $STC = $stc->CreateProcess ("Structured_Consumer");
82 $SES = $ses->CreateProcess ("Sequence_Supplier",
83 "-ORBDebugLevel $debug_level ".
84 "-ORBInitRef NameService=iioploc://".
85 "$host:$port/NameService ".
86 "-o $ses_iorfile");
88 $SEC = $sec->CreateProcess ("Sequence_Consumer");
90 $CLI_args = "-ORBInitRef NameService=iioploc://$host:$port/NameService ";
93 $NS_status = $NS->Spawn ();
94 if ($NS_status != 0) {
95 print STDERR "ERROR: Name Service returned $NS_status\n";
96 exit 1;
98 if ($ns->WaitForFileTimed ($nsiorfile,$ns->ProcessStartWaitInterval()) == -1) {
99 print STDERR "ERROR: cannot find file <$ns_nsiorfile>\n";
100 $NS->Kill (); $NS->TimedWait (1);
101 exit 1;
104 $NFS_status = $NFS->Spawn ();
105 if ($NFS_status != 0) {
106 print STDERR "ERROR: Notify Service returned $NFS_status\n";
107 exit 1;
109 if ($nfs->WaitForFileTimed ($nfsiorfile,$nfs->ProcessStartWaitInterval()) == -1) {
110 print STDERR "ERROR: cannot find file <$nfs_nfsiorfile>\n";
111 $NS->Kill (); $NS->TimedWait (1);
112 $NFS->Kill (); $NFS->TimedWait (1);
113 exit 1;
116 @policies = ("fifo", "priority", "lifo");
117 if ($deadline) {
118 push(@policies, "deadline");
121 @server_opts = ("", "", "", " -d");
122 if ($status == 0) {
123 for($i = 0; $i <= $#policies; $i++) {
124 $discard_policy = $policies[$i];
125 print "****** Structured Supplier -> Structured Consumer with the " .
126 "$discard_policy policy ******\n";
128 $STS->Arguments($STS->Arguments() . $server_opts[$i]);
129 $STS_status = $STS->Spawn ();
130 if ($STS_status != 0) {
131 print STDERR "ERROR: Structured Supplier returned $STS_status\n";
132 $status = 1;
133 last;
135 if ($sts->WaitForFileTimed ($iorbase,$sts->ProcessStartWaitInterval()) == -1) {
136 print STDERR "ERROR: cannot1 find file <$sts_iorfile>\n";
137 $STS->Kill (); $STS->TimedWait (1);
138 $status = 1;
139 last;
141 if ($sts->GetFile ($iorbase) == -1) {
142 print STDERR "ERROR: cannot retrieve file <$sts_iorfile>\n";
143 $STS->Kill (); $STS->TimedWait (1);
144 $status = 1;
145 last;
147 if ($stc->PutFile ($iorbase) == -1) {
148 print STDERR "ERROR: cannot set file <$stc_iorfile>\n";
149 $STS->Kill (); $STS->TimedWait (1);
150 $status = 1;
151 last;
153 sleep 2;
155 $STC->Arguments($CLI_args . " -k file://$stc_iorfile -d $discard_policy");
156 $STC_status = $STC->SpawnWaitKill ($stc->ProcessStartWaitInterval()+5);
157 if ($STC_status != 0) {
158 print STDERR "ERROR: Structured Consumer returned $STC_status\n";
159 $STS->Kill (); $STS->TimedWait (1);
160 $status = 1;
161 last;
164 $STS_status = $STS->WaitKill ($sts->ProcessStopWaitInterval());
165 if ($STS_status != 0) {
166 print STDERR "ERROR: Structured Supplier returned $STS_status\n";
167 $status = 1;
168 last;
171 $sts->DeleteFile ($iorbase);
172 $stc->DeleteFile ($iorbase);
175 $sts->DeleteFile ($iorbase);
176 $stc->DeleteFile ($iorbase);
178 if ($status == 0) {
179 for($i = 0; $i <= $#policies; $i++) {
180 $discard_policy = $policies[$i];
181 print "***** Structured Supplier -> Sequence Consumer with the " .
182 "$discard_policy policy *****\n";
184 $STS->Arguments($STS->Arguments() . $server_opts[$i]);
185 $STS_status = $STS->Spawn ();
186 if ($STS_status != 0) {
187 print STDERR "ERROR: Structured Supplier returned $STS_status\n";
188 $status = 1;
189 last;
191 if ($sts->WaitForFileTimed ($iorbase,$sts->ProcessStartWaitInterval()) == -1) {
192 print STDERR "ERROR: cannot find file <$sts_iorfile>\n";
193 $STS->Kill (); $STS->TimedWait (1);
194 $status = 1;
195 last;
197 if ($sts->GetFile ($iorbase) == -1) {
198 print STDERR "ERROR: cannot retrieve file <$sts_iorfile>\n";
199 $STS->Kill (); $STS->TimedWait (1);
200 $status = 1;
201 last;
203 if ($sec->PutFile ($iorbase) == -1) {
204 print STDERR "ERROR: cannot set file <$sec_iorfile>\n";
205 $STS->Kill (); $STS->TimedWait (1);
206 $status = 1;
207 last;
209 sleep 2;
211 $SEC->Arguments($CLI_args . " -k file://$sec_iorfile -d $discard_policy");
212 $SEC_status = $SEC->SpawnWaitKill ($sec->ProcessStartWaitInterval()+5);
213 if ($SEC_status != 0) {
214 print STDERR "ERROR: Sequence Consumer returned $SEC_status\n";
215 $STS->Kill (); $STS->TimedWait (1);
216 $status = 1;
217 last;
220 $STS_status = $STS->WaitKill ($sts->ProcessStopWaitInterval());
221 if ($STS_status != 0) {
222 print STDERR "ERROR: Structured Supplier returned $STS_status\n";
223 $status = 1;
224 last;
227 $sts->DeleteFile ($iorbase);
228 $sec->DeleteFile ($iorbase);
231 $sts->DeleteFile ($iorbase);
232 $sec->DeleteFile ($iorbase);
234 if ($status == 0) {
235 for($i = 0; $i <= $#policies; $i++) {
236 $discard_policy = $policies[$i];
237 print "**** Sequence Supplier -> Sequence Consumer with the " .
238 "$discard_policy policy ****\n";
240 $SES->Arguments($SES->Arguments() . $server_opts[$i]);
241 $SES_status = $SES->Spawn ();
242 if ($SES_status != 0) {
243 print STDERR "ERROR: Sequence Supplier returned $SES_status\n";
244 $status = 1;
245 last;
247 if ($ses->WaitForFileTimed ($iorbase,$ses->ProcessStartWaitInterval()) == -1) {
248 print STDERR "ERROR: cannot find file <$ses_iorfile>\n";
249 $STS->Kill (); $STS->TimedWait (1);
250 $status = 1;
251 last;
253 if ($ses->GetFile ($iorbase) == -1) {
254 print STDERR "ERROR: cannot retrieve file <$ses_iorfile>\n";
255 $STS->Kill (); $STS->TimedWait (1);
256 $status = 1;
257 last;
259 if ($sec->PutFile ($iorbase) == -1) {
260 print STDERR "ERROR: cannot set file <$sec_iorfile>\n";
261 $STS->Kill (); $STS->TimedWait (1);
262 $status = 1;
263 last;
265 sleep 2;
267 $SEC->Arguments($CLI_args . " -k file://$sec_iorfile -d $discard_policy");
268 $SEC_status = $SEC->SpawnWaitKill ($sec->ProcessStartWaitInterval()+5);
269 if ($SEC_status != 0) {
270 print STDERR "ERROR: Sequence Consumer returned $SEC_status\n";
271 $SES->Kill (); $SES->TimedWait (1);
272 $status = 1;
273 last;
276 $SES_status = $SES->WaitKill ($ses->ProcessStopWaitInterval());
277 if ($SES_status != 0) {
278 print STDERR "ERROR: Sequence Supplier returned $SES_status\n";
279 $status = 1;
280 last;
283 $ses->DeleteFile ($iorbase);
284 $sec->DeleteFile ($iorbase);
287 $ses->DeleteFile ($iorbase);
288 $sec->DeleteFile ($iorbase);
290 if ($status == 0) {
291 for($i = 0; $i <= $#policies; $i++) {
292 $discard_policy = $policies[$i];
293 print "**** Sequence Supplier -> Structured Consumer with the " .
294 "$discard_policy policy ****\n";
296 $SES->Arguments($SES->Arguments() . $server_opts[$i]);
297 $SES_status = $SES->Spawn ();
298 if ($SES_status != 0) {
299 print STDERR "ERROR: Sequence Supplier returned $SES_status\n";
300 $status = 1;
301 last;
303 if ($ses->WaitForFileTimed ($iorbase,$ses->ProcessStartWaitInterval()) == -1) {
304 print STDERR "ERROR: cannot find file <$ses_iorfile>\n";
305 $STS->Kill (); $STS->TimedWait (1);
306 $status = 1;
307 last;
309 if ($ses->GetFile ($iorbase) == -1) {
310 print STDERR "ERROR: cannot retrieve file <$ses_iorfile>\n";
311 $STS->Kill (); $STS->TimedWait (1);
312 $status = 1;
313 last;
315 if ($stc->PutFile ($iorbase) == -1) {
316 print STDERR "ERROR: cannot set file <$stc_iorfile>\n";
317 $STS->Kill (); $STS->TimedWait (1);
318 $status = 1;
319 last;
321 sleep 2;
323 $STC->Arguments($CLI_args . " -k file://$stc_iorfile -d $discard_policy");
324 $STC_status = $STC->SpawnWaitKill ($stc->ProcessStartWaitInterval()+5);
325 if ($STC_status != 0) {
326 print STDERR "ERROR: Structured Consumer returned $STC_status\n";
327 $status = 1;
328 last;
331 $SES_status = $SES->WaitKill ($ses->ProcessStopWaitInterval());
332 if ($SES_status != 0) {
333 print STDERR "ERROR: Sequence Supplier returned $SES_status\n";
334 $status = 1;
335 last;
337 $ses->DeleteFile ($iorbase);
338 $stc->DeleteFile ($iorbase);
342 $NFS_status = $NFS->Kill ($nfs->ProcessStopWaitInterval());
343 if ($NFS_status != 0) {
344 print STDERR "ERROR: Notify Service returned $NFS_status\n";
345 $status = 1;
348 $NS_status = $NS->TerminateWaitKill ($ns->ProcessStopWaitInterval());
349 if ($NS_status != 0) {
350 print STDERR "ERROR: Name Service returned $NS_status\n";
351 $status = 1;
354 $ns->DeleteFile ($nsiorfile);
355 $nfs->DeleteFile ($nfsiorfile);
356 $sts->DeleteFile ($iorbase);
357 $stc->DeleteFile ($iorbase);
358 $sec->DeleteFile ($iorbase);
359 $ses->DeleteFile ($iorbase);
361 exit $status;