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 $server = PerlACE
::TestTarget
::create_target
(1) || die "Create target 1 failed\n";
20 my $client = PerlACE
::TestTarget
::create_target
(2) || die "Create target 2 failed\n";
21 my $locator = PerlACE
::TestTarget
::create_target
(3) || die "Create target 3 failed\n";
22 my $activator = PerlACE
::TestTarget
::create_target
(4) || die "Create target 4 failed\n";
23 my $tao_imr = PerlACE
::TestTarget
::create_target
(5) || die "Create target 5 failed\n";
25 # The location of the implementation repository binaries
26 my $imr_bin_path = "$ENV{TAO_ROOT}/orbsvcs/ImplRepo_Service";
27 # The location of the tao_imr IMR utility
28 my $tao_imr_bin_path = "$ENV{ACE_ROOT}/bin";
30 # Run the IMR locator on a fixed port
31 my $port = $locator->RandomPort();
33 my $imr_ior = "impl.ior";
34 my $actv_ior = "activator.ior";
35 my $srv_ior = "server.ior";
37 my $server_srv_ior = $server->LocalFile ($srv_ior);
38 my $server_imr_ior = $server->LocalFile ($imr_ior);
39 my $client_srv_ior = $client->LocalFile ($srv_ior);
40 my $locator_imr_ior = $locator->LocalFile ($imr_ior);
41 my $tao_imr_imr_ior = $tao_imr->LocalFile ($imr_ior);
42 my $activator_actv_ior = $activator->LocalFile ($actv_ior);
43 my $activator_imr_ior = $activator->LocalFile ($imr_ior);
44 $server->DeleteFile($srv_ior);
45 $server->DeleteFile($imr_ior);
46 $client->DeleteFile($srv_ior);
47 $locator->DeleteFile ($imr_ior);
48 $tao_imr->DeleteFile ($imr_ior);
49 $activator->DeleteFile ($actv_ior);
50 $activator->DeleteFile ($imr_ior);
52 $SV = $server->CreateProcess ("server", "-ORBdebuglevel $debug_level -o $server_srv_ior ".
53 "-ORBInitRef ImplRepoService=file://$server_imr_ior ".
55 $CL = $client->CreateProcess ("client", "-k file://$client_srv_ior");
56 $LC = $locator->CreateProcess ("$imr_bin_path/tao_imr_locator", "-o $locator_imr_ior ".
57 "-ORBEndpoint iiop://:$port");
58 $AC = $activator->CreateProcess ("$imr_bin_path/tao_imr_activator",
59 "-o $activator_actv_ior ".
60 "-ORBInitRef ImplRepoService=file://$activator_imr_ior");
62 $TI = $tao_imr->CreateProcess ("$tao_imr_bin_path/tao_imr",
63 "add MyPoa -ORBInitRef ImplRepoService=file://$tao_imr_imr_ior");
65 $server->DeleteFile($imr_ior);
66 $locator->DeleteFile ($imr_ior);
67 $tao_imr->DeleteFile ($imr_ior);
68 $activator->DeleteFile ($imr_ior);
70 $process_status = $LC->Spawn ();
72 if ($process_status != 0) {
73 print STDERR
"ERROR: locator returned $process_status\n";
77 if ($locator->WaitForFileTimed ($imr_ior,
78 $locator->ProcessStartWaitInterval()) == -1) {
79 print STDERR
"ERROR: cannot find file <$locator_imr_ior>\n";
80 $LC->Kill (); $LC->TimedWait (1);
84 if ($locator->GetFile ($imr_ior) == -1) {
85 print STDERR
"ERROR: cannot retrieve file <$locator_imr_ior>\n";
86 $LC->Kill (); $LC->TimedWait (1);
90 if ($server->PutFile ($imr_ior) == -1) {
91 print STDERR
"ERROR: cannot set file <$server_imr_ior>\n";
92 $LC->Kill (); $LC->TimedWait (1);
96 if ($tao_imr->PutFile ($imr_ior) == -1) {
97 print STDERR
"ERROR: cannot set file <$tao_imr_imr_ior>\n";
98 $LC->Kill (); $LC->TimedWait (1);
102 if ($activator->PutFile ($imr_ior) == -1) {
103 print STDERR
"ERROR: cannot set file <$activator_imr_ior>\n";
104 $LC->Kill (); $LC->TimedWait (1);
112 $server->DeleteFile($srv_ior);
113 $client->DeleteFile($srv_ior);
115 $process_status = $SV->Spawn ();
117 if ($process_status != 0) {
118 print STDERR
"ERROR: server returned $process_status\n";
122 if ($server->WaitForFileTimed ($srv_ior,
123 $server->ProcessStartWaitInterval()) == -1) {
124 print STDERR
"ERROR: cannot find file <$server_srv_ior>\n";
125 $SV->Kill (); $SV->TimedWait (1);
129 if ($server->GetFile ($srv_ior) == -1) {
130 print STDERR
"ERROR: cannot retrieve file <$server_srv_ior>\n";
131 $SV->Kill (); $SV->TimedWait (1);
135 if ($client->PutFile ($srv_ior) == -1) {
136 print STDERR
"ERROR: cannot set file <$client_srv_ior>\n";
137 $SV->Kill (); $SV->TimedWait (1);
144 # Start the IMR locator to generate an IOR file for the server to use...
145 $process_status = run_locator
();
147 if ($process_status != 0) {
148 print STDERR
"ERROR: run_locator returned $process_status\n";
152 # ...then shut it down so that the server will not be able to contact it
153 $process_status = $LC->TerminateWaitKill ($locator->ProcessStopWaitInterval());
155 if ($process_status != 0) {
156 print STDERR
"ERROR: locator returned $process_status\n";
161 $process_status = run_server
();
163 if ($process_status != 0) {
164 print STDERR
"ERROR: run_server returned $process_status\n";
168 # Use the client to ask the server to try and create a persistent POA
169 # We expect this to 'fail' as the IMR is dead
170 $process_status = $CL->SpawnWaitKill ($client->ProcessStartWaitInterval() + 15);
172 if ($process_status == 0) {
173 print STDERR
"ERROR: First create POA attempt succeeded when it shouldn't have done\n";
174 $SV->Kill (); $SV->TimedWait (1);
178 # Now we restart the IMR locator
179 $process_status = run_locator
();
181 if ($process_status != 0) {
182 print STDERR
"ERROR: run_locator returned $process_status\n";
186 # Work out the IMR activator command line.
187 # Use the '-a' switch if this is a regression for bug #1394, else not
188 if ($use_tao_imr_util == 0) {
189 my $activator_args = $activator->Arguments();
190 $activator->Arguments("$activator_args -a");
193 # Start up the activator
194 $process_status = $AC->Spawn ();
196 if ($process_status != 0) {
197 print STDERR
"ERROR: activator returned $process_status\n";
201 if ($activator->WaitForFileTimed ($actv_ior,
202 $activator->ProcessStartWaitInterval()) == -1) {
203 print STDERR
"ERROR: cannot find file <$activator_actv_ior>\n";
204 $AC->Kill (); $AC->TimedWait (1);
205 $LC->Kill (); $LC->TimedWait (1);
209 ## Since we have restarted the locator, we need to restart
210 ## the server so that it can pick up the new locator IOR
211 $SV->Kill (); $SV->TimedWait (1);
213 $process_status = run_server
();
215 if ($process_status != 0) {
216 print STDERR
"ERROR: run_server returned $process_status\n";
217 $AC->Kill (); $AC->TimedWait (1);
218 $LC->Kill (); $LC->TimedWait (1);
222 # If this is just a regression for bug #1395 we need to register the POA
223 # If it is a regression for enhancement bug #1394, we don't need to.
224 if ($use_tao_imr_util != 0) {
225 # Add the persistent POA name to the IMR
226 $process_status = $TI->SpawnWaitKill ($tao_imr->ProcessStartWaitInterval() + 15);
228 if ($process_status != 0) {
229 print STDERR
"ERROR: tao_imr returned $process_status\n";
230 $AC->Kill (); $AC->TimedWait (1);
231 $LC->Kill (); $LC->TimedWait (1);
236 # Use the client to tell the server to attempt to create the POA again
237 $process_status = $CL->SpawnWaitKill ($client->ProcessStartWaitInterval() + 15);
239 if ($process_status != 0) {
240 print STDERR
"ERROR: Second create POA attempt failed when it should have succeeded\n";
241 $SV->Kill (); $SV->TimedWait (1);
242 $AC->Kill (); $AC->TimedWait (1);
243 $LC->Kill (); $LC->TimedWait (1);
248 $process_status = $SV->TerminateWaitKill ($server->ProcessStopWaitInterval());
250 if ($process_status != 0) {
251 print STDERR
"ERROR: server returned $process_status\n";
255 $process_status = $LC->TerminateWaitKill ($locator->ProcessStopWaitInterval());
257 if ($process_status != 0) {
258 print STDERR
"ERROR: locator returned $process_status\n";
262 $process_status = $AC->TerminateWaitKill ($activator->ProcessStopWaitInterval());
264 if ($process_status != 0) {
265 print STDERR
"ERROR: activator returned $process_status\n";
272 # Run regression for bug #1395
273 $use_tao_imr_util = 1;
274 $status = test_body
();
277 print STDERR
"ERROR: Regression test for Bug #1395 failed\n";
280 # Bug 1394 is an enhancement so will not be submitted until after TAO1.3.1
281 # Uncomment the following to activate regression after submission and ..
282 # Run regression for bug #1394
283 #$use_tao_imr_util = 0;
284 #$test_result = test_body();
285 #if ($test_result != 0)
287 # print STDERR "ERROR: Regression test for Bug #1394 failed\n";