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 $file1_ior = "file1.ior";
20 my $file2_ior = "file2.ior";
21 my $output_ior = "output.ior";
23 my $server1 = PerlACE
::TestTarget
::create_target
(1) || die "Create target 1 failed\n";
24 my $server2 = PerlACE
::TestTarget
::create_target
(2) || die "Create target 2 failed\n";
25 my $managers_number = 4;
27 for ($i = 0; $i < $managers_number; $i++) {
28 $managers[$i] = PerlACE
::TestTarget
::create_target
($i + 3) || die "Create target $i + 3 failed\n";
31 my $server1_file1_ior = $server1->LocalFile($file1_ior);
32 my $server2_file2_ior = $server2->LocalFile($file2_ior);
33 my @managers_file1_ior = ();
34 my @managers_file2_ior = ();
35 my @managers_output_ior = ();
36 for ($i = 0; $i < $managers_number; $i++) {
37 $managers_file1_ior[$i] = $managers[$i]->LocalFile($file1_ior);
38 $managers_file2_ior[$i] = $managers[$i]->LocalFile($file2_ior);
39 $managers_output_ior[$i] = $managers[$i]->LocalFile($output_ior);
42 $SV1 = $server1->CreateProcess ("server", "-ORBdebuglevel $debug_level -o $server1_file1_ior -k KEY1");
43 $SV2 = $server2->CreateProcess ("server", "-ORBdebuglevel $debug_level -o $server2_file2_ior -k KEY2");
45 my @MNS_ARG_SUFFIX = ("", " -s", " -m", " -m -s");
48 for ($i = 0; $i < $managers_number; $i++) {
49 $MNS[$i] = $managers[$i]->CreateProcess ("Manager", "-a file://$managers_file1_ior[$i] -k KEY1 ".
50 "-b file://$managers_file2_ior[$i] -l KEY2 ".
51 "-c $managers_output_ior[$i]".$MNS_ARG_SUFFIX[$i]);
55 $server1->DeleteFile($file1_ior);
56 $server2->DeleteFile($file2_ior);
57 for ($i = 0; $i < $managers_number; $i++) {
58 $managers[$i]->DeleteFile($file1_ior);
59 $managers[$i]->DeleteFile($file2_ior);
60 $managers[$i]->DeleteFile($output_ior);
70 print STDERR
"Starting $name test\n";
71 print STDERR
"Starting Server 1\n";
72 my $server_result = $SV1->Spawn ();
73 if ($server_result != 0) {
74 print STDERR
"ERROR: server 1 returned $server_status\n";
78 if ($server1->WaitForFileTimed ($file1_ior,
79 $server1->ProcessStartWaitInterval()) == -1) {
80 print STDERR
"ERROR: cannot find file <$server1_file1_ior>\n";
81 $SV1->Kill (); $SV1->TimedWait (1);
85 if ($server1->GetFile ($file1_ior) == -1) {
86 print STDERR
"ERROR: cannot retrieve file <$server1_file1_ior>\n";
87 $SV1->Kill (); $SV1->TimedWait (1);
91 if ($managers[$mn_id]->PutFile ($file1_ior) == -1) {
92 print STDERR
"ERROR: cannot set file <$managers_file1_ior[$mn_id]>\n";
93 $SV1->Kill (); $SV1->TimedWait (1);
97 print STDERR
"Starting $name Manager\n";
98 my $mn_status = $MNS[$mn_id]->SpawnWaitKill ($managers[$mn_id]->ProcessStartWaitInterval() + 15);
100 if ($mn_status != 0) {
101 print STDERR
"ERROR: Manager $mn_id returned $mn_status\n";
105 $server_status = $SV1->WaitKill ($server1->ProcessStopWaitInterval(), {self_crash
=> 1});
107 if ($server1_status != 0) {
108 print STDERR
"ERROR: server 1 returned $server_status\n";
121 print STDERR
"Starting MERGED $name test\n";
122 print STDERR
"Starting Server 1\n";
123 my $server_result = $SV1->Spawn ();
124 if ($server_result != 0) {
125 print STDERR
"ERROR: server 1 returned $server_status\n";
129 if ($server1->WaitForFileTimed ($file1_ior,
130 $server1->ProcessStartWaitInterval()) == -1) {
131 print STDERR
"ERROR: cannot find file <$server1_file1_ior>\n";
132 $SV1->Kill (); $SV1->TimedWait (1);
136 if ($server1->GetFile ($file1_ior) == -1) {
137 print STDERR
"ERROR: cannot retrieve file <$server1_file1_ior>\n";
138 $SV1->Kill (); $SV1->TimedWait (1);
142 if ($managers[$mn_id]->PutFile ($file1_ior) == -1) {
143 print STDERR
"ERROR: cannot set file <$managers_file1_ior[$mn_id]>\n";
144 $SV1->Kill (); $SV1->TimedWait (1);
148 print STDERR
"Starting Server 2\n";
149 $server_result = $SV2->Spawn ();
150 if ($server_result != 0) {
151 print STDERR
"ERROR: server 2 returned $server_status\n";
152 $SV1->Kill (); $SV1->TimedWait (1);
156 if ($server2->WaitForFileTimed ($file2_ior,
157 $server2->ProcessStartWaitInterval()) == -1) {
158 print STDERR
"ERROR: cannot find file <$server2_file2_ior>\n";
159 $SV2->Kill (); $SV2->TimedWait (1);
160 $SV1->Kill (); $SV1->TimedWait (1);
164 if ($server2->GetFile ($file2_ior) == -1) {
165 print STDERR
"ERROR: cannot retrieve file <$server2_file2_ior>\n";
166 $SV2->Kill (); $SV2->TimedWait (1);
167 $SV1->Kill (); $SV1->TimedWait (1);
171 if ($managers[$mn_id]->PutFile ($file2_ior) == -1) {
172 print STDERR
"ERROR: cannot set file <$managers_file2_ior[$mn_id]>\n";
173 $SV2->Kill (); $SV2->TimedWait (1);
174 $SV1->Kill (); $SV1->TimedWait (1);
178 print STDERR
"Starting $name Manager\n";
179 my $mn_status = $MNS[$mn_id]->SpawnWaitKill ($managers[$mn_id]->ProcessStartWaitInterval() + 15);
181 if ($mn_status != 0) {
182 print STDERR
"ERROR: Manager $mn_id returned $mn_status\n";
186 $server_status = $SV1->WaitKill ($server1->ProcessStopWaitInterval() + 5, {self_crash
=> 1});
188 if ($server1_status != 0) {
189 print STDERR
"ERROR: server 1 returned $server_status\n";
193 $server_status = $SV2->WaitKill ($server2->ProcessStopWaitInterval() + 5, {self_crash
=> 1});
195 if ($server_status != 0) {
196 print STDERR
"ERROR: server 2 returned $server_status\n";
203 if (run_single
("ABORT", 0) != 0) {
207 if (run_single
("SHUTDOWN", 1) != 0) {
211 if (run_merged
("ABORT", 2) != 0) {
215 if (run_merged
("SHUTDOWN", 3) != 0) {