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
;
14 $number_threads = '2';
15 $server_iterations = '5';
24 my $server1 = PerlACE
::TestTarget
::create_target
(1) || die "Create target 1 failed\n";
25 my $server2 = PerlACE
::TestTarget
::create_target
(2) || die "Create target 2 failed\n";
26 my $client = PerlACE
::TestTarget
::create_target
(3) || die "Create target 3 failed\n";
28 my $ior1file = "server1.ior";
29 my $ior2file = "server2.ior";
31 #Files which used by server1
32 my $server1_ior1file = $server1->LocalFile ($ior1file);
33 $server1->DeleteFile($ior1file);
35 #Files which used by server2
36 my $server2_ior2file = $server2->LocalFile ($ior2file);
37 $server2->DeleteFile($ior2file);
39 #Files which used by server2
40 my $client_ior1file = $client->LocalFile ($ior1file);
41 my $client_ior2file = $client->LocalFile ($ior2file);
42 $client->DeleteFile($ior1file);
43 $client->DeleteFile($ior2file);
45 $SV1 = $server1->CreateProcess ("server",
46 "-ORBdebuglevel $debug_level " .
47 "-o $server1_ior1file");
49 $SV2 = $server2->CreateProcess ("server",
50 "-ORBdebuglevel $debug_level " .
51 "-o $server2_ior2file");
54 $CL = $client->CreateProcess ("client",
57 "-n $number_threads " .
59 "-s $server_iterations");
61 $server_status = $SV1->Spawn ();
63 if ($server_status != 0) {
64 print STDERR
"ERROR: server returned $server_status\n";
68 $server_status = $SV2->Spawn ();
70 if ($server_status != 0) {
71 print STDERR
"ERROR: server returned $server_status\n";
76 $SV1->Kill (); $SV1->TimedWait (1);
77 $SV2->Kill (); $SV2->TimedWait (1);
80 if ($server1->WaitForFileTimed ($ior1file,
81 $server1->ProcessStartWaitInterval()) == -1) {
82 print STDERR
"ERROR: cannot find file <$server1_ior1file>\n";
87 if ($server2->WaitForFileTimed ($ior2file,
88 $server2->ProcessStartWaitInterval()) == -1) {
89 print STDERR
"ERROR: cannot find file <$server2_ior2file>\n";
94 if ($server1->GetFile ($ior1file) == -1) {
95 print STDERR
"ERROR: cannot retrieve file <$server1_ior1file>\n";
99 if ($client->PutFile ($ior1file) == -1) {
100 print STDERR
"ERROR: cannot set file <$client_ior1file>\n";
105 if ($server2->GetFile ($ior2file) == -1) {
106 print STDERR
"ERROR: cannot retrieve file <$server2_ior2file>\n";
110 if ($client->PutFile ($ior2file) == -1) {
111 print STDERR
"ERROR: cannot set file <$client_ior2file>\n";
116 $client_status = $CL->SpawnWaitKill ($client->ProcessStartWaitInterval() + 45);
118 if ($client_status != 0) {
119 print STDERR
"ERROR: client returned $client_status\n";
123 $server_status = $SV1->TerminateWaitKill ($server1->ProcessStopWaitInterval());
125 if ($server_status != 0) {
126 print STDERR
"ERROR: server returned $server_status\n";
130 $server_status = $SV2->TerminateWaitKill ($server2->ProcessStopWaitInterval());
132 if ($server_status != 0) {
133 print STDERR
"ERROR: server returned $server_status\n";
138 $server1->DeleteFile($ior1file);
139 $server2->DeleteFile($ior2file);
140 $client->DeleteFile($ior1file);
141 $client->DeleteFile($ior2file);