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 $iterations = 250000;
21 for ($iter = 0; $iter <= $#ARGV; $iter++) {
22 if ($ARGV[$iter] eq "-h" || $ARGV[$iter] eq "-?") {
23 print "Run_Test Perl script for Thread-per-Connection 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 $iterations = $ARGV[$iter + 1];
37 my $server = PerlACE
::TestTarget
::create_target
(1) || die "Create target 1 failed\n";
38 my $client = PerlACE
::TestTarget
::create_target
(2) || die "Create target 2 failed\n";
40 my $iorbase = "test.ior";
41 my $server_iorfile = $server->LocalFile ($iorbase);
42 my $client_iorfile = $client->LocalFile ($iorbase);
43 $server->DeleteFile($iorbase);
44 $client->DeleteFile($iorbase);
46 $SV = $server->CreateProcess ("server", "-ORBdebuglevel $debug_level -o $server_iorfile");
47 $CL = $client->CreateProcess ("client", "-k file://$client_iorfile -i $iterations");
49 print STDERR
"================ Thread-per-Connection Latency Test\n";
51 $server_status = $SV->Spawn ();
53 if ($server_status != 0) {
54 print STDERR
"ERROR: server returned $server_status\n";
58 if ($server->WaitForFileTimed ($iorbase,
59 $server->ProcessStartWaitInterval()) == -1) {
60 print STDERR
"ERROR: cannot find file <$server_iorfile>\n";
61 $SV->Kill (); $SV->TimedWait (1);
65 if ($server->GetFile ($iorbase) == -1) {
66 print STDERR
"ERROR: cannot retrieve file <$server_iorfile>\n";
67 $SV->Kill (); $SV->TimedWait (1);
71 if ($client->PutFile ($iorbase) == -1) {
72 print STDERR
"ERROR: cannot set file <$client_iorfile>\n";
73 $SV->Kill (); $SV->TimedWait (1);
77 $client_status = $CL->SpawnWaitKill ($client->ProcessStartWaitInterval() + 105);
79 if ($client_status != 0) {
80 print STDERR
"ERROR: client returned $client_status\n";
84 $server_status = $SV->WaitKill ($server->ProcessStopWaitInterval());
86 if ($server_status != 0) {
87 print STDERR
"ERROR: server returned $server_status\n";
91 $server->DeleteFile($iorbase);
92 $client->DeleteFile($iorbase);