1 eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}'
2 & eval 'exec perl -S $0 $argv:q'
7 use lib
"$ENV{ACE_ROOT}/bin";
8 use PerlACE
::TestTarget
;
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 ();
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) {
59 print "Usage: $0 [-d]\n" .
60 " -d specifies that deadline discarding be tested.\n";
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 " .
74 $STS = $sts->CreateProcess ("Structured_Supplier",
75 "-ORBDebugLevel $debug_level ".
76 "-ORBInitRef NameService=iioploc://".
77 "$host:$port/NameService ".
80 $STC = $stc->CreateProcess ("Structured_Consumer");
82 $SES = $ses->CreateProcess ("Sequence_Supplier",
83 "-ORBDebugLevel $debug_level ".
84 "-ORBInitRef NameService=iioploc://".
85 "$host:$port/NameService ".
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";
98 if ($ns->WaitForFileTimed ($nsiorfile,$ns->ProcessStartWaitInterval()) == -1) {
99 print STDERR
"ERROR: cannot find file <$ns_nsiorfile>\n";
100 $NS->Kill (); $NS->TimedWait (1);
104 $NFS_status = $NFS->Spawn ();
105 if ($NFS_status != 0) {
106 print STDERR
"ERROR: Notify Service returned $NFS_status\n";
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);
116 @policies = ("fifo", "priority", "lifo");
118 push(@policies, "deadline");
121 @server_opts = ("", "", "", " -d");
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";
135 if ($sts->WaitForFileTimed ($iorbase,$sts->ProcessStartWaitInterval()) == -1) {
136 print STDERR
"ERROR: cannot1 find file <$sts_iorfile>\n";
137 $STS->Kill (); $STS->TimedWait (1);
141 if ($sts->GetFile ($iorbase) == -1) {
142 print STDERR
"ERROR: cannot retrieve file <$sts_iorfile>\n";
143 $STS->Kill (); $STS->TimedWait (1);
147 if ($stc->PutFile ($iorbase) == -1) {
148 print STDERR
"ERROR: cannot set file <$stc_iorfile>\n";
149 $STS->Kill (); $STS->TimedWait (1);
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);
164 $STS_status = $STS->WaitKill ($sts->ProcessStopWaitInterval());
165 if ($STS_status != 0) {
166 print STDERR
"ERROR: Structured Supplier returned $STS_status\n";
171 $sts->DeleteFile ($iorbase);
172 $stc->DeleteFile ($iorbase);
175 $sts->DeleteFile ($iorbase);
176 $stc->DeleteFile ($iorbase);
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";
191 if ($sts->WaitForFileTimed ($iorbase,$sts->ProcessStartWaitInterval()) == -1) {
192 print STDERR
"ERROR: cannot find file <$sts_iorfile>\n";
193 $STS->Kill (); $STS->TimedWait (1);
197 if ($sts->GetFile ($iorbase) == -1) {
198 print STDERR
"ERROR: cannot retrieve file <$sts_iorfile>\n";
199 $STS->Kill (); $STS->TimedWait (1);
203 if ($sec->PutFile ($iorbase) == -1) {
204 print STDERR
"ERROR: cannot set file <$sec_iorfile>\n";
205 $STS->Kill (); $STS->TimedWait (1);
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);
220 $STS_status = $STS->WaitKill ($sts->ProcessStopWaitInterval());
221 if ($STS_status != 0) {
222 print STDERR
"ERROR: Structured Supplier returned $STS_status\n";
227 $sts->DeleteFile ($iorbase);
228 $sec->DeleteFile ($iorbase);
231 $sts->DeleteFile ($iorbase);
232 $sec->DeleteFile ($iorbase);
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";
247 if ($ses->WaitForFileTimed ($iorbase,$ses->ProcessStartWaitInterval()) == -1) {
248 print STDERR
"ERROR: cannot find file <$ses_iorfile>\n";
249 $STS->Kill (); $STS->TimedWait (1);
253 if ($ses->GetFile ($iorbase) == -1) {
254 print STDERR
"ERROR: cannot retrieve file <$ses_iorfile>\n";
255 $STS->Kill (); $STS->TimedWait (1);
259 if ($sec->PutFile ($iorbase) == -1) {
260 print STDERR
"ERROR: cannot set file <$sec_iorfile>\n";
261 $STS->Kill (); $STS->TimedWait (1);
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);
276 $SES_status = $SES->WaitKill ($ses->ProcessStopWaitInterval());
277 if ($SES_status != 0) {
278 print STDERR
"ERROR: Sequence Supplier returned $SES_status\n";
283 $ses->DeleteFile ($iorbase);
284 $sec->DeleteFile ($iorbase);
287 $ses->DeleteFile ($iorbase);
288 $sec->DeleteFile ($iorbase);
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";
303 if ($ses->WaitForFileTimed ($iorbase,$ses->ProcessStartWaitInterval()) == -1) {
304 print STDERR
"ERROR: cannot find file <$ses_iorfile>\n";
305 $STS->Kill (); $STS->TimedWait (1);
309 if ($ses->GetFile ($iorbase) == -1) {
310 print STDERR
"ERROR: cannot retrieve file <$ses_iorfile>\n";
311 $STS->Kill (); $STS->TimedWait (1);
315 if ($stc->PutFile ($iorbase) == -1) {
316 print STDERR
"ERROR: cannot set file <$stc_iorfile>\n";
317 $STS->Kill (); $STS->TimedWait (1);
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";
331 $SES_status = $SES->WaitKill ($ses->ProcessStopWaitInterval());
332 if ($SES_status != 0) {
333 print STDERR
"ERROR: Sequence Supplier returned $SES_status\n";
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";
348 $NS_status = $NS->TerminateWaitKill ($ns->ProcessStopWaitInterval());
349 if ($NS_status != 0) {
350 print STDERR
"ERROR: Name Service returned $NS_status\n";
354 $ns->DeleteFile ($nsiorfile);
355 $nfs->DeleteFile ($nfsiorfile);
356 $sts->DeleteFile ($iorbase);
357 $stc->DeleteFile ($iorbase);
358 $sec->DeleteFile ($iorbase);
359 $ses->DeleteFile ($iorbase);