Merge pull request #1551 from DOCGroup/plm_jira_333
[ACE_TAO.git] / TAO / orbsvcs / tests / InterfaceRepo / Bug_3495_Regression / run_test.pl
blob46f36675db1d90af6d0b0bee47a6d38608478320
1 eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}'
2 & eval 'exec perl -S $0 $argv:q'
3 if 0;
5 # -*- perl -*-
7 use lib "$ENV{ACE_ROOT}/bin";
8 use PerlACE::TestTarget;
10 $status = 0;
11 $debug_level = '0';
13 $test_idl = "Test.idl";
15 foreach $i (@ARGV) {
16 if ($i eq '-debug') {
17 $debug_level = '10';
21 my $server1 = PerlACE::TestTarget::create_target (1) || die "Create target 1 failed\n";
22 my $server2 = PerlACE::TestTarget::create_target (2) || die "Create target 2 failed\n";
23 my $server3 = PerlACE::TestTarget::create_target (3) || die "Create target 3 failed\n";
24 my $client = PerlACE::TestTarget::create_target (4) || die "Create target 4 failed\n";
26 my $ior1file = "if_repo.ior";
27 my $ior2file = "server.ior";
29 #Files which used by server1
30 my $server1_ior1file = $server1->LocalFile ($ior1file);
31 $server1->DeleteFile($ior1file);
33 #Files which used by server2
34 my $server2_ior1file = $server2->LocalFile ($ior1file);
35 my $server2_ior2file = $server2->LocalFile ($ior2file);
36 $server2->DeleteFile($ior1file);
37 $server2->DeleteFile($ior2file);
39 #Files which used by server3
40 my $server3_ior1file = $server3->LocalFile ($ior1file);
41 $server3->DeleteFile($ior1file);
43 #Files which used by client
44 my $client_ior1file = $client->LocalFile ($ior1file);
45 my $client_ior2file = $client->LocalFile ($ior2file);
46 $client->DeleteFile($ior1file);
47 $client->DeleteFile($ior2file);
50 $SV1 = $server1->CreateProcess ("$ENV{TAO_ROOT}/orbsvcs/IFR_Service/tao_ifr_service",
51 "-ORBdebuglevel $debug_level " .
52 "-o $server1_ior1file");
55 $SV2 = $server2->CreateProcess ("server",
56 "-ORBdebuglevel $debug_level " .
57 "-ORBInitRef InterfaceRepository=file://$server2_ior1file " .
58 "-o $server2_ior2file");
60 $SV3 = $server3->CreateProcess ("$ENV{ACE_ROOT}/bin/tao_ifr",
61 "-ORBdebuglevel $debug_level " .
62 "-ORBInitRef InterfaceRepository=file://$server3_ior1file $test_idl");
65 $CL = $client->CreateProcess ("client",
66 "-ORBInitRef InterfaceRepository=file://$client_ior1file " .
67 "-k file://$client_ior2file");
69 $server_status = $SV1->Spawn ();
71 if ($server_status != 0) {
72 print STDERR "ERROR: server returned $server_status\n";
73 exit 1;
76 if ($server1->WaitForFileTimed ($ior1file,
77 $server1->ProcessStartWaitInterval()) == -1) {
78 print STDERR "ERROR: cannot find file <$server1_ior1file>\n";
79 $SV1->Kill (); $SV1->TimedWait (1);
80 exit 1;
83 if ($server1->GetFile ($ior1file) == -1) {
84 print STDERR "ERROR: cannot retrieve file <$server1_ior1file>\n";
85 $SV1->Kill (); $SV1->TimedWait (1);
86 exit 1;
89 if ($server2->PutFile ($ior1file) == -1) {
90 print STDERR "ERROR: cannot set file <$server2_ior1file>\n";
91 $SV1->Kill (); $SV1->TimedWait (1);
92 exit 1;
95 if ($server3->PutFile ($ior1file) == -1) {
96 print STDERR "ERROR: cannot set file <$server3_ior1file>\n";
97 $SV1->Kill (); $SV1->TimedWait (1);
98 exit 1;
101 if ($client->PutFile ($ior1file) == -1) {
102 print STDERR "ERROR: cannot set file <$client_ior1file>\n";
103 $SV1->Kill (); $SV1->TimedWait (1);
104 exit 1;
107 sub KillServers{
108 $SV1->Kill (); $SV1->TimedWait (1);
109 $SV2->Kill (); $SV2->TimedWait (1);
112 $server_status = $SV2->Spawn ();
114 if ($server_status != 0) {
115 print STDERR "ERROR: server returned $server_status\n";
116 exit 1;
119 if ($server2->WaitForFileTimed ($ior2file,
120 $server2->ProcessStartWaitInterval()) == -1) {
121 print STDERR "ERROR: cannot find file <$server2_ior2file>\n";
122 KillServers ();
123 exit 1;
126 if ($server2->GetFile ($ior2file) == -1) {
127 print STDERR "ERROR: cannot retrieve file <$server2_ior2file>\n";
128 KillServers ();
129 exit 1;
132 if ($client->PutFile ($ior2file) == -1) {
133 print STDERR "ERROR: cannot set file <$client_ior2file>\n";
134 KillServers ();
135 exit 1;
138 $server_status = $SV3->SpawnWaitKill ($server3->ProcessStartWaitInterval());
140 if ($server_status != 0) {
141 print STDERR "ERROR: server returned $server_status\n";
142 KillServers ();
143 exit 1;
146 $client_status = $CL->SpawnWaitKill ($client->ProcessStartWaitInterval() + 45);
148 if ($client_status != 0) {
149 print STDERR "ERROR: client returned $client_status\n";
150 $status = 1;
153 print STDERR "Stopping IFR\n";
155 $server_status = $SV2->TerminateWaitKill ($server2->ProcessStopWaitInterval());
157 if ($server != 0) {
158 print STDERR "ERROR: server returned $server_status\n";
159 $status = 1;
162 $server_status = $SV1->TerminateWaitKill ($server1->ProcessStopWaitInterval());
164 if ($server != 0) {
165 print STDERR "ERROR: server returned $server_status\n";
166 $status = 1;
169 $server1->DeleteFile($ior1file);
170 $server2->DeleteFile($ior1file);
171 $server2->DeleteFile($ior2file);
172 $server3->DeleteFile($ior1file);
173 $client->DeleteFile($ior1file);
174 $client->DeleteFile($ior2file);
176 exit $status;