diff options
Diffstat (limited to 'TAO/performance-tests/Cubit/TAO/DII_Cubit/run_test.pl')
-rwxr-xr-x | TAO/performance-tests/Cubit/TAO/DII_Cubit/run_test.pl | 136 |
1 files changed, 85 insertions, 51 deletions
diff --git a/TAO/performance-tests/Cubit/TAO/DII_Cubit/run_test.pl b/TAO/performance-tests/Cubit/TAO/DII_Cubit/run_test.pl index 5373e0b021b..9265b516fbd 100755 --- a/TAO/performance-tests/Cubit/TAO/DII_Cubit/run_test.pl +++ b/TAO/performance-tests/Cubit/TAO/DII_Cubit/run_test.pl @@ -5,80 +5,114 @@ eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' # $Id$ # -*- perl -*- +# The first three lines above let this script run without specifying the +# full path to perl, as long as it is in the user's PATH. +# Taken from perlrun man page. + +# Do not use environment variables here since not all platforms use ACE_ROOT use lib "../../../../../bin"; -use PerlACE::Run_Test; -$status = 0; -$iorfile = PerlACE::LocalFile ("cubit.ior"); -$svnsflags = " -f $iorfile "; -$clnsflags = " -f $iorfile "; +require ACEutils; + +$iorfile = "cubit.ior"; +$clexepref = '.' . $DIR_SEPARATOR; +$svexepref = ".." . $DIR_SEPARATOR . "IDL_Cubit" . $DIR_SEPARATOR; +$svnsflags = " -f $iorfile"; +$clnsflags = " -f $iorfile"; $clflags = ""; $svflags = ""; -############################################################################### +# Make sure the file is gone, so we can wait on it. +unlink $iorfile; + + # Parse the arguments -for (my $i = 0; $i <= $#ARGV; $i++) { - if ($ARGV[$i] eq "-h" || $ARGV[$i] eq "-?") { - print "run_test [-h] [-n num] [-debug] [-orblite]\n"; - print "\n"; - print "-h -- prints this information\n"; - print "-n num -- client uses <num> iterations\n"; - print "-debug -- sets the debug flag for both client and server\n"; - print "-orblite -- Use the lite version of the orb"; - exit; +for ($i = 0; $i <= $#ARGV; $i++) +{ + SWITCH: + { + if ($ARGV[$i] eq "-h" || $ARGV[$i] eq "-?") + { + print "run_test [-h] [-n num] [-sleeptime t] [-debug] [-release] [-orblite]\n"; + print "\n"; + print "-h -- prints this information\n"; + print "-n num -- client uses <num> iterations\n"; + print "-sleeptime t -- run_test should sleep for <t> seconds between running\n"; + print " the server and client (default is 5 seconds)\n"; + print "-debug -- sets the debug flag for both client and server\n"; + print "-release -- runs the Release version of the test (for NT use)\n"; + print "-orblite -- Use the lite version of the orb"; + exit; + } + if ($ARGV[$i] eq "-debug") + { + $clflags .= " -d"; + $svflags .= " -d"; + last SWITCH; } - elsif ($ARGV[$i] eq "-debug") { - $clflags .= " -d "; - $svflags .= " -d "; + if ($ARGV[$i] eq "-release") + { + $exepref = "Release".$DIR_SEPARATOR; + last SWITCH; } - elsif ($ARGV[$i] eq "-n") { - $clflags .= " -n $ARGV[$i + 1] "; - $i++; + if ($ARGV[$i] eq "-n") + { + $clflags .= " -n $ARGV[$i + 1]"; + $i++; + last SWITCH; } - elsif ($ARGV[$i] eq "-orblite") { - $clflags .= " -ORBgioplite "; - $svflags .= " -ORBgioplite "; + if ($ARGV[$i] eq "-sleeptime") + { + $ACE::sleeptime = $ARGV[$i + 1]; + $i++; + last SWITCH; } - else { - print STDERR "ERROR: Unknown Option: ".$ARGV[$i]."\n"; + if ($ARGV[$i] eq "-orblite") + { + $clflags .= " -ORBgioplite"; + $svflags .= " -ORBgioplite"; + last SWITCH; } + print "run_test: Unknown Option: ".$ARGV[$i]."\n"; + } } -############################################################################### +(-f $svexepref."server".$EXE_EXT && + -f $clexepref."client".$EXE_EXT) || + die "$0: server and/or client need to be built!\n"; -my $SV = new PerlACE::Process ("../IDL_Cubit/server", $svflags . $svnsflags); -my $CL = new PerlACE::Process ("client", "$clflags $clnsflags -x"); +$SV = Process::Create ($svexepref."server".$EXE_EXT, + $svflags. + $svnsflags); -if (! (-x $SV->Executable () && -x $CL->Executable)) { - print STDERR "ERROR: server and/or client missing or not executable!\n"; - exit 1; -} - -# Make sure the file is gone, so we can wait on it. -unlink $iorfile; +# Put in a wait between the server and client -$SV->Spawn (); - -if (PerlACE::waitforfile_timed ($iorfile, 10) == -1) { - print STDERR "ERROR: cannot find file <$iorfile>\n"; - $SV->Kill (); - exit 1; +if (ACE::waitforfile_timed ($iorfile, 10) == -1) { + print STDERR "ERROR: cannot find file <$iorfile>\n"; + $SV->Kill (); $SV->TimedWait (1); + exit 1; } -$client = $CL->SpawnWaitKill (60); -$server = $SV->WaitKill (10); +$CL = Process::Create ($clexepref . "client".$EXE_EXT, + " $clflags $clnsflags -x"); -if ($client != 0) { - print STDERR "ERROR: client returned $client\n"; - $status = 1; +$client = $CL->TimedWait (60); +if ($client == -1) { + print STDERR "ERROR: client timedout\n"; + $CL->Kill (); $CL->TimedWait (1); } -if ($server != 0) { - print STDERR "ERROR: server returned $server\n"; - $status = 1; +$server = $SV->TimedWait (10); +if ($server == -1) { + print STDERR "ERROR: server timedout\n"; + $SV->Kill (); $SV->TimedWait (1); } unlink $iorfile; -exit $status; +if ($server != 0 || $client != 0) { + exit 1; +} + +exit 0; |