diff options
Diffstat (limited to 'TAO/orbsvcs/tests/ImplRepo/run_test.pl')
-rwxr-xr-x | TAO/orbsvcs/tests/ImplRepo/run_test.pl | 507 |
1 files changed, 135 insertions, 372 deletions
diff --git a/TAO/orbsvcs/tests/ImplRepo/run_test.pl b/TAO/orbsvcs/tests/ImplRepo/run_test.pl index fa884460a26..a10af6303a1 100755 --- a/TAO/orbsvcs/tests/ImplRepo/run_test.pl +++ b/TAO/orbsvcs/tests/ImplRepo/run_test.pl @@ -6,23 +6,29 @@ eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' # -*- perl -*- ############################################################################### -use lib "../../../../bin"; -use PerlACE::Run_Test; use Cwd; use Sys::Hostname; use File::Copy; -$cwd = getcwd(); +BEGIN { + ### We need to BEGIN this block so we make sure ACE_ROOT is set before + ### we use it in the use lib line + $cwd = getcwd(); -$ACE_ROOT = $ENV{ACE_ROOT}; + $ACE_ROOT = $ENV{ACE_ROOT}; -if (!defined $ACE_ROOT) { - chdir ('../../../../'); - $ACE_ROOT = getcwd (); - chdir ($cwd); - print "ACE_ROOT not defined, defaulting to ACE_ROOT=$ACE_ROOT\n"; + if (!$ACE_ROOT) { + chdir ('../../../../'); + $ACE_ROOT = getcwd (); + chdir ($cwd); + print "ACE_ROOT not defined, defaulting to ACE_ROOT=$ACE_ROOT\n"; + } } +use lib "$ACE_ROOT/bin"; + +use PerlACE::Run_Test; + $airplane_ior = PerlACE::LocalFile ("airplane.ior"); $nestea_ior = PerlACE::LocalFile ("nestea.ior"); $implrepo_ior = PerlACE::LocalFile ("implrepo.ior"); @@ -30,12 +36,11 @@ $implrepo_ior = PerlACE::LocalFile ("implrepo.ior"); $refstyle = " -ORBobjrefstyle URL"; $backing_store = "imr_backing_store"; -$nestea_dat = "nestea.dat"; $protocol = "iiop"; $host = hostname(); $port = 12345; -$endpoint = "-ORBEndpoint " . "$protocol" . "://" . "$host" . ":" . $port; +$endpoint = "-ORBEndpoint" . "$protocol" . "://" . "$host" . ":" . $port; $IMR = new PerlACE::Process ("../../ImplRepo_Service/ImplRepo_Service"); @@ -60,155 +65,81 @@ unlink $airplane_ior; unlink $nestea_ior; unlink $implrepo_ior; +sub convert_slash($) +{ + $cmd = shift; + + $cmd =~ s/\//\\/g; + + return $cmd; +} + # The Tests ############################################################################### sub airplane_test { - my $status = 0; - $A_SVR->Arguments ("-o $airplane_ior $refstyle"); $A_SVR->Spawn (); - if (PerlACE::waitforfile_timed ($airplane_ior, 10) == -1) { - print STDERR "ERROR: cannot find $airplane_ior\n"; - $A_SVR->Kill (); - return 1; - } + PerlACE::waitforfile ($airplane_ior); - my $client = $A_CLI->SpawnWaitKill (300); - - if ($client != 0) { - print STDERR "ERROR: client returned $client\n"; - $status = 1; - } + $A_CLI->SpawnWaitKill (300); - my $server = $A_SVR->TerminateWaitKill (5); - - if ($server != 0) { - print STDERR "ERROR: server returned $server\n"; - $status = 1; - } - - return $status; + $A_SVR->Kill (); $A_SVR->Wait (); } ############################################################################### sub nestea_test { - my $status = 0; - unlink $nestea_dat; - $N_SVR->Arguments ("-o $nestea_ior $refstyle"); $N_SVR->Spawn (); - if (PerlACE::waitforfile_timed ($nestea_ior, 10) == -1) { - print STDERR "ERROR: cannot find $nestea_ior\n"; - $N_SVR->Kill (); - return 1; - } - - my $client = $N_CLI->SpawnWaitKill (300); + PerlACE::waitforfile ($nestea_ior); - if ($client != 0) { - print STDERR "ERROR: client returned $client\n"; - $status = 1; - } - - $server = $N_SVR->TerminateWaitKill (5); - - if ($server != 0) { - print STDERR "ERROR: server returned $server\n"; - $status = 1; - } - - unlink $nestea_dat; - return $status; + $N_CLI->SpawnWaitKill (300); + + $N_SVR->Kill (); $N_SVR->Wait (); } ############################################################################### -# @todo: This test doesn't clean up too well if something fails sub nt_service_test { - my $result = 0; - - my $BIN_IMR = new PerlACE::Process ("$ACE_ROOT/bin/ImplRepo_Service", + my $BIN_IMR = new PerlACE::Process (convert_slash ("$ACE_ROOT/bin/ImplRepo_Service"), "-c install"); print "Copying ImplRepo_Service to bin\n"; copy ($IMR->Executable (), $BIN_IMR->Executable ()); print "Installing TAO Implementation Repository Service\n"; - $result = $BIN_IMR->SpawnWaitKill (300); - - if ($result != 0) { - print STDERR "ERROR: IMR installation returned $result\n"; - return 1; - } + $BIN_IMR->SpawnWaitKill (300); print "Starting TAO Implementation Repository Service\n"; - my $NET = new PerlACE::Process ("net", + my $NET = new PerlACE::Process ($ENV{'SystemRoot'}."/System32/net", "start \"TAO Implementation Repository\""); - $NET->IgnoreExeSubDir (1); - - $result = $NET->SpawnWaitKill (300); - if ($result != 0) { - print STDERR "ERROR: net returned $result\n"; - return 1; - } + $NET->SpawnWaitKill (300); $TAO_IMR->Arguments ("add airplane_server -c \"" . $A_SVR->Executable () . " -ORBUseIMR 1\" -w \"$ACE_ROOT/bin\""); - - $result = $TAO_IMR->SpawnWaitKill (30); - - if ($result != 0) { - print STDERR "ERROR: tao_imr returned $result\n"; - return 1; - } + $TAO_IMR->SpawnWaitKill (100); $A_SVR->Arguments ("-o $airplane_ior -ORBUseIMR 1"); $A_SVR->Spawn (); - if (PerlACE::waitforfile_timed ($airplane_ior, 10) == -1) { - print STDERR "ERROR: cannot find $airplane_ior\n"; - $A_SVR->Kill (); - return 1; - } + PerlACE::waitforfile ($airplane_ior); - $result = $A_CLI->SpawnWaitKill (100); - - if ($result != 0) { - print STDERR "ERROR: airplane client returned $result\n"; - return 1; - } + $A_CLI->SpawnWaitKill (100); $TAO_IMR->Arguments ("shutdown airplane_server"); + $TAO_IMR->SpawnWaitKill (100); - $result = $TAO_IMR->SpawnWaitKill (30); - - if ($result != 0) { - print STDERR "ERROR: tao_imr returned $result\n"; - return 1; - } - - $result = $A_CLI->SpawnWaitKill (100); - - if ($result != 0) { - print STDERR "ERROR: airplane client returned $result\n"; - return 1; - } + $A_CLI->SpawnWaitKill (100); - $result = $TAO_IMR->SpawnWaitKill (30); - - if ($result != 0) { - print STDERR "ERROR: tao_imr returned $result\n"; - return 1; - } + $TAO_IMR->SpawnWaitKill (100); print "Stopping TAO Implementation Repository Service\n"; $NET->Arguments ("stop \"TAO Implementation Repository\""); @@ -219,260 +150,94 @@ sub nt_service_test $BIN_IMR->SpawnWaitKill (300); print "Removing ImplRepo_Service from bin\n"; - unlink $BIN_IMR->Executable (); - - return 0; + unlink ($bin_implrepo_server); } ############################################################################### sub airplane_ir_test { - my $status = 0; - my $result = 0; - $IMR->Arguments ("-o $implrepo_ior"); $IMR->Spawn (); - if (PerlACE::waitforfile_timed ($implrepo_ior, 10) == -1) { - print STDERR "ERROR: cannot find $implrepo_ior\n"; - $IMR->Kill (); - return 1; - } + PerlACE::waitforfile ($implrepo_ior); $TAO_IMR->Arguments ("add airplane_server -c \"" . $A_SVR->Executable () . " -ORBUseIMR 1 -o $airplane_ior\""); - - $result = $TAO_IMR->SpawnWaitKill (30); - - if ($result != 0) { - print STDERR "ERROR: tao_imr returned $result\n"; - $IMR->Kill (); - return 1; - } - + $TAO_IMR->SpawnWaitKill (300); $A_SVR->Arguments ("-ORBUseIMR 1 -o $airplane_ior"); $A_SVR->Spawn (); - if (PerlACE::waitforfile_timed ($airplane_ior, 10) == -1) { - print STDERR "ERROR: cannot find $airplane_ior\n"; - $IMR->Kill (); - $A_SVR->Kill (); - return 1; - } + PerlACE::waitforfile ($airplane_ior); $TAO_IMR->Arguments ("shutdown airplane_server"); - $result = $A_CLI->SpawnWaitKill (100); - - if ($result != 0) { - print STDERR "ERROR: airplane_client 1 returned $result\n"; - $status = 1; - } - - $result = $TAO_IMR->SpawnWaitKill (30); - - if ($result != 0) { - print STDERR "ERROR: tao_imr 1 returned $result\n"; - $status = 1; - } - - $result = $A_CLI->SpawnWaitKill (100); - - if ($result != 0) { - print STDERR "ERROR: airplane_client 2 returned $result\n"; - $status = 1; - } - - $result = $TAO_IMR->SpawnWaitKill (30); - - if ($result != 0) { - print STDERR "ERROR: tao_imr 2 returned $result\n"; - $status = 1; - } - - my $server = $A_SVR->WaitKill (5); - - if ($server != 0) { - print STDERR "ERROR: airplane server returned $server\n"; - $status = 1; - } + $A_CLI->SpawnWaitKill (100); + $TAO_IMR->SpawnWaitKill (100); + $A_CLI->SpawnWaitKill (100); + $TAO_IMR->SpawnWaitKill (100); - my $implrepo = $IMR->TerminateWaitKill (5); - - if ($implrepo != 0) { - print STDERR "ERROR: IMR returned $implrepo\n"; - $status = 1; - } - - return $status; + $IMR->Kill (); $IMR->Wait (); } ############################################################################### sub nestea_ir_test { - unlink $nestea_dat; - my $status = 0; - my $result = 0; - - $IMR->Arguments ("-o $implrepo_ior"); + $IMR->Arguments ("-o $implrepo_ior -d 0 $refstyle"); $IMR->Spawn (); - if (PerlACE::waitforfile_timed ($implrepo_ior, 10) == -1) { - print STDERR "ERROR: cannot find $implrepo_ior\n"; - $IMR->Kill (); - return 1; - } + PerlACE::waitforfile ($implrepo_ior); $TAO_IMR->Arguments ("add nestea_server -c \"" . $N_SVR->Executable () . " -ORBUseIMR 1 -o $nestea_ior\""); - - $result = $TAO_IMR->SpawnWaitKill (30); - - if ($result != 0) { - print STDERR "ERROR: tao_imr returned $result\n"; - $IMR->Kill (); - return 1; - } - + $TAO_IMR->SpawnWaitKill (300); $N_SVR->Arguments ("-ORBUseIMR 1 -o $nestea_ior"); $N_SVR->Spawn (); - if (PerlACE::waitforfile_timed ($nestea_ior, 10) == -1) { - print STDERR "ERROR: cannot find $nestea_ior\n"; - $IMR->Kill (); - $N_SVR->Kill (); - return 1; - } + PerlACE::waitforfile ($nestea_ior); $TAO_IMR->Arguments ("shutdown nestea_server"); - $result = $N_CLI->SpawnWaitKill (100); - - if ($result != 0) { - print STDERR "ERROR: nestea client 1 returned $result\n"; - $status = 1; - } - - $result = $TAO_IMR->SpawnWaitKill (30); - - if ($result != 0) { - print STDERR "ERROR: tao_imr 1 returned $result\n"; - $status = 1; - } - - $result = $N_CLI->SpawnWaitKill (100); - - if ($result != 0) { - print STDERR "ERROR: nestea client 2 returned $result\n"; - $status = 1; - } - - $result = $TAO_IMR->SpawnWaitKill (30); + $N_CLI->SpawnWaitKill (100); + $TAO_IMR->SpawnWaitKill (100); + $N_CLI->SpawnWaitKill (100); + $TAO_IMR->SpawnWaitKill (100); - if ($result != 0) { - print STDERR "ERROR: tao_imr 2 returned $result\n"; - $status = 1; - } - - my $server = $N_SVR->WaitKill (5); - - if ($server != 0) { - print STDERR "ERROR: nestea server returned $server\n"; - $status = 1; - } - - my $implrepo = $IMR->TerminateWaitKill (5); - - if ($implrepo != 0) { - print STDERR "ERROR: IMR returned $implrepo\n"; - $status = 1; - } - - unlink $nestea_dat; - return $status; + $IMR->Kill (); $IMR->Wait (); } ############################################################################### sub persistent_ir_test { - my $status = 0; - my $result = 0; unlink $backing_store; $IMR->Arguments ("$endpoint -o $implrepo_ior -p $backing_store -d 0"); $IMR->Spawn (); - if (PerlACE::waitforfile_timed ($implrepo_ior, 10) == -1) { - print STDERR "ERROR: cannot find $implrepo_ior\n"; - $IMR->Kill (); - return 1; - } + PerlACE::waitforfile ($implrepo_ior); $TAO_IMR->Arguments ("-ORBInitRef ImplRepoService=file://$implrepo_ior add airplane_server -c \"".$A_SVR->Executable ()." -ORBUseIMR 1 $refstyle -ORBInitRef ImplRepoService=file://$implrepo_ior\""); - $result = $TAO_IMR->SpawnWaitKill (30); - - if ($result != 0) { - print STDERR "ERROR: tao_imr returned $result\n"; - $IMR->Kill (); - return 1; - } + $TAO_IMR->SpawnWaitKill (100); $A_SVR->Arguments ("-o $airplane_ior -ORBUseIMR 1 $refstyle -ORBInitRef ImplRepoService=file://$implrepo_ior"); $A_SVR->Spawn (); - if (PerlACE::waitforfile_timed ($airplane_ior, 10) == -1) { - print STDERR "ERROR: cannot find $airplane_ior\n"; - $IMR->Kill (); - $A_SVR->Kill (); - return 1; - } - + PerlACE::waitforfile ($airplane_ior); $TAO_IMR->Arguments ("-ORBInitRef ImplRepoService=file://$implrepo_ior shutdown airplane_server"); - - $result = $A_CLI->SpawnWaitKill (100); - - if ($result != 0) { - print STDERR "ERROR: airplane client returned $result\n"; - $status = 1; - } - - $result = $TAO_IMR->SpawnWaitKill (30); - - if ($result != 0) { - print STDERR "ERROR: tao_imr returned $result\n"; - $status = 1; - } - - $result = $A_CLI->SpawnWaitKill (100); - if ($result != 0) { - print STDERR "ERROR: airplane client returned $result\n"; - $status = 1; - } - - $result = $TAO_IMR->SpawnWaitKill (30); - - if ($result != 0) { - print STDERR "ERROR: tao_imr returned $result\n"; - $status = 1; - } - - $result = $A_SVR->WaitKill (10); - - if ($result != 0) { - print STDERR "ERROR: airplane server returned $result\n"; - $status = 1; - } + $A_CLI->SpawnWaitKill (100); + $TAO_IMR->SpawnWaitKill (100); + $A_CLI->SpawnWaitKill (100); + $TAO_IMR->SpawnWaitKill (100); print "\nShutting down Implementation Repository\n\n"; - $IMR->Kill (); + $IMR->Kill (); $IMR->Wait (); print "Restarting Implementation Repository.\n"; $IMR->Arguments ("$endpoint -p $backing_store -d 0"); @@ -481,9 +246,9 @@ sub persistent_ir_test PerlACE::waitforfile ($implrepo_ior); $A_CLI->SpawnWaitKill (100); - $TAO_IMR->SpawnWaitKill (30); + $TAO_IMR->SpawnWaitKill (100); - $IMR->Kill (); + $IMR->Kill (); $IMR->Wait (); unlink $backing_store; } @@ -492,20 +257,15 @@ sub persistent_ir_test sub both_ir_test { - my $status = 0; $IMR->Arguments ("-o $implrepo_ior -d 0 $refstyle"); $IMR->Spawn (); - if (PerlACE::waitforfile_timed ($implrepo_ior, 10) == -1) { - print STDERR "ERROR: cannot find $implrepo_ior\n"; - $IMR->Kill (); - return 1; - } + PerlACE::waitforfile ($implrepo_ior); $TAO_IMR->Arguments ("-ORBInitRef ImplRepoService=file://$implrepo_ior add airplane_server -c \"" . $A_SVR->Executable () . " -ORBUseIMR 1 $refstyle -ORBInitRef ImplRepoService=file://$implrepo_ior\""); - $TAO_IMR->SpawnWaitKill (30); + $TAO_IMR->SpawnWaitKill (100); $TAO_IMR->Arguments ("-ORBInitRef ImplRepoService=file://$implrepo_ior" . " add nestea_server" @@ -513,7 +273,7 @@ sub both_ir_test . " -ORBUseIMR 1" . " $refstyle -ORBInitRef" . " ImplRepoService=file://$implrepo_ior\""); - $TAO_IMR->SpawnWaitKill (30); + $TAO_IMR->SpawnWaitKill (100); $N_SVR->Arguments ("-o $nestea_ior -ORBUseIMR 1 $refstyle -ORBInitRef ImplRepoService=file://$implrepo_ior"); $N_SVR->Spawn (); @@ -521,21 +281,8 @@ sub both_ir_test $A_SVR->Arguments ("-o $airplane_ior -ORBUseIMR 1 $refstyle -ORBInitRef ImplRepoService=file://$implrepo_ior"); $A_SVR->Spawn (); - if (PerlACE::waitforfile_timed ($airplane_ior, 10) == -1) { - print STDERR "ERROR: cannot find $airplane_ior\n"; - $IMR->Kill (); - $A_SVR->Kill (); - $N_SVR->Kill (); - return 1; - } - - if (PerlACE::waitforfile_timed ($nestea_ior, 10) == -1) { - print STDERR "ERROR: cannot find $nestea_ior\n"; - $IMR->Kill (); - $A_SVR->Kill (); - $N_SVR->Kill (); - return 1; - } + PerlACE::waitforfile ($nestea_ior); + PerlACE::waitforfile ($airplane_ior); $N_CLI->Spawn (); $A_CLI->Spawn (); @@ -544,24 +291,24 @@ sub both_ir_test $A_CLI->WaitKill (100); $TAO_IMR->Arguments ("-ORBInitRef ImplRepoService=file://$implrepo_ior shutdown nestea_server"); - $TAO_IMR->SpawnWaitKill (30); + $TAO_IMR->SpawnWaitKill (100); $N_CLI->Spawn (100); $TAO_IMR->Arguments ("-ORBInitRef ImplRepoService=file://$implrepo_ior shutdown airplane_server"); - $TAO_IMR->SpawnWaitKill (30); + $TAO_IMR->SpawnWaitKill (100); $A_CLI->SpawnWaitKill (100); $N_CLI->WaitKill (100); $TAO_IMR->Arguments ("-ORBInitRef ImplRepoService=file://$implrepo_ior shutdown nestea_server"); - $TAO_IMR->SpawnWaitKill (30); + $TAO_IMR->SpawnWaitKill (100); $TAO_IMR->Arguments ("-ORBInitRef ImplRepoService=file://$implrepo_ior shutdown airplane_server"); - $TAO_IMR->SpawnWaitKill (30); + $TAO_IMR->SpawnWaitKill (100); - $A_SVR->Kill (); - $N_SVR->Kill (); - $IMR->Kill (); + $A_SVR->Kill (); $A_SVR->Wait (); + $N_SVR->Kill (); $N_SVR->Wait (); + $IMR->Kill (); $IMR->Wait (); } ############################################################################### @@ -569,42 +316,58 @@ sub both_ir_test # Parse the arguments -for ($i = 0; $i <= $#ARGV; $i++) { - if ($ARGV[$i] eq "-h" || $ARGV[$i] eq "-?") { - print "run_test test\n"; - print "\n"; - print "test -- Runs a specific test:\n"; - print " airplane, airplane_ir, nt_service, ", - "nestea, nestea_ir,\n"; - print " both_ir, persistent_ir\n"; - exit; - } - elsif ($ARGV[$i] eq "airplane") { - exit airplane_test (); - } - elsif ($ARGV[$i] eq "airplane_ir") { - exit airplane_ir_test (); - } - elsif ($ARGV[$i] eq "nt_service") { - exit nt_service_test (); - } - elsif ($ARGV[$i] eq "nestea") { - exit nestea_test (); - } - elsif ($ARGV[$i] eq "nestea_ir") { - exit nestea_ir_test (); - } - elsif ($ARGV[$i] eq "both_ir") { - exit both_ir_test (); - } - elsif ($ARGV[$i] eq "persistent_ir") { - exit persistent_ir_test (); - } - else { - print "run_test: Unknown Option: ".$ARGV[$i]."\n"; - } +for ($i = 0; $i <= $#ARGV; $i++) +{ + SWITCH: + { + if ($ARGV[$i] eq "-h" || $ARGV[$i] eq "-?") + { + print "run_test [-chorus <target>] test\n"; + print "\n"; + print "-chorus <target> -- Runs the test on Chorus target\n"; + print "test -- Runs a specific test:\n"; + print " airplane, airplane_ir, nt_service, ", + "nestea, nestea_ir,\n"; + print " both_ir, persistent_ir\n"; + exit; + } + if ($ARGV[$i] eq "airplane") + { + airplane_test (); + exit; + } + if ($ARGV[$i] eq "airplane_ir") + { + airplane_ir_test (); + exit; + } + if ($ARGV[$i] eq "nt_service") + { + nt_service_test (); + exit; + } + if ($ARGV[$i] eq "nestea") + { + nestea_test (); + exit; + } + if ($ARGV[$i] eq "nestea_ir") + { + nestea_ir_test (); + exit; + } + if ($ARGV[$i] eq "both_ir") + { + both_ir_test (); + exit; + } + if ($ARGV[$i] eq "persistent_ir") + { + persistent_ir_test (); + exit; + } + print "run_test: Unknown Option: ".$ARGV[$i]."\n"; + } } -# if nothing else, run both_ir - -exit both_ir_test (); +both_ir_test (); |