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 #Schema of the interaction:
20 # 'Client' <---> 'Middle Server' <---> 'Server'
22 my $server = PerlACE
::TestTarget
::create_target
(1) || die "Create target 1 failed\n";
23 my $client = PerlACE
::TestTarget
::create_target
(2) || die "Create target 2 failed\n";
24 my $middle = PerlACE
::TestTarget
::create_target
(3) || die "Create target 3 failed\n";
26 my $inputfile = "test.ior";
27 my $thrserverfile = "thr_server.ior";
28 my $middleserverfile = "middle.ior";
30 #Files which used by client
31 my $client_inputfile = $client->LocalFile ($inputfile);
32 my $client_thrserverfile = $client->LocalFile ($thrserverfile);
33 $client->DeleteFile($inputfile);
34 $client->DeleteFile($thrserverfile);
36 #Files which used by server
37 my $server_inputfile = $server->LocalFile ($inputfile);
38 my $server_middleserverfile = $server->LocalFile ($middleserverfile);
39 $server->DeleteFile($inputfile);
40 $server->DeleteFile($middleserverfile);
42 #Files which used by middle server
43 my $middle_thrserverfile = $middle->LocalFile ($thrserverfile);
44 my $middle_middleserverfile = $middle->LocalFile ($middleserverfile);
45 $middle->DeleteFile($middleserverfile);
46 $middle->DeleteFile($thrserverfile);
48 $SV = $server->CreateProcess ("server",
49 "-ORBdebuglevel $debug_level " .
50 "-o $server_inputfile " .
51 "-i file://$server_middleserverfile");
53 $CL = $client->CreateProcess ("client",
54 "-ORBdebuglevel $debug_level " .
55 "-i file://$client_inputfile " .
56 "-o $client_thrserverfile");
58 $ML = $middle->CreateProcess ("server",
59 "-ORBdebuglevel $debug_level " .
60 "-i file://$middle_thrserverfile " .
61 "-o $middle_middleserverfile");
63 $client_status = $CL->Spawn ();
65 if ($client_status != 0) {
66 print STDERR
"ERROR: client returned $client_status\n";
70 if ($client->WaitForFileTimed ($thrserverfile,
71 $client->ProcessStartWaitInterval()) == -1) {
72 print STDERR
"ERROR: cannot find file <$client_thrserverfile>\n";
73 $SV->Kill (); $SV->TimedWait (1);
77 if ($client->GetFile ($thrserverfile) == -1) {
78 print STDERR
"ERROR: cannot retrieve file <$client_thrserverfile>\n";
79 $CL->Kill (); $CL->TimedWait (1);
82 if ($middle->PutFile ($thrserverfile) == -1) {
83 print STDERR
"ERROR: cannot set file <$middle_thrserverfile>\n";
84 $CL->Kill (); $CL->TimedWait (1);
88 $middle_status = $ML->Spawn ();
90 if ($middle_status != 0) {
91 print STDERR
"ERROR: client returned <$middle_status>\n";
95 if ($middle->WaitForFileTimed ($middleserverfile,
96 $client->ProcessStartWaitInterval()) == -1) {
97 print STDERR
"ERROR: cannot find file <$middle_middleserverfile>\n";
98 $SV->Kill (); $SV->TimedWait (1);
102 if ($middle->GetFile ($middleserverfile) == -1) {
103 print STDERR
"ERROR: cannot retrieve file <$middle_middleserverfile>\n";
104 $CL->Kill (); $CL->TimedWait (1);
107 if ($server->PutFile ($middleserverfile) == -1) {
108 print STDERR
"ERROR: cannot set file <$server_middleserverfile>\n";
109 $CL->Kill (); $CL->TimedWait (1);
113 $server_status = $SV->SpawnWaitKill ($server->ProcessStartWaitInterval() + 35);
115 if ($server_status != 0) {
116 print STDERR
"ERROR: client returned $server_status\n";
120 $client_status = $CL->WaitKill ($client->ProcessStopWaitInterval());
122 if ($client_status != 0) {
123 print STDERR
"ERROR: client returned $client_status\n";
127 $middle_status = $ML->WaitKill ($middle->ProcessStopWaitInterval());
129 if ($client_status != 0) {
130 print STDERR
"ERROR: client returned $middle_status\n";
134 $client->DeleteFile($inputfile);
135 $client->DeleteFile($thrserverfile);
137 $server->DeleteFile($inputfile);
138 $server->DeleteFile($middleserverfile);
140 $middle->DeleteFile($middleserverfile);
141 $middle->DeleteFile($thrserverfile);