Merge pull request #1844 from jrw972/monterey
[ACE_TAO.git] / TAO / performance-tests / Sequence_Latency / Single_Threaded / run_test.pl
blob5362e12ac72bcff51a314a45ca13d75742523b05
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 print STDERR "================ Single-threaded Latency Test\n";
21 my $type = 'octet';
23 for ($i = 0; $i <= $#ARGV; $i++) {
24 if ($ARGV[$i] eq "-h" || $ARGV[$i] eq "-?") {
25 print "Run_Test Perl script for Performance Test\n\n";
26 print "run_test [-t type] \n";
27 print "\n";
28 print "-t type -- runs only one type of param test\n";
29 exit 0;
31 elsif ($ARGV[$i] eq "-t") {
32 $type = $ARGV[$i + 1];
33 $i++;
37 my $iterations = 150000;
39 my $server = PerlACE::TestTarget::create_target (1) || die "Create target 1 failed\n";
40 my $client = PerlACE::TestTarget::create_target (2) || die "Create target 2 failed\n";
42 my $iorbase = "test.ior";
43 my $server_iorfile = $server->LocalFile ($iorbase);
44 my $client_iorfile = $client->LocalFile ($iorbase);
45 $server->DeleteFile($iorbase);
46 $client->DeleteFile($iorbase);
48 $SV = $server->CreateProcess ("server", "-ORBdebuglevel $debug_level -o $server_iorfile");
49 $CL = $client->CreateProcess ("client", "-k file://$client_iorfile -t $type -i $iterations");
51 print STDERR $CL->CommandLine () ;
52 $server_status = $SV->Spawn ();
54 if ($server_status != 0) {
55 print STDERR "ERROR: server returned $server_status\n";
56 exit 1;
59 if ($server->WaitForFileTimed ($iorbase,
60 $server->ProcessStartWaitInterval()) == -1) {
61 print STDERR "ERROR: cannot find file <$server_iorfile>\n";
62 $SV->Kill (); $SV->TimedWait (1);
63 exit 1;
66 if ($server->GetFile ($iorbase) == -1) {
67 print STDERR "ERROR: cannot retrieve file <$server_iorfile>\n";
68 $SV->Kill (); $SV->TimedWait (1);
69 exit 1;
72 if ($client->PutFile ($iorbase) == -1) {
73 print STDERR "ERROR: cannot set file <$client_iorfile>\n";
74 $SV->Kill (); $SV->TimedWait (1);
75 exit 1;
78 $client_status = $CL->SpawnWaitKill ($client->ProcessStartWaitInterval() + 405);
80 if ($client_status != 0) {
81 print STDERR "ERROR: client returned $client_status\n";
82 $status = 1;
85 $server_status = $SV->WaitKill ($server->ProcessStopWaitInterval());
87 if ($server_status != 0) {
88 print STDERR "ERROR: server returned $server_status\n";
89 $status = 1;
92 $server->DeleteFile($iorbase);
93 $client->DeleteFile($iorbase);
95 exit $status;