=default for generated implementation copy ctor
[ACE_TAO.git] / TAO / performance-tests / Latency / Single_Threaded / run_test.pl
blob8508ff35e13b6c72dc928262e35dc08165de9b6f
1 eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}'
2 & eval 'exec perl -S $0 $argv:q'
3 if 0;
5 # -*- perl -*-
7 use lib "$ENV{ACE_ROOT}/bin";
8 use PerlACE::TestTarget;
10 $status = 0;
11 $debug_level = '0';
13 foreach $i (@ARGV) {
14 if ($i eq '-debug') {
15 $debug_level = '10';
19 $iteration = 250000;
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";
25 print "\n";
26 print "-n num -- runs the client num times\n";
27 print "-h -- prints this information\n";
28 exit 0;
30 elsif ($ARGV[$iter] eq "-n") {
31 $iteration = $ARGV[$iter + 1];
32 $i++;
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";
54 exit 1;
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);
61 exit 1;
64 if ($server->GetFile ($iorbase) == -1) {
65 print STDERR "ERROR: cannot retrieve file <$server_iorfile>\n";
66 $SV->Kill (); $SV->TimedWait (1);
67 exit 1;
70 if ($client->PutFile ($iorbase) == -1) {
71 print STDERR "ERROR: cannot set file <$client_iorfile>\n";
72 $SV->Kill (); $SV->TimedWait (1);
73 exit 1;
76 $client_status = $CL->SpawnWaitKill ($client->ProcessStartWaitInterval() + 105);
78 if ($client_status != 0) {
79 print STDERR "ERROR: client returned $client_status\n";
80 $status = 1;
83 $server_status = $SV->WaitKill ($server->ProcessStopWaitInterval());
85 if ($server_status != 0) {
86 print STDERR "ERROR: server returned $server_status\n";
87 $status = 1;
90 $server->DeleteFile($iorbase);
91 $client->DeleteFile($iorbase);
93 exit $status;