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
;
12 my $debug_level = '0';
14 foreach my $i (@ARGV) {
20 my $server1 = PerlACE
::TestTarget
::create_target
(1) || die "Create target 1 failed\n";
21 my $server2 = PerlACE
::TestTarget
::create_target
(2) || die "Create target 2 failed\n";
22 my $client = PerlACE
::TestTarget
::create_target
(3) || die "Create target 3 failed\n";
24 my $iorbase1 = "server1.ior";
25 my $iorbase2 = "server2.ior";
26 my $server1_iorfile = $server1->LocalFile ($iorbase1);
27 my $server2_iorfile = $server2->LocalFile ($iorbase2);
28 my $client_iorfile1 = $client->LocalFile ($iorbase1);
29 my $client_iorfile2 = $client->LocalFile ($iorbase2);
30 $server1->DeleteFile($iorbase1);
31 $server2->DeleteFile($iorbase2);
32 $client->DeleteFile($iorbase1);
33 $client->DeleteFile($iorbase2);
35 my $SV1 = $server1->CreateProcess ("server", "-ORBdebuglevel $debug_level -o $server1_iorfile");
36 my $SV2 = $server2->CreateProcess ("server", "-ORBdebuglevel $debug_level -o $server2_iorfile");
37 my $CL = $client->CreateProcess ("client",
38 "-i file://$client_iorfile1 ".
39 "-j file://$client_iorfile2");
41 print STDERR
"\nrunning Smart Proxy test consisting of the client and ".
42 "two servers with <one-shot> policy\n\n";
44 my $server_status = $SV1->Spawn ();
46 if ($server_status != 0) {
47 print STDERR
"ERROR: server returned $server_status\n";
51 if ($server1->WaitForFileTimed ($iorbase1,
52 $server1->ProcessStartWaitInterval()) == -1) {
53 print STDERR
"ERROR: cannot find file <$server1_iorfile>\n";
54 $SV1->Kill (); $SV1->TimedWait (1);
58 $server_status = $SV2->Spawn ();
60 if ($server_status != 0) {
61 print STDERR
"ERROR: server returned $server_status\n";
62 $SV1->Kill (); $SV1->TimedWait (1);
66 if ($server2->WaitForFileTimed ($iorbase2,
67 $server2->ProcessStartWaitInterval()) == -1) {
68 print STDERR
"ERROR: cannot find file <$server2_iorfile>\n";
69 $SV1->Kill (); $SV1->TimedWait (1);
70 $SV2->Kill (); $SV2->TimedWait (1);
74 if ($server1->GetFile ($iorbase1) == -1) {
75 print STDERR
"ERROR: cannot retrieve file <$server1_iorfile>\n";
76 $SV1->Kill (); $SV1->TimedWait (1);
77 $SV2->Kill (); $SV2->TimedWait (1);
80 if ($client->PutFile ($iorbase1) == -1) {
81 print STDERR
"ERROR: cannot set file <$client_iorfile1>\n";
82 $SV1->Kill (); $SV1->TimedWait (1);
83 $SV2->Kill (); $SV2->TimedWait (1);
86 if ($server2->GetFile ($iorbase2) == -1) {
87 print STDERR
"ERROR: cannot retrieve file <$server2_iorfile>\n";
88 $SV1->Kill (); $SV1->TimedWait (1);
89 $SV2->Kill (); $SV2->TimedWait (1);
92 if ($client->PutFile ($iorbase2) == -1) {
93 print STDERR
"ERROR: cannot set file <$client_iorfile2>\n";
94 $SV1->Kill (); $SV1->TimedWait (1);
95 $SV2->Kill (); $SV2->TimedWait (1);
99 my $client_status = $CL->SpawnWaitKill ($client->ProcessStartWaitInterval() + 45);
101 if ($client_status != 0) {
102 print STDERR
"ERROR: client returned $client_status\n";
106 $server_status = $SV1->WaitKill ($server1->ProcessStopWaitInterval());
108 if ($server_status != 0) {
109 print STDERR
"ERROR: server returned $server_status\n";
113 $server_status = $SV2->WaitKill ($server2->ProcessStopWaitInterval());
115 if ($server_status != 0) {
116 print STDERR
"ERROR: server returned $server_status\n";
120 $server1->DeleteFile($iorbase1);
121 $server2->DeleteFile($iorbase2);
122 $client->DeleteFile($iorbase1);
123 $client->DeleteFile($iorbase2);
125 print STDERR
"\nrunning Smart Proxy test consisting of the client and ".
126 "two servers with <one-shot> policy disabled\n\n";
128 $server_status = $SV1->Spawn ();
130 if ($server_status != 0) {
131 print STDERR
"ERROR: server returned $server_status\n";
135 if ($server1->WaitForFileTimed ($iorbase1,
136 $server1->ProcessStartWaitInterval()) == -1) {
137 print STDERR
"ERROR: cannot find file <$server1_iorfile>\n";
138 $SV1->Kill (); $SV1->TimedWait (1);
142 $server_status = $SV2->Spawn ();
144 if ($server_status != 0) {
145 print STDERR
"ERROR: server returned $server_status\n";
146 $SV1->Kill (); $SV1->TimedWait (1);
150 if ($server2->WaitForFileTimed ($iorbase2,
151 $server2->ProcessStartWaitInterval()) == -1) {
152 print STDERR
"ERROR: cannot find file <$server2_iorfile>\n";
153 $SV1->Kill (); $SV1->TimedWait (1);
154 $SV2->Kill (); $SV2->TimedWait (1);
158 if ($server1->GetFile ($iorbase1) == -1) {
159 print STDERR
"ERROR: cannot retrieve file <$server1_iorfile>\n";
160 $SV1->Kill (); $SV1->TimedWait (1);
161 $SV2->Kill (); $SV2->TimedWait (1);
164 if ($client->PutFile ($iorbase1) == -1) {
165 print STDERR
"ERROR: cannot set file <$client_iorfile1>\n";
166 $SV1->Kill (); $SV1->TimedWait (1);
167 $SV2->Kill (); $SV2->TimedWait (1);
170 if ($server2->GetFile ($iorbase2) == -1) {
171 print STDERR
"ERROR: cannot retrieve file <$server2_iorfile>\n";
172 $SV1->Kill (); $SV1->TimedWait (1);
173 $SV2->Kill (); $SV2->TimedWait (1);
176 if ($client->PutFile ($iorbase2) == -1) {
177 print STDERR
"ERROR: cannot set file <$client_iorfile2>\n";
178 $SV1->Kill (); $SV1->TimedWait (1);
179 $SV2->Kill (); $SV2->TimedWait (1);
183 $CL->Arguments ("-f 0 -i file://$client_iorfile1 ".
184 "-j file://$client_iorfile2");
187 $client_status = $CL->SpawnWaitKill ($client->ProcessStartWaitInterval() + 45);
189 if ($client_status != 0) {
190 print STDERR
"ERROR: client returned $client_status\n";
194 $server_status = $SV1->WaitKill ($server1->ProcessStopWaitInterval());
196 if ($server_status != 0) {
197 print STDERR
"ERROR: server returned $server_status\n";
201 $server_status = $SV2->WaitKill ($server2->ProcessStopWaitInterval());
203 if ($server_status != 0) {
204 print STDERR
"ERROR: server returned $server_status\n";
208 $server1->DeleteFile($iorbase1);
209 $server2->DeleteFile($iorbase2);
210 $client->DeleteFile($iorbase1);
211 $client->DeleteFile($iorbase2);