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
;
21 for ($iter = 0; $iter <= $#ARGV; $iter++) {
22 if ($ARGV[$iter] eq "-h" || $ARGV[$iter] eq "-?") {
23 print "Run_Test Perl script for Single-threaded Latency test\n\n";
24 print "run_test [-n num] [-h] \n";
26 print "-n num -- runs the client num times\n";
27 print "-h -- prints this information\n";
30 elsif ($ARGV[$iter] eq "-n") {
31 $iteration = $ARGV[$iter + 1];
36 print STDERR
"================ Single-threaded Latency Test\n";
38 my $server = PerlACE
::TestTarget
::create_target
(1) || die "Create target 1 failed\n";
39 my $client = PerlACE
::TestTarget
::create_target
(2) || die "Create target 2 failed\n";
41 my $iorbase = "test.ior";
42 my $server_iorfile = $server->LocalFile ($iorbase);
43 my $client_iorfile = $client->LocalFile ($iorbase);
44 $server->DeleteFile($iorbase);
45 $client->DeleteFile($iorbase);
47 $SV = $server->CreateProcess ("server", "-ORBdebuglevel $debug_level -o $server_iorfile");
48 $CL = $client->CreateProcess ("client", "-k file://$client_iorfile -i $iteration");
50 $server_status = $SV->Spawn ();
52 if ($server_status != 0) {
53 print STDERR
"ERROR: server returned $server_status\n";
57 if ($server->WaitForFileTimed ($iorbase,
58 $server->ProcessStartWaitInterval()) == -1) {
59 print STDERR
"ERROR: cannot find file <$server_iorfile>\n";
60 $SV->Kill (); $SV->TimedWait (1);
64 if ($server->GetFile ($iorbase) == -1) {
65 print STDERR
"ERROR: cannot retrieve file <$server_iorfile>\n";
66 $SV->Kill (); $SV->TimedWait (1);
70 if ($client->PutFile ($iorbase) == -1) {
71 print STDERR
"ERROR: cannot set file <$client_iorfile>\n";
72 $SV->Kill (); $SV->TimedWait (1);
76 $client_status = $CL->SpawnWaitKill ($client->ProcessStartWaitInterval() + 105);
78 if ($client_status != 0) {
79 print STDERR
"ERROR: client returned $client_status\n";
83 $server_status = $SV->WaitKill ($server->ProcessStopWaitInterval());
85 if ($server_status != 0) {
86 print STDERR
"ERROR: server returned $server_status\n";
90 $server->DeleteFile($iorbase);
91 $client->DeleteFile($iorbase);