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
;
13 $test_idl = "test.idl";
22 $lookup_by_name = "-n";
26 # We want the tao_ifr executable to be found exactly in the path
27 # given, without being modified by the value of -ExeSubDir.
28 # So, we tell its Process object to ignore the setting of -ExeSubDir.
30 my $server1 = PerlACE
::TestTarget
::create_target
(1) || die "Create target 1 failed\n";
31 my $server2 = PerlACE
::TestTarget
::create_target
(2) || die "Create target 2 failed\n";
32 my $server3 = PerlACE
::TestTarget
::create_target
(3) || die "Create target 3 failed\n";
33 my $client = PerlACE
::TestTarget
::create_target
(4) || die "Create target 4 failed\n";
35 my $ior1file = "if_repo.ior";
36 my $ior2file = "iorfile";
38 #Files which used by server1
39 my $server1_ior1file = $server1->LocalFile ($ior1file);
40 $server1->DeleteFile($ior1file);
42 #Files which used by server2
43 my $server2_ior1file = $server2->LocalFile ($ior1file);
44 my $server2_ior2file = $server2->LocalFile ($ior2file);
45 $server2->DeleteFile($ior1file);
46 $server2->DeleteFile($ior2file);
48 #Files which used by server3
49 my $server3_ior1file = $server3->LocalFile ($ior1file);
50 $server3->DeleteFile($ior1file);
51 my $server3_test_idl = $server3->LocalFile ($test_idl);
53 #Files which used by client
54 my $client_ior1file = $client->LocalFile ($ior1file);
55 my $client_ior2file = $client->LocalFile ($ior2file);
56 $client->DeleteFile($ior1file);
57 $client->DeleteFile($ior2file);
59 $SV1 = $server1->CreateProcess ("$ENV{TAO_ROOT}/orbsvcs/IFR_Service/tao_ifr_service",
60 "-o $server1_ior1file");
63 $SV2 = $server2->CreateProcess ("server",
64 "-ORBdebuglevel $debug_level " .
65 "-ORBInitRef InterfaceRepository=file://$server2_ior1file " .
66 "-o $server2_ior2file");
68 $SV3 = $server3->CreateProcess ("$ENV{ACE_ROOT}/bin/tao_ifr",
69 "-ORBInitRef InterfaceRepository=file://$server3_ior1file $server3_test_idl");
72 $CL = $client->CreateProcess ("client",
73 "-ORBInitRef InterfaceRepository=file://$client_ior1file " .
74 "-k file://$client_ior2file " .
77 print STDOUT
"Start IFR Service\n";
79 $server_status = $SV1->Spawn ();
81 if ($server_status != 0) {
82 print STDERR
"ERROR: server returned $server_status\n";
86 if ($server1->WaitForFileTimed ($ior1file,
87 $server1->ProcessStartWaitInterval()) == -1) {
88 print STDERR
"ERROR: cannot find file <$server1_ior1file>\n";
89 $SV1->Kill (); $SV1->TimedWait (1);
93 if ($server1->GetFile ($ior1file) == -1) {
94 print STDERR
"ERROR: cannot retrieve file <$server1_ior1file>\n";
95 $SV1->Kill (); $SV1->TimedWait (1);
99 if ($server2->PutFile ($ior1file) == -1) {
100 print STDERR
"ERROR: cannot set file <$server2_ior1file>\n";
101 $SV1->Kill (); $SV1->TimedWait (1);
105 if ($server3->PutFile ($ior1file) == -1) {
106 print STDERR
"ERROR: cannot set file <$server3_ior1file>\n";
107 $SV1->Kill (); $SV1->TimedWait (1);
111 if ($client->PutFile ($ior1file) == -1) {
112 print STDERR
"ERROR: cannot set file <$client_ior1file>\n";
113 $SV1->Kill (); $SV1->TimedWait (1);
118 $SV1->Kill (); $SV1->TimedWait (1);
119 $SV2->Kill (); $SV2->TimedWait (1);
122 print STDOUT
"Start server\n";
124 $server_status = $SV2->Spawn ();
126 if ($server_status != 0) {
127 print STDERR
"ERROR: server returned $server_status\n";
131 if ($server2->WaitForFileTimed ($ior2file,
132 $server2->ProcessStartWaitInterval()) == -1) {
133 print STDERR
"ERROR: cannot find file <$server2_ior2file>\n";
138 if ($server2->GetFile ($ior2file) == -1) {
139 print STDERR
"ERROR: cannot retrieve file <$server2_ior2file>\n";
144 if ($client->PutFile ($ior2file) == -1) {
145 print STDERR
"ERROR: cannot set file <$client_ior2file>\n";
150 $SV3->IgnoreExeSubDir (1);
152 $server_status = $SV3->SpawnWaitKill ($server3->ProcessStartWaitInterval());
154 if ($server_status != 0) {
155 print STDERR
"ERROR: server returned $server_status\n";
159 print STDOUT
"Start client 1\n";
160 $client_status = $CL->SpawnWaitKill ($client->ProcessStartWaitInterval() + 45);
162 if ($client_status != 0) {
163 print STDERR
"ERROR: client returned $client_status\n";
167 # Do another lookup to check it really has been removed.
168 $SV3->Arguments ("-ORBInitRef InterfaceRepository=file://$server3_ior1file -r $server3_test_idl");
170 $server_status = $SV3->SpawnWaitKill ($server3->ProcessStartWaitInterval());
172 if ($server_status != 0) {
173 print STDERR
"ERROR: server returned $server_status\n";
178 $CL->Arguments ("-ORBInitRef InterfaceRepository=file://$client_ior1file " .
179 "-k file://$client_ior2file -n");
181 print STDOUT
"Start client 2\n";
183 $client_status = $CL->SpawnWaitKill ($client->ProcessStartWaitInterval() + 45);
185 if ($client_status == 0) {
186 print STDERR
"ERROR: client returned $client_status\n";
190 $server_status = $SV2->TerminateWaitKill ($server2->ProcessStopWaitInterval());
193 print STDERR
"ERROR: server returned $server_status\n";
197 print STDERR
"Stopping IFR\n";
199 $server_status = $SV1->TerminateWaitKill ($server1->ProcessStopWaitInterval());
202 print STDERR
"ERROR: server returned $server_status\n";
206 $server1->DeleteFile($ior1file);
207 $server2->DeleteFile($ior1file);
208 $server2->DeleteFile($ior2file);
209 $server3->DeleteFile($ior1file);
210 $client->DeleteFile($ior1file);
211 $client->DeleteFile($ior2file);