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 PerlACE
::check_privilege_group
();
33 $port = $ns->RandomPort ();
34 $host = $ns->HostName ();
37 $iorbase = "supplier.ior";
38 $nfsiorfile = "notify.ior";
39 $nsiorfile = "naming.ior";
40 $nfsconffile = "notify$PerlACE::svcconf_ext";
42 my $ns_nsiorfile = $ns->LocalFile ($nsiorfile);
43 my $nfs_nfsiorfile = $nfs->LocalFile ($nfsiorfile);
44 my $sts_iorfile = $sts->LocalFile ($iorbase);
45 my $stc_iorfile = $stc->LocalFile ($iorbase);
46 my $sec_iorfile = $sec->LocalFile ($iorbase);
47 my $ses_iorfile = $ses->LocalFile ($iorbase);
48 my $nfs_nfsconffile = $nfs->LocalFile ($nfsconffile);
49 $ns->DeleteFile ($nsiorfile);
50 $nfs->DeleteFile ($nfsiorfile);
51 $sts->DeleteFile ($iorbase);
52 $stc->DeleteFile ($iorbase);
53 $sec->DeleteFile ($iorbase);
54 $ses->DeleteFile ($iorbase);
56 foreach my $arg (@ARGV) {
61 print "Usage: $0 [-d]\n" .
62 " -d specifies that deadline discarding be tested.\n";
67 $NS = $ns->CreateProcess ("$ENV{TAO_ROOT}/orbsvcs/Naming_Service/tao_cosnaming",
68 "-ORBEndpoint iiop://$host:$port -o $ns_nsiorfile");
70 $NFS = $nfs->CreateProcess ("$ENV{TAO_ROOT}/orbsvcs/Notify_Service/tao_cosnotification",
71 "-ORBInitRef NameService=iioploc://" .
72 "$host:$port/NameService " .
73 "-IORoutput $nfs_nfsiorfile -ORBSvcConf " .
76 $STS = $sts->CreateProcess ("Structured_Supplier",
77 "-ORBDebugLevel $debug_level ".
78 "-ORBInitRef NameService=iioploc://".
79 "$host:$port/NameService ".
82 $STC = $stc->CreateProcess ("Structured_Consumer");
84 $SES = $ses->CreateProcess ("Sequence_Supplier",
85 "-ORBDebugLevel $debug_level ".
86 "-ORBInitRef NameService=iioploc://".
87 "$host:$port/NameService ".
90 $SEC = $sec->CreateProcess ("Sequence_Consumer");
92 $CLI_args = "-ORBInitRef NameService=iioploc://$host:$port/NameService ";
95 $NS_status = $NS->Spawn ();
96 if ($NS_status != 0) {
97 print STDERR
"ERROR: Name Service returned $NS_status\n";
100 if ($ns->WaitForFileTimed ($nsiorfile,$ns->ProcessStartWaitInterval()) == -1) {
101 print STDERR
"ERROR: cannot find file <$ns_nsiorfile>\n";
102 $NS->Kill (); $NS->TimedWait (1);
106 $NFS_status = $NFS->Spawn ();
107 if ($NFS_status != 0) {
108 print STDERR
"ERROR: Notify Service returned $NFS_status\n";
111 if ($nfs->WaitForFileTimed ($nfsiorfile,$nfs->ProcessStartWaitInterval()) == -1) {
112 print STDERR
"ERROR: cannot find file <$nfs_nfsiorfile>\n";
113 $NS->Kill (); $NS->TimedWait (1);
114 $NFS->Kill (); $NFS->TimedWait (1);
118 @policies = ("fifo", "priority", "lifo");
120 push(@policies, "deadline");
123 @server_opts = ("", "", "", " -d");
125 for($i = 0; $i <= $#policies; $i++) {
126 $discard_policy = $policies[$i];
127 print "****** Structured Supplier -> Structured Consumer with the " .
128 "$discard_policy policy ******\n";
130 $STS->Arguments($STS->Arguments() . $server_opts[$i]);
131 $STS_status = $STS->Spawn ();
132 if ($STS_status != 0) {
133 print STDERR
"ERROR: Structured Supplier returned $STS_status\n";
137 if ($sts->WaitForFileTimed ($iorbase,$sts->ProcessStartWaitInterval()) == -1) {
138 print STDERR
"ERROR: cannot1 find file <$sts_iorfile>\n";
139 $STS->Kill (); $STS->TimedWait (1);
143 if ($sts->GetFile ($iorbase) == -1) {
144 print STDERR
"ERROR: cannot retrieve file <$sts_iorfile>\n";
145 $STS->Kill (); $STS->TimedWait (1);
149 if ($stc->PutFile ($iorbase) == -1) {
150 print STDERR
"ERROR: cannot set file <$stc_iorfile>\n";
151 $STS->Kill (); $STS->TimedWait (1);
157 $STC->Arguments($CLI_args . " -k file://$stc_iorfile -d $discard_policy");
158 $STC_status = $STC->SpawnWaitKill ($stc->ProcessStartWaitInterval()+5);
159 if ($STC_status != 0) {
160 print STDERR
"ERROR: Structured Consumer returned $STC_status\n";
161 $STS->Kill (); $STS->TimedWait (1);
166 $STS_status = $STS->WaitKill ($sts->ProcessStopWaitInterval());
167 if ($STS_status != 0) {
168 print STDERR
"ERROR: Structured Supplier returned $STS_status\n";
173 $sts->DeleteFile ($iorbase);
174 $stc->DeleteFile ($iorbase);
177 $sts->DeleteFile ($iorbase);
178 $stc->DeleteFile ($iorbase);
181 for($i = 0; $i <= $#policies; $i++) {
182 $discard_policy = $policies[$i];
183 print "***** Structured Supplier -> Sequence Consumer with the " .
184 "$discard_policy policy *****\n";
186 $STS->Arguments($STS->Arguments() . $server_opts[$i]);
187 $STS_status = $STS->Spawn ();
188 if ($STS_status != 0) {
189 print STDERR
"ERROR: Structured Supplier returned $STS_status\n";
193 if ($sts->WaitForFileTimed ($iorbase,$sts->ProcessStartWaitInterval()) == -1) {
194 print STDERR
"ERROR: cannot find file <$sts_iorfile>\n";
195 $STS->Kill (); $STS->TimedWait (1);
199 if ($sts->GetFile ($iorbase) == -1) {
200 print STDERR
"ERROR: cannot retrieve file <$sts_iorfile>\n";
201 $STS->Kill (); $STS->TimedWait (1);
205 if ($sec->PutFile ($iorbase) == -1) {
206 print STDERR
"ERROR: cannot set file <$sec_iorfile>\n";
207 $STS->Kill (); $STS->TimedWait (1);
213 $SEC->Arguments($CLI_args . " -k file://$sec_iorfile -d $discard_policy");
214 $SEC_status = $SEC->SpawnWaitKill ($sec->ProcessStartWaitInterval()+5);
215 if ($SEC_status != 0) {
216 print STDERR
"ERROR: Sequence Consumer returned $SEC_status\n";
217 $STS->Kill (); $STS->TimedWait (1);
222 $STS_status = $STS->WaitKill ($sts->ProcessStopWaitInterval());
223 if ($STS_status != 0) {
224 print STDERR
"ERROR: Structured Supplier returned $STS_status\n";
229 $sts->DeleteFile ($iorbase);
230 $sec->DeleteFile ($iorbase);
233 $sts->DeleteFile ($iorbase);
234 $sec->DeleteFile ($iorbase);
237 for($i = 0; $i <= $#policies; $i++) {
238 $discard_policy = $policies[$i];
239 print "**** Sequence Supplier -> Sequence Consumer with the " .
240 "$discard_policy policy ****\n";
242 $SES->Arguments($SES->Arguments() . $server_opts[$i]);
243 $SES_status = $SES->Spawn ();
244 if ($SES_status != 0) {
245 print STDERR
"ERROR: Sequence Supplier returned $SES_status\n";
249 if ($ses->WaitForFileTimed ($iorbase,$ses->ProcessStartWaitInterval()) == -1) {
250 print STDERR
"ERROR: cannot find file <$ses_iorfile>\n";
251 $STS->Kill (); $STS->TimedWait (1);
255 if ($ses->GetFile ($iorbase) == -1) {
256 print STDERR
"ERROR: cannot retrieve file <$ses_iorfile>\n";
257 $STS->Kill (); $STS->TimedWait (1);
261 if ($sec->PutFile ($iorbase) == -1) {
262 print STDERR
"ERROR: cannot set file <$sec_iorfile>\n";
263 $STS->Kill (); $STS->TimedWait (1);
269 $SEC->Arguments($CLI_args . " -k file://$sec_iorfile -d $discard_policy");
270 $SEC_status = $SEC->SpawnWaitKill ($sec->ProcessStartWaitInterval()+5);
271 if ($SEC_status != 0) {
272 print STDERR
"ERROR: Sequence Consumer returned $SEC_status\n";
273 $SES->Kill (); $SES->TimedWait (1);
278 $SES_status = $SES->WaitKill ($ses->ProcessStopWaitInterval());
279 if ($SES_status != 0) {
280 print STDERR
"ERROR: Sequence Supplier returned $SES_status\n";
285 $ses->DeleteFile ($iorbase);
286 $sec->DeleteFile ($iorbase);
289 $ses->DeleteFile ($iorbase);
290 $sec->DeleteFile ($iorbase);
293 for($i = 0; $i <= $#policies; $i++) {
294 $discard_policy = $policies[$i];
295 print "**** Sequence Supplier -> Structured Consumer with the " .
296 "$discard_policy policy ****\n";
298 $SES->Arguments($SES->Arguments() . $server_opts[$i]);
299 $SES_status = $SES->Spawn ();
300 if ($SES_status != 0) {
301 print STDERR
"ERROR: Sequence Supplier returned $SES_status\n";
305 if ($ses->WaitForFileTimed ($iorbase,$ses->ProcessStartWaitInterval()) == -1) {
306 print STDERR
"ERROR: cannot find file <$ses_iorfile>\n";
307 $STS->Kill (); $STS->TimedWait (1);
311 if ($ses->GetFile ($iorbase) == -1) {
312 print STDERR
"ERROR: cannot retrieve file <$ses_iorfile>\n";
313 $STS->Kill (); $STS->TimedWait (1);
317 if ($stc->PutFile ($iorbase) == -1) {
318 print STDERR
"ERROR: cannot set file <$stc_iorfile>\n";
319 $STS->Kill (); $STS->TimedWait (1);
325 $STC->Arguments($CLI_args . " -k file://$stc_iorfile -d $discard_policy");
326 $STC_status = $STC->SpawnWaitKill ($stc->ProcessStartWaitInterval()+5);
327 if ($STC_status != 0) {
328 print STDERR
"ERROR: Structured Consumer returned $STC_status\n";
333 $SES_status = $SES->WaitKill ($ses->ProcessStopWaitInterval());
334 if ($SES_status != 0) {
335 print STDERR
"ERROR: Sequence Supplier returned $SES_status\n";
339 $ses->DeleteFile ($iorbase);
340 $stc->DeleteFile ($iorbase);
344 $NFS_status = $NFS->Kill ($nfs->ProcessStopWaitInterval());
345 if ($NFS_status != 0) {
346 print STDERR
"ERROR: Notify Service returned $NFS_status\n";
350 $NS_status = $NS->TerminateWaitKill ($ns->ProcessStopWaitInterval());
351 if ($NS_status != 0) {
352 print STDERR
"ERROR: Name Service returned $NS_status\n";
356 $ns->DeleteFile ($nsiorfile);
357 $nfs->DeleteFile ($nfsiorfile);
358 $sts->DeleteFile ($iorbase);
359 $stc->DeleteFile ($iorbase);
360 $sec->DeleteFile ($iorbase);
361 $ses->DeleteFile ($iorbase);