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 $server1 = PerlACE
::TestTarget
::create_target
(1) || die "Create target 1 failed\n";
20 my $server2 = PerlACE
::TestTarget
::create_target
(2) || die "Create target 2 failed\n";
21 my $client = PerlACE
::TestTarget
::create_target
(3) || die "Create target 3 failed\n";
23 my $file1_ior = "file1.ior";
24 my $file2_ior = "file2.ior";
25 my $iogr10_ior = "iogr_10.ior";
26 my $iogr11_ior = "iogr_11.ior";
28 my $server1_file1_ior = $server1->LocalFile ($file1_ior);
29 my $server1_iogr11_ior= $server1->LocalFile ($iogr11_ior);
30 my $server2_file2_ior = $server2->LocalFile ($file2_ior);
31 my $client_file1_ior = $client->LocalFile ($file1_ior);
32 my $client_file2_ior = $client->LocalFile ($file2_ior);
33 my $client_iogr10_ior = $client->LocalFile ($iogr10_ior);
34 my $client_iogr11_ior = $client->LocalFile ($iogr11_ior);
36 $server1->DeleteFile ($file1_ior);
37 $server1->DeleteFile ($iogr11_ior);
38 $server2->DeleteFile ($file2_ior);
39 $client->DeleteFile ($file1_ior);
40 $client->DeleteFile ($file2_ior);
41 $client->DeleteFile ($iogr10_ior);
42 $client->DeleteFile ($iogr11_ior);
44 $SV1 = $server1->CreateProcess ("server", "-ORBdebuglevel $debug_level -o $server1_file1_ior ".
45 "-f file://$server1_iogr11_ior -k KEY1");
47 $SV2 = $server2->CreateProcess ("server", "-ORBdebuglevel $debug_level -o $server2_file2_ior -k KEY2");
49 $CL = $client->CreateProcess ("client", "-a file://$client_file1_ior -k KEY1 ".
50 "-b file://$client_file2_ior -l KEY2 ".
51 "-g $client_iogr10_ior -h $client_iogr11_ior");
53 print STDERR
"Starting Server 1\n";
55 $server_status = $SV1->Spawn ();
57 if ($server_status != 0) {
58 print STDERR
"ERROR: server 1 returned $server_status\n";
62 if ($server1->WaitForFileTimed ($file1_ior,
63 $server1->ProcessStartWaitInterval()) == -1) {
64 print STDERR
"ERROR: cannot find file <$server1_file1_ior>\n";
65 $SV1->Kill (); $SV1->TimedWait (1);
69 if ($server1->GetFile ($file1_ior) == -1) {
70 print STDERR
"ERROR: cannot retrieve file <$server1_file1_ior>\n";
71 $SV1->Kill (); $SV1->TimedWait (1);
75 if ($client->PutFile ($file1_ior) == -1) {
76 print STDERR
"ERROR: cannot set file <$client_file1_ior>\n";
77 $SV1->Kill (); $SV1->TimedWait (1);
81 print STDERR
"Starting Server 2\n";
83 $server_status = $SV2->Spawn ();
85 if ($server_status != 0) {
86 print STDERR
"ERROR: server 2 returned $server_status\n";
87 $SV1->Kill (); $SV1->TimedWait (1);
91 if ($server2->WaitForFileTimed ($file2_ior,
92 $server2->ProcessStartWaitInterval()) == -1) {
93 print STDERR
"ERROR: cannot find file <$server2_file2_ior>\n";
94 $SV2->Kill (); $SV2->TimedWait (1);
95 $SV1->Kill (); $SV1->TimedWait (1);
99 if ($server1->GetFile ($file2_ior) == -1) {
100 print STDERR
"ERROR: cannot retrieve file <$server2_file2_ior>\n";
101 $SV2->Kill (); $SV2->TimedWait (1);
102 $SV1->Kill (); $SV1->TimedWait (1);
106 if ($client->PutFile ($file2_ior) == -1) {
107 print STDERR
"ERROR: cannot set file <$client_file2_ior>\n";
108 $SV2->Kill (); $SV2->TimedWait (1);
109 $SV1->Kill (); $SV1->TimedWait (1);
113 print STDERR
"Starting Client\n";
114 $client_status = $CL->Spawn ();
116 if ($client_status != 0) {
117 print STDERR
"ERROR: client returned $client_status\n";
121 if ($client->WaitForFileTimed ($iogr11_ior,
122 $client->ProcessStartWaitInterval()) == -1) {
123 print STDERR
"ERROR: cannot find file <$client_iogr11_ior>\n";
124 $SV2->Kill (); $SV2->TimedWait (1);
125 $SV1->Kill (); $SV1->TimedWait (1);
126 $CL->Kill (); $CL->TimedWait (1);
130 if ($client->GetFile ($iogr11_ior) == -1) {
131 print STDERR
"ERROR: cannot retrieve file <$client_iogr11_ior>\n";
132 $SV2->Kill (); $SV2->TimedWait (1);
133 $SV1->Kill (); $SV1->TimedWait (1);
134 $CL->Kill (); $CL->TimedWait (1);
138 if ($server1->PutFile ($iogr11_ior) == -1) {
139 print STDERR
"ERROR: cannot set file <$server1_iogr11_ior>\n";
140 $SV2->Kill (); $SV2->TimedWait (1);
141 $SV1->Kill (); $SV1->TimedWait (1);
142 $CL->Kill (); $CL->TimedWait (1);
146 $client_status = $CL->WaitKill ($client->ProcessStopWaitInterval() + 15);
148 if ($client_status != 0) {
149 print STDERR
"ERROR: client returned $client_status\n";
153 $server_status = $SV1->WaitKill ($server1->ProcessStopWaitInterval(), {self_crash
=> 1});
155 if ($server_status < 0) {
156 print STDERR
"ERROR: server 1 returned $server_status\n";
160 $server_status = $SV2->WaitKill ($server2->ProcessStopWaitInterval(), {self_crash
=> 1});
162 if ($server_status < 0) {
163 print STDERR
"ERROR: server 2 returned $server_status\n";
167 $server1->DeleteFile ($file1_ior);
168 $server1->DeleteFile ($iogr11_ior);
169 $server2->DeleteFile ($file2_ior);
170 $client->DeleteFile ($file1_ior);
171 $client->DeleteFile ($file2_ior);
172 $client->DeleteFile ($iogr10_ior);
173 $client->DeleteFile ($iogr11_ior);