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 $balancer = PerlACE
::TestTarget
::create_target
(1) || die "Create target 1 failed\n";
20 my $server = 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 $iorbase = "server.ior";
24 my $balancer_iorfile = $balancer->LocalFile ($iorbase);
25 my $server_iorfile = $server->LocalFile ($iorbase);
26 my $client_iorfile = $client->LocalFile ($iorbase);
27 $balancer->DeleteFile($iorbase);
28 $server->DeleteFile($iorbase);
29 $client->DeleteFile($iorbase);
31 $LB = $balancer->CreateProcess ("load_balancer", "-ORBdebuglevel $debug_level -o $balancer_iorfile");
32 $SV = $server->CreateProcess ("server", "-i file://$server_iorfile");
33 $CL = $client->CreateProcess ("client", "-i file://$client_iorfile -n 10");
35 print STDERR
"\n Starting Load Balancing Server and Identity Server \n\n";
37 # Run the load balancing server.
38 $balancer_status = $LB->Spawn ();
40 if ($balancer_status != 0) {
41 print STDERR
"ERROR: balancer returned $balancer_status\n";
45 if ($balancer->WaitForFileTimed ($iorbase,
46 $balancer->ProcessStartWaitInterval()) == -1) {
47 print STDERR
"ERROR: cannot find file <$balancer_iorfile>\n";
48 $LB->Kill (); $LB->TimedWait (1);
52 if ($balancer->GetFile ($iorbase) == -1) {
53 print STDERR
"ERROR: cannot retrieve file <$balancer_iorfile>\n";
54 $LB->Kill (); $LB->TimedWait (1);
57 if ($server->PutFile ($iorbase) == -1) {
58 print STDERR
"ERROR: cannot set file <$server_iorfile>\n";
59 $LB->Kill (); $LB->TimedWait (1);
62 if ($client->PutFile ($iorbase) == -1) {
63 print STDERR
"ERROR: cannot set file <$client_iorfile>\n";
64 $LB->Kill (); $LB->TimedWait (1);
68 # Run the identity server, which registers its objects with the load
70 $server_status = $SV->Spawn ();
72 if ($server_status != 0) {
73 print STDERR
"ERROR: server returned $server_status\n";
74 $LB->Kill (); $LB->TimedWait (1);
78 sleep ($server->ProcessStartWaitInterval());
80 # Run tests, i.e., run client with different command line options.
82 print STDERR
"\n Client using Round Robin Object Group (10 iterations): \n\n";
83 $client_status = $CL->SpawnWaitKill ($client->ProcessStartWaitInterval() + 45);
85 if ($client_status != 0) {
86 print STDERR
"ERROR: client returned $client_status\n";
87 $LB->Kill (); $LB->TimedWait (1);
88 $SV->Kill (); $SV->TimedWait (1);
92 print STDERR
"\n Client using Random Object Group (10 iterations): \n\n";
93 $CL->Arguments ("-r " . $CL->Arguments ());
94 $client_status = $CL->SpawnWaitKill ($client->ProcessStartWaitInterval() + 45);
96 if ($client_status != 0) {
97 print STDERR
"ERROR: client returned $client_status\n";
98 $LB->Kill (); $LB->TimedWait (1);
99 $SV->Kill (); $SV->TimedWait (1);
103 $balancer_status = $LB->TerminateWaitKill ($balancer->ProcessStopWaitInterval());
105 if ($balancer_status != 0) {
106 print STDERR
"ERROR: server returned $balancer_status\n";
110 $server_status = $SV->TerminateWaitKill ($server->ProcessStopWaitInterval());
112 if ($server_status != 0) {
113 print STDERR
"ERROR: server returned $server_status\n";
117 $balancer->DeleteFile($iorbase);
118 $server->DeleteFile($iorbase);
119 $client->DeleteFile($iorbase);