diff options
Diffstat (limited to 'TAO/tests/Param_Test/run_test.pl')
-rwxr-xr-x | TAO/tests/Param_Test/run_test.pl | 132 |
1 files changed, 84 insertions, 48 deletions
diff --git a/TAO/tests/Param_Test/run_test.pl b/TAO/tests/Param_Test/run_test.pl index df5815fec66..a5ff8189fa1 100755 --- a/TAO/tests/Param_Test/run_test.pl +++ b/TAO/tests/Param_Test/run_test.pl @@ -5,20 +5,59 @@ eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' # $Id$ # -*- perl -*- -use lib "../../../bin"; -use PerlACE::Run_Test; -$iorfile = PerlACE::LocalFile ("server.ior"); +use lib "../../../bin"; +require ACEutils; +require Process; +use Cwd; + +$cwd = getcwd(); +$iorfile = "$cwd$DIR_SEPARATOR" . "server.ior"; $invocation = "sii"; $num = 5; $other = ""; $debug = ""; $type = ""; -$status = 0; unlink $iorfile; +sub run_test +{ + my $type = shift(@_); + + unlink $iorfile; # Ignore errors + print STDERR "==== Testing $type === wait....\n"; + + $SV = Process::Create ($EXEPREFIX."server".$EXE_EXT, + "$debug -o $iorfile"); + + if (ACE::waitforfile_timed ($iorfile, 15) == -1) { + print STDERR "ERROR: cannot find file <$iorfile>\n"; + $SV->Kill (); $SV->TimedWait (1); + exit 1; + } + + $CL = Process::Create ($EXEPREFIX."client".$EXE_EXT, + " $debug -f $iorfile -i $invocation " + . "-t $type -n $num -x"); + + $client = $CL->TimedWait (60); + if ($client == -1) { + print STDERR "ERROR: client timedout\n"; + $CL->Kill (); $CL->TimedWait (1); + } + + $server = $SV->TimedWait (10); + if ($server == -1) { + print STDERR "ERROR: server timedout\n"; + $SV->Kill (); $SV->TimedWait (1); + } + unlink $iorfile; + + print STDERR "==== Test for $type finished ===\n"; +} + # Parse the arguments @types = ("short", "ulonglong", "ubstring", "bdstring", @@ -35,76 +74,73 @@ unlink $iorfile; "big_union", "small_union", "recursive_union", "complex_any"); -for ($i = 0; $i <= $#ARGV; $i++) { - if ($ARGV[$i] eq "-h" || $ARGV[$i] eq "-?") { +ACE::checkForTarget($cwd); + +for ($i = 0; $i <= $#ARGV; $i++) +{ + SWITCH: + { + if ($ARGV[$i] eq "-h" || $ARGV[$i] eq "-?") + { print "Run_Test Perl script for TAO Param Test\n\n"; print "run_test [-n num] [-d] [-onewin] [-h] [-t type] [-i (dii|sii)] [-chorus <target>]\n"; print "\n"; print "-n num -- runs the client num times\n"; print "-d -- runs each in debug mode\n"; + print "-onewin -- keeps all tests in one window on NT\n"; print "-h -- prints this information\n"; print "-t type -- runs only one type of param test\n"; print "-i (dii|sii) -- Changes the type of invocation\n"; print "-chorus <target> -- Run tests on chorus target\n"; exit 0; } - elsif ($ARGV[$i] eq "-n") { + if ($ARGV[$i] eq "-n") + { $num = $ARGV[$i + 1]; $i++; + last SWITCH; } - elsif ($ARGV[$i] eq "-d") { + if ($ARGV[$i] eq "-d") + { $debug = $debug." -d"; + last SWITCH; } - elsif ($ARGV[$i] eq "-t") { + if ($ARGV[$i] eq "-onewin") + { + if ($^O eq "MSWin32") + { + $newwindow = "no"; + } + last SWITCH; + } + if ($ARGV[$i] eq "-twowin") + { + if ($^O eq "MSWin32") + { + $newwindow = "yes"; + } + last SWITCH; + } + if ($ARGV[$i] eq "-t") + { @types = split (',', $ARGV[$i + 1]); $i++; + last SWITCH; } - elsif ($ARGV[$i] eq "-i") { + if ($ARGV[$i] eq "-i") + { $invocation = $ARGV[$i + 1]; $i++; + last SWITCH; } - else { - $other .= $ARGV[$i]; - } + $other .= $ARGV[$i]; + } } -$SV = new PerlACE::Process ("server", "$debug -o $iorfile"); -$CL = new PerlACE::Process ("client"); - foreach $type (@types) { - unlink $iorfile; # Ignore errors - - print STDERR "==== Testing $type === wait....\n"; - - $SV->Spawn (); - - if (PerlACE::waitforfile_timed ($iorfile, 15) == -1) { - print STDERR "ERROR: cannot find file <$iorfile>\n"; - $SV->Kill (); - exit 1; - } - - $CL->Arguments ("$debug -f $iorfile -i $invocation -t $type -n $num -x"); - - $client = $CL->SpawnWaitKill (60); - - if ($client != 0) { - print STDERR "ERROR: client returned $client\n"; - $status = 1; - } - - $server = $SV->WaitKill (10); - - if ($server != 0) { - print STDERR "ERROR: server returned $server\n"; - $status = 1; - } - - unlink $iorfile; - - print STDERR "==== Test for $type finished ===\n"; + run_test ($type); } unlink $iorfile; -exit $status; +exit 0; |