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 $manager = 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 $out_ior = "output.ior";
27 my $server1_file1_ior = $server1->LocalFile($file1_ior);
28 my $server2_file2_ior = $server2->LocalFile($file2_ior);
29 my $manager_file1_ior = $manager->LocalFile($file1_ior);
30 my $manager_file2_ior = $manager->LocalFile($file2_ior);
31 my $manager_out_ior = $manager->LocalFile($out_ior);
33 $server1->DeleteFile($file1_ior);
34 $server2->DeleteFile($file2_ior);
35 $manager->DeleteFile($file1_ior);
36 $manager->DeleteFile($file2_ior);
37 $manager->DeleteFile($out_ior);
39 $SV1 = $server1->CreateProcess ("server", "-ORBdebuglevel $debug_level -o $server1_file1_ior");
40 $SV2 = $server2->CreateProcess ("server", "-ORBdebuglevel $debug_level -o $server2_file2_ior");
41 $MN = $manager->CreateProcess ("Manager", "-a file://$manager_file1_ior -b file://$manager_file2_ior ".
42 "-c $manager_out_ior");
44 print STDERR
"Starting Server\n";
46 $server_status = $SV1->Spawn ();
48 if ($server_status != 0) {
49 print STDERR
"ERROR: server 1 returned $server_status\n";
53 if ($server1->WaitForFileTimed ($file1_ior,
54 $server1->ProcessStartWaitInterval()) == -1) {
55 print STDERR
"ERROR: cannot find file <$server1_file1_ior>\n";
56 $SV1->Kill (); $SV1->TimedWait (1);
60 if ($server1->GetFile ($file1_ior) == -1) {
61 print STDERR
"ERROR: cannot retrieve file <$server1_file1_ior>\n";
62 $SV1->Kill (); $SV1->TimedWait (1);
66 if ($manager->PutFile ($file1_ior) == -1) {
67 print STDERR
"ERROR: cannot set file <$manager_file1_ior>\n";
68 $SV1->Kill (); $SV1->TimedWait (1);
72 print STDERR
"Starting Server\n";
74 $server_status = $SV2->Spawn ();
76 if ($server_status != 0) {
77 print STDERR
"ERROR: server 2 returned $server_status\n";
78 $SV1->Kill (); $SV1->TimedWait (1);
82 if ($server2->WaitForFileTimed ($file2_ior,
83 $server2->ProcessStartWaitInterval()) == -1) {
84 print STDERR
"ERROR: cannot find file <$server2_file2_ior>\n";
85 $SV2->Kill (); $SV2->TimedWait (1);
86 $SV1->Kill (); $SV1->TimedWait (1);
90 if ($server2->GetFile ($file2_ior) == -1) {
91 print STDERR
"ERROR: cannot retrieve file <$server2_file2_ior>\n";
92 $SV2->Kill (); $SV2->TimedWait (1);
93 $SV1->Kill (); $SV1->TimedWait (1);
97 if ($manager->PutFile ($file2_ior) == -1) {
98 print STDERR
"ERROR: cannot set file <$manager_file2_ior>\n";
99 $SV2->Kill (); $SV2->TimedWait (1);
100 $SV1->Kill (); $SV1->TimedWait (1);
104 print STDERR
"Starting Manager\n";
106 $manager_status = $MN->SpawnWaitKill ($manager->ProcessStartWaitInterval() + 45);
108 if ($manager_status != 0) {
109 print STDERR
"ERROR: manager returned $manager_status\n";
113 $server_status = $SV1->WaitKill ($server1->ProcessStopWaitInterval());
115 if ($server_status != 0) {
116 print STDERR
"ERROR: server 1 returned $server_status\n";
120 $server_status = $SV2->WaitKill ($server2->ProcessStopWaitInterval());
122 if ($server_status != 0) {
123 print STDERR
"ERROR: server 2 returned $server_status\n";
127 $server1->DeleteFile($file1_ior);
128 $server2->DeleteFile($file2_ior);
129 $manager->DeleteFile($file1_ior);
130 $manager->DeleteFile($file2_ior);
131 $manager->DeleteFile($out_ior);