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 $ifr = PerlACE
::TestTarget
::create_target
(1) || die "Create target 1 failed\n";
20 my $ti = PerlACE
::TestTarget
::create_target
(2) || die "Create target 2 failed\n";
21 my $gws = PerlACE
::TestTarget
::create_target
(3) || die "Create target 3 failed\n";
22 my $srv = PerlACE
::TestTarget
::create_target
(4) || die "Create target 4 failed\n";
23 my $cl2 = PerlACE
::TestTarget
::create_target
(5) || die "Create target 5 failed\n";
25 $ifriorfile= "if_repo.ior";
26 $srviorfile = "iorfile.ior";
27 $gwsiorfile = "gateway_ior.ior";
28 $testidl = "sum_server.idl";
30 my $ifr_ifriorfile = $ifr->LocalFile ($ifriorfile);
31 my $gws_ifriorfile = $gws->LocalFile ($ifriorfile);
32 my $ti_ifriorfile = $ti->LocalFile ($ifriorfile);
33 my $gws_gwsiorfile = $gws->LocalFile ($gwsiorfile);
34 my $srv_gwsiorfile = $srv->LocalFile ($gwsiorfile);
35 my $srv_srviorfile = $srv->LocalFile ($srviorfile);
36 my $cl2_srviorfile = $cl2->LocalFile ($srviorfile);
37 my $ti_testidl = $ti->LocalFile ($testidl);
38 $ifr->DeleteFile ($ifriorfile);
39 $gws->DeleteFile ($ifriorfile);
40 $ti->DeleteFile ($ifriorfile);
41 $gws->DeleteFile ($gwsiorfile);
42 $srv->DeleteFile ($gwsiorfile);
43 $srv->DeleteFile ($srviorfile);
44 $cl2->DeleteFile ($srviorfile);
46 # find the tao_ifr executable.
47 # Its placement is dependent upon the OS and if MPC generated makefiles are used.
49 if ($^O
eq "MSWin32") {
53 $tao_ifr = "$ENV{ACE_ROOT}/bin/tao_ifr";
54 if (! -e
$tao_ifr . $exec_extn ) {
55 $tao_ifr = "$ENV{TAO_ROOT}/orbsvcs/IFR_Service/tao_ifr";
56 if (! -e
$tao_ifr . $exec_extn ) {
57 print STDERR
"ERROR: tao_ifr compiler not found.\n";
65 for ($i = 0; $i <= $#ARGV; $i++) {
66 if ($ARGV[$i] eq "-n") {
67 $lookup_by_name = "-n";
74 $TI = $ti->CreateProcess ($tao_ifr);
75 $IFR = $ifr->CreateProcess ("$ENV{TAO_ROOT}/orbsvcs/IFR_Service/tao_ifr_service",
76 "-o $ifr_ifriorfile");
77 $GWS = $gws->CreateProcess ("gateway_server",
78 "-o $gws_gwsiorfile ".
79 "-ORBInitRef IFR_Service=file://$gws_ifriorfile");
80 $SRV = $srv->CreateProcess ("server",
81 "-o $srv_srviorfile ".
82 "-ORBInitRef Gateway_Object_Factory=file://$gws_gwsiorfile");
83 $CL2 = $cl2->CreateProcess ("client",
84 "-k file://$cl2_srviorfile");
86 $IFR_status = $IFR->Spawn ();
88 if ($IFR_status != 0) {
89 print STDERR
"ERROR: IFR Service returned $IFR_status\n";
93 if ($ifr->WaitForFileTimed ($ifriorfile,$ifr->ProcessStartWaitInterval()) == -1) {
94 print STDERR
"ERROR: cannot find file <$ifr_ifriorfile>\n";
95 $IFR->Kill (); $IFR->TimedWait (1);
99 if ($ifr->GetFile ($ifriorfile) == -1) {
100 print STDERR
"ERROR: cannot retrieve file <$ifr_ifriorfile>\n";
101 $IFR->Kill (); $IFR->TimedWait (1);
104 if ($ti->PutFile ($ifriorfile) == -1) {
105 print STDERR
"ERROR: cannot set file <$ti_ifriorfile>\n";
106 $IFR->Kill (); $IFR->TimedWait (1);
109 if ($gws->PutFile ($ifriorfile) == -1) {
110 print STDERR
"ERROR: cannot set file <$gws_ifriorfile>\n";
111 $IFR->Kill (); $IFR->TimedWait (1);
115 $TI->Arguments ("-ORBInitRef InterfaceRepository=file://$ti_ifriorfile $ti_testidl");
116 $TI_status = $TI->SpawnWaitKill ($ti->ProcessStartWaitInterval()+15);
118 $GWS_status = $GWS->Spawn ();
120 if ($GWS_status != 0) {
121 print STDERR
"ERROR: Gateway returned $GWS_status\n";
125 if ($gws->WaitForFileTimed ($gwsiorfile,$gws->ProcessStartWaitInterval()) == -1) {
126 print STDERR
"ERROR: cannot find file <$gws_gwsiorfile>\n";
127 $IFR->Kill (); $IFR->TimedWait (1);
128 $GWS->Kill (); $GWS->TimedWait (1);
132 if ($gws->GetFile ($gwsiorfile) == -1) {
133 print STDERR
"ERROR: cannot retrieve file <$gws_gwsiorfile>\n";
134 $IFR->Kill (); $IFR->TimedWait (1);
135 $GWS->Kill (); $GWS->TimedWait (1);
138 if ($srv->PutFile ($gwsiorfile) == -1) {
139 print STDERR
"ERROR: cannot set file <$srv_gwsiorfile>\n";
140 $IFR->Kill (); $IFR->TimedWait (1);
141 $GWS->Kill (); $GWS->TimedWait (1);
145 $SRV_status = $SRV->Spawn ();
147 if ($SRV_status != 0) {
148 print STDERR
"ERROR: Server returned $SRV_status\n";
152 if ($srv->WaitForFileTimed ($srviorfile,$srv->ProcessStartWaitInterval()+1485) == -1) {
153 print STDERR
"ERROR: cannot find file <$srv_srviorfile>\n";
154 $IFR->Kill (); $IFR->TimedWait (1);
155 $GWS->Kill (); $GWS->TimedWait (1);
156 $SRV->Kill (); $SRV->TimedWait (1);
160 if ($srv->GetFile ($srviorfile) == -1) {
161 print STDERR
"ERROR: cannot retrieve file <$srv_srviorfile>\n";
162 $IFR->Kill (); $IFR->TimedWait (1);
163 $GWS->Kill (); $GWS->TimedWait (1);
164 $SRV->Kill (); $SRV->TimedWait (1);
167 if ($cl2->PutFile ($srviorfile) == -1) {
168 print STDERR
"ERROR: cannot set file <$cl2_srviorfile>\n";
169 $IFR->Kill (); $IFR->TimedWait (1);
170 $GWS->Kill (); $GWS->TimedWait (1);
171 $SRV->Kill (); $SRV->TimedWait (1);
175 if ($TI_status != 0) {
176 print STDERR
"ERROR: tao_idl returned $TI_status\n";
180 $CL2_status = $CL2->SpawnWaitKill ($cl2->ProcessStartWaitInterval()+45);
181 if ($CL2_status != 0) {
182 print STDERR
"ERROR: Client returned $CL2_status\n";
186 $TI_status = $TI->SpawnWaitKill ($ti->ProcessStartWaitInterval()+15);
187 if ($TI_status != 0) {
188 print STDERR
"ERROR: tao_idl returned $TI_status\n";
192 $GWS_status = $GWS->TerminateWaitKill ($gws->ProcessStopWaitInterval());
194 if ($GWS_status != 0) {
195 print STDERR
"ERROR: Gateway returned $GWS_status\n";
199 $SRV_status = $SRV->TerminateWaitKill ($srv->ProcessStopWaitInterval());
201 if ($SRV_status != 0) {
202 print STDERR
"ERROR: Server returned $SRV_status\n";
206 $IFR_status = $IFR->TerminateWaitKill ($ifr->ProcessStopWaitInterval());
208 if ($IFR_status != 0) {
209 print STDERR
"ERROR: IFR Service returned $IFR_status\n";
213 $ifr->DeleteFile ($ifriorfile);
214 $gws->DeleteFile ($ifriorfile);
215 $ti->DeleteFile ($ifriorfile);
216 $gws->DeleteFile ($gwsiorfile);
217 $srv->DeleteFile ($gwsiorfile);
218 $srv->DeleteFile ($srviorfile);
219 $cl2->DeleteFile ($srviorfile);