Revert "Use a variable on the stack to not have a temporary in the call"
[ACE_TAO.git] / TAO / orbsvcs / tests / Notify / Ordering / run_test.pl
blobfbe92157694950e91af306863bd14d7a351f87f8
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 $deadline = 0;
32 $port = $ns->RandomPort ();
33 $host = $ns->HostName ();
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 ";
92 $NS_status = $NS->Spawn ();
93 if ($NS_status != 0) {
94 print STDERR "ERROR: Name Service returned $NS_status\n";
95 exit 1;
97 if ($ns->WaitForFileTimed ($nsiorfile,$ns->ProcessStartWaitInterval()) == -1) {
98 print STDERR "ERROR: cannot find file <$ns_nsiorfile>\n";
99 $NS->Kill (); $NS->TimedWait (1);
100 exit 1;
103 $NFS_status = $NFS->Spawn ();
104 if ($NFS_status != 0) {
105 print STDERR "ERROR: Notify Service returned $NFS_status\n";
106 exit 1;
108 if ($nfs->WaitForFileTimed ($nfsiorfile,$nfs->ProcessStartWaitInterval()) == -1) {
109 print STDERR "ERROR: cannot find file <$nfs_nfsiorfile>\n";
110 $NS->Kill (); $NS->TimedWait (1);
111 $NFS->Kill (); $NFS->TimedWait (1);
112 exit 1;
115 if ($deadline) {
116 ## @@todo : Add combinations of deadline ordering.
119 # Although the TAO notify service supports OrderPolicy on the supplier side
120 # QoS, this setting typically serves no practical purpose, and is not testable.
121 # This is because we have no way to force the supplier-side queue to back up, and
122 # the OrderPolicy will have no affect.
123 # Therefore we don't test setting this policy on the supplier side.
125 print "**** Structured Supplier (fifo) -> Structured Consumer (none) *****\n";
126 $STS->Arguments($STS->Arguments() . " -d fifo");
127 $STS_status = $STS->Spawn ();
128 if ($STS_status != 0) {
129 print STDERR "ERROR: Structured Supplier returned $STS_status\n";
130 exit 1;
132 if ($sts->WaitForFileTimed ($iorbase,$sts->ProcessStartWaitInterval()) == -1) {
133 print STDERR "ERROR: cannot find file <$sts_iorfile>\n";
134 $STS->Kill (); $STS->TimedWait (1);
135 $NS->Kill (); $NS->TimedWait (1);
136 $NFS->Kill (); $NFS->TimedWait (1);
137 exit 1;
139 if ($sts->GetFile ($iorbase) == -1) {
140 print STDERR "ERROR: cannot retrieve file <$sts_iorfile>\n";
141 $STS->Kill (); $STS->TimedWait (1);
142 $NS->Kill (); $NS->TimedWait (1);
143 $NFS->Kill (); $NFS->TimedWait (1);
144 exit 1;
146 if ($stc->PutFile ($iorbase) == -1) {
147 print STDERR "ERROR: cannot set file <$stc_iorfile>\n";
148 $STS->Kill (); $STS->TimedWait (1);
149 $NS->Kill (); $NS->TimedWait (1);
150 $NFS->Kill (); $NFS->TimedWait (1);
151 exit 1;
153 sleep 2;
155 $STC->Arguments($CLI_args . " -k file://$stc_iorfile -d fifo");
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 $NS->Kill (); $NS->TimedWait (1);
161 $NFS->Kill (); $NFS->TimedWait (1);
162 exit 1;
165 $STS_status = $STS->WaitKill ($sts->ProcessStopWaitInterval());
166 if ($STS_status != 0) {
167 print STDERR "ERROR: Structured Supplier returned $STS_status\n";
168 $NS->Kill (); $NS->TimedWait (1);
169 $NFS->Kill (); $NFS->TimedWait (1);
170 exit 1;
173 $sts->DeleteFile ($iorbase);
174 $stc->DeleteFile ($iorbase);
178 print "**** Structured Supplier (fifo) -> Structured Consumer (priority) *****\n";
179 $STS->Arguments($STS->Arguments() . " -d fifo");
180 $STS_status = $STS->Spawn ();
181 if ($STS_status != 0) {
182 print STDERR "ERROR: Structured Supplier returned $STS_status\n";
183 exit 1;
185 if ($sts->WaitForFileTimed ($iorbase,$sts->ProcessStartWaitInterval()) == -1) {
186 print STDERR "ERROR: cannot find file <$sts_iorfile>\n";
187 $STS->Kill (); $STS->TimedWait (1);
188 $NS->Kill (); $NS->TimedWait (1);
189 $NFS->Kill (); $NFS->TimedWait (1);
190 exit 1;
192 if ($sts->GetFile ($iorbase) == -1) {
193 print STDERR "ERROR: cannot retrieve file <$sts_iorfile>\n";
194 $STS->Kill (); $STS->TimedWait (1);
195 $NS->Kill (); $NS->TimedWait (1);
196 $NFS->Kill (); $NFS->TimedWait (1);
197 exit 1;
199 if ($stc->PutFile ($iorbase) == -1) {
200 print STDERR "ERROR: cannot set file <$stc_iorfile>\n";
201 $STS->Kill (); $STS->TimedWait (1);
202 $NS->Kill (); $NS->TimedWait (1);
203 $NFS->Kill (); $NFS->TimedWait (1);
204 exit 1;
206 sleep 2;
208 $STC->Arguments($CLI_args . " -k file://$stc_iorfile -d priority -o");
209 $STC_status = $STC->SpawnWaitKill ($stc->ProcessStartWaitInterval()+5);
210 if ($STC_status != 0) {
211 print STDERR "ERROR: Structured Consumer returned $STC_status\n";
212 $STS->Kill (); $STS->TimedWait (1);
213 $NS->Kill (); $NS->TimedWait (1);
214 $NFS->Kill (); $NFS->TimedWait (1);
215 exit 1;
218 $STS_status = $STS->WaitKill ($sts->ProcessStopWaitInterval());
219 if ($STS_status != 0) {
220 print STDERR "ERROR: Structured Supplier returned $STS_status\n";
221 $NS->Kill (); $NS->TimedWait (1);
222 $NFS->Kill (); $NFS->TimedWait (1);
223 exit 1;
226 $sts->DeleteFile ($iorbase);
227 $stc->DeleteFile ($iorbase);
231 print "**** Structured Supplier (fifo) -> Sequence Consumer (priority) *****\n";
232 $STS->Arguments($STS->Arguments() . " -d fifo");
233 $STS_status = $STS->Spawn ();
234 if ($STS_status != 0) {
235 print STDERR "ERROR: Structured Supplier returned $STS_status\n";
236 exit 1;
238 if ($sts->WaitForFileTimed ($iorbase,$sts->ProcessStartWaitInterval()) == -1) {
239 print STDERR "ERROR: cannot find file <$sts_iorfile>\n";
240 $STS->Kill (); $STS->TimedWait (1);
241 $NS->Kill (); $NS->TimedWait (1);
242 $NFS->Kill (); $NFS->TimedWait (1);
243 exit 1;
245 if ($sts->GetFile ($iorbase) == -1) {
246 print STDERR "ERROR: cannot retrieve file <$sts_iorfile>\n";
247 $STS->Kill (); $STS->TimedWait (1);
248 $NS->Kill (); $NS->TimedWait (1);
249 $NFS->Kill (); $NFS->TimedWait (1);
250 exit 1;
252 if ($sec->PutFile ($iorbase) == -1) {
253 print STDERR "ERROR: cannot set file <$sec_iorfile>\n";
254 $STS->Kill (); $STS->TimedWait (1);
255 $NS->Kill (); $NS->TimedWait (1);
256 $NFS->Kill (); $NFS->TimedWait (1);
257 exit 1;
259 sleep 2;
261 $SEC->Arguments($CLI_args . " -k file://$sec_iorfile -d priority -o");
262 $SEC_status = $SEC->SpawnWaitKill ($sec->ProcessStartWaitInterval()+5);
263 if ($SEC_status != 0) {
264 print STDERR "ERROR: Sequence Consumer returned $SEC_status\n";
265 $STS->Kill (); $STS->TimedWait (1);
266 $NS->Kill (); $NS->TimedWait (1);
267 $NFS->Kill (); $NFS->TimedWait (1);
268 exit 1;
271 $STS_status = $STS->WaitKill ($sts->ProcessStopWaitInterval());
272 if ($STS_status != 0) {
273 print STDERR "ERROR: Structured Supplier returned $STS_status\n";
274 $NS->Kill (); $NS->TimedWait (1);
275 $NFS->Kill (); $NFS->TimedWait (1);
276 exit 1;
279 $sts->DeleteFile ($iorbase);
280 $sec->DeleteFile ($iorbase);
284 print "**** Sequence Supplier (fifo) -> Structured Consumer (priority) *****\n";
285 $SES->Arguments($SES->Arguments() . " -d fifo");
286 $SES_status = $SES->Spawn ();
287 if ($SES_status != 0) {
288 print STDERR "ERROR: Sequence Supplier returned $SES_status\n";
289 exit 1;
291 if ($ses->WaitForFileTimed ($iorbase,$ses->ProcessStartWaitInterval()) == -1) {
292 print STDERR "ERROR: cannot find file <$ses_iorfile>\n";
293 $STS->Kill (); $STS->TimedWait (1);
294 $NS->Kill (); $NS->TimedWait (1);
295 $NFS->Kill (); $NFS->TimedWait (1);
296 exit 1;
298 if ($ses->GetFile ($iorbase) == -1) {
299 print STDERR "ERROR: cannot retrieve file <$ses_iorfile>\n";
300 $STS->Kill (); $STS->TimedWait (1);
301 $NS->Kill (); $NS->TimedWait (1);
302 $NFS->Kill (); $NFS->TimedWait (1);
303 exit 1;
305 if ($stc->PutFile ($iorbase) == -1) {
306 print STDERR "ERROR: cannot set file <$stc_iorfile>\n";
307 $STS->Kill (); $STS->TimedWait (1);
308 $NS->Kill (); $NS->TimedWait (1);
309 $NFS->Kill (); $NFS->TimedWait (1);
310 exit 1;
312 sleep 2;
314 $STC->Arguments($CLI_args . " -k file://$stc_iorfile -d priority -o");
315 $STC_status = $STC->SpawnWaitKill ($stc->ProcessStartWaitInterval()+5);
316 if ($STC_status != 0) {
317 print STDERR "ERROR: Structured Consumer returned $STC_status\n";
318 $STS->Kill (); $STS->TimedWait (1);
319 $NS->Kill (); $NS->TimedWait (1);
320 $NFS->Kill (); $NFS->TimedWait (1);
321 exit 1;
324 $SES_status = $SES->WaitKill ($ses->ProcessStopWaitInterval());
325 if ($SES_status != 0) {
326 print STDERR "ERROR: Sequence Supplier returned $SES_status\n";
327 $NS->Kill (); $NS->TimedWait (1);
328 $NFS->Kill (); $NFS->TimedWait (1);
329 exit 1;
332 $ses->DeleteFile ($iorbase);
333 $stc->DeleteFile ($iorbase);
336 print "**** Sequence Supplier (fifo) -> Sequence Consumer (priority) *****\n";
337 $SES->Arguments($SES->Arguments() . " -d fifo");
338 $SES_status = $SES->Spawn ();
339 if ($SES_status != 0) {
340 print STDERR "ERROR: Sequence Supplier returned $SES_status\n";
341 exit 1;
343 if ($ses->WaitForFileTimed ($iorbase,$ses->ProcessStartWaitInterval()) == -1) {
344 print STDERR "ERROR: cannot find file <$ses_iorfile>\n";
345 $STS->Kill (); $STS->TimedWait (1);
346 $NS->Kill (); $NS->TimedWait (1);
347 $NFS->Kill (); $NFS->TimedWait (1);
348 exit 1;
350 if ($ses->GetFile ($iorbase) == -1) {
351 print STDERR "ERROR: cannot retrieve file <$ses_iorfile>\n";
352 $STS->Kill (); $STS->TimedWait (1);
353 $NS->Kill (); $NS->TimedWait (1);
354 $NFS->Kill (); $NFS->TimedWait (1);
355 exit 1;
357 if ($sec->PutFile ($iorbase) == -1) {
358 print STDERR "ERROR: cannot set file <$sec_iorfile>\n";
359 $STS->Kill (); $STS->TimedWait (1);
360 $NS->Kill (); $NS->TimedWait (1);
361 $NFS->Kill (); $NFS->TimedWait (1);
362 exit 1;
364 sleep 2;
366 $SEC->Arguments($CLI_args . " -k file://$sec_iorfile -d priority -o");
367 $SEC_status = $SEC->SpawnWaitKill ($sec->ProcessStartWaitInterval()+5);
368 if ($SEC_status != 0) {
369 print STDERR "ERROR: Sequence Consumer returned $SEC_status\n";
370 $status = 1;
373 $SES_status = $SES->WaitKill ($ses->ProcessStopWaitInterval());
374 if ($SES_status != 0) {
375 print STDERR "ERROR: Sequence Supplier returned $SES_status\n";
376 $status = 1;
379 $NFS_status = $NFS->Kill ($nfs->ProcessStopWaitInterval());
380 if ($NFS_status != 0) {
381 print STDERR "ERROR: Notify Service returned $NFS_status\n";
382 $status = 1;
385 $NS_status = $NS->TerminateWaitKill ($ns->ProcessStopWaitInterval());
386 if ($NS_status != 0) {
387 print STDERR "ERROR: Name Service returned $NS_status\n";
388 $status = 1;
391 $ns->DeleteFile ($nsiorfile);
392 $nfs->DeleteFile ($nfsiorfile);
393 $sts->DeleteFile ($iorbase);
394 $stc->DeleteFile ($iorbase);
395 $sec->DeleteFile ($iorbase);
396 $ses->DeleteFile ($iorbase);
398 exit $status;