Merge pull request #2301 from sonndinh/remove-dup-reactor-functions
[ACE_TAO.git] / TAO / performance-tests / Sequence_Latency / Single_Threaded / default_configuration.pl
blobc91f1d4f71bec5738ec23882ed9d352a7c442449
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 (default) 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 $defaultconf = "default$PerlACE::svcconf_ext";
44 my $server_defaultconf = $server->LocalFile ($defaultconf);
45 my $client_defaultconf = $client->LocalFile ($defaultconf);
46 my $server_iorfile = $server->LocalFile ($iorbase);
47 my $client_iorfile = $client->LocalFile ($iorbase);
48 $server->DeleteFile($iorbase);
49 $client->DeleteFile($iorbase);
51 $SV = $server->CreateProcess ("server", "-ORBdebuglevel $debug_level -o $server_iorfile ".
52 "-ORBSvcConf $server_defaultconf");
53 $CL = $client->CreateProcess ("client", "-k file://$client_iorfile -t $type -i $iterations ".
54 "-ORBSvcConf $client_defaultconf");
56 print STDERR $CL->CommandLine () ;
57 $server_status = $SV->Spawn ();
59 if ($server_status != 0) {
60 print STDERR "ERROR: server returned $server_status\n";
61 exit 1;
64 if ($server->WaitForFileTimed ($iorbase,
65 $server->ProcessStartWaitInterval()) == -1) {
66 print STDERR "ERROR: cannot find file <$server_iorfile>\n";
67 $SV->Kill (); $SV->TimedWait (1);
68 exit 1;
71 if ($server->GetFile ($iorbase) == -1) {
72 print STDERR "ERROR: cannot retrieve file <$server_iorfile>\n";
73 $SV->Kill (); $SV->TimedWait (1);
74 exit 1;
77 if ($client->PutFile ($iorbase) == -1) {
78 print STDERR "ERROR: cannot set file <$client_iorfile>\n";
79 $SV->Kill (); $SV->TimedWait (1);
80 exit 1;
83 $client_status = $CL->SpawnWaitKill ($client->ProcessStartWaitInterval() + 45);
85 if ($client_status != 0) {
86 print STDERR "ERROR: client returned $client_status\n";
87 $status = 1;
90 $server_status = $SV->WaitKill ($server->ProcessStopWaitInterval());
92 if ($server_status != 0) {
93 print STDERR "ERROR: server returned $server_status\n";
94 $status = 1;
97 $server->DeleteFile($iorbase);
98 $client->DeleteFile($iorbase);
100 exit $status;