diff options
Diffstat (limited to 'TAO/orbsvcs/tests/FT_App/run_test_registry.pl')
-rwxr-xr-x | TAO/orbsvcs/tests/FT_App/run_test_registry.pl | 118 |
1 files changed, 93 insertions, 25 deletions
diff --git a/TAO/orbsvcs/tests/FT_App/run_test_registry.pl b/TAO/orbsvcs/tests/FT_App/run_test_registry.pl index e94f7427201..dd73b739a52 100755 --- a/TAO/orbsvcs/tests/FT_App/run_test_registry.pl +++ b/TAO/orbsvcs/tests/FT_App/run_test_registry.pl @@ -6,11 +6,23 @@ eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' # -*- perl -*- # Purpose: -# To test the FactoryRegistry +# To test the FactoryRegistry either as a stand-alone application or as part +# of the replication manager +# +# Command line options: +# --debug_build use exes from this directory +# if not specified use exes from ./release +# -r use ReplicationManager rather than stand-alone factory +# --no_simulate +# use real IOGR-based recovery. +# -v display test progress messages (repeating option increases verbosity # # Process being tested: # FT_Registry # implements PortableGroup::FactoryRegistry interface. +# or +# FT_ReplicationManager (if -r option is used) +# # Processes used in test: # FT_Replica * 3 # implements GenericFactory interface to create TestReplicas @@ -92,12 +104,17 @@ use PerlACE::Run_Test; my($verbose) = 0; # 1: report perl actions before executing them my($debug_builds) = 0; # 0: use exes from Release directories my($simulated) = 1; # 1: use "client simulated" fault tolerance +my($use_rm) = 0; # 1: use replication manager; 0 use stand-alone factory registry foreach $i (@ARGV) { if ($i eq "--debug_build") { $debug_builds = 1; } + elsif ($i eq "-r") # use RegistrationManager + { + $use_rm = 1 + } elsif ($i eq "--no_simulate") # reverse this once we have FT ORB support { $simulated = 0; @@ -106,6 +123,11 @@ foreach $i (@ARGV) { { $verbose += 1; } + else + { + print "unknown option $i. Expecting: --debug_build, -r --no_simulate, -v\n"; + exit(-1); + } } my($build_directory) = "/Release"; @@ -128,6 +150,7 @@ my($location3) = "rivendell"; my($location4) = "rohan"; #define temp files +my($rm_ior) = PerlACE::LocalFile ("rm.ior"); my($registry_ior) = PerlACE::LocalFile ("registry.ior"); my($factory1_ior) = PerlACE::LocalFile ("factory1.ior"); my($factory2_ior) = PerlACE::LocalFile ("factory2.ior"); @@ -146,6 +169,7 @@ my($replica3_iogr) = PerlACE::LocalFile ("${species1}_2.iogr"); my($client_data) = PerlACE::LocalFile ("persistent.dat"); #discard junk from previous tests +unlink $rm_ior; unlink $registry_ior; unlink $factory1_ior; unlink $factory2_ior; @@ -163,24 +187,34 @@ unlink $client_data; my($status) = 0; +my ($rm_endpoint) = "-ORBEndpoint iiop://localhost:2833"; +my ($registry_opt) = "-f file://$registry_ior"; + +if ($use_rm) { + $registry_opt = "-ORBInitRef ReplicationManager=corbaloc::localhost:2833/ReplicationManager"; +} + +my($RM) = new PerlACE::Process ("$ENV{'TAO_ROOT'}/orbsvcs/FT_ReplicationManager$build_directory/FT_ReplicationManager", "-ORBDebugLevel 0 -o $rm_ior $rm_endpoint"); +my($RMC) = new PerlACE::Process (".$build_directory/replmgr_controller", "$registry_opt -x"); my($REG) = new PerlACE::Process (".$build_directory/ft_registry", "-o $registry_ior -q"); -my($FAC1) = new PerlACE::Process (".$build_directory/ft_replica", "-o $factory1_ior -f file://$registry_ior -l $location1 -i $species1 -q"); -my($FAC2) = new PerlACE::Process (".$build_directory/ft_replica", "-o $factory2_ior -f file://$registry_ior -l $location2 -i $species1 -i $species2 -i $species3 -q -u"); -my($FAC3) = new PerlACE::Process (".$build_directory/ft_replica", "-o $factory3_ior -f file://$registry_ior -l $location3 -i $species2 -q -u"); -# resolve factory IOR as file: url -#my($CTR) = new PerlACE::Process (".$build_directory/ft_create", "-f file://$registry_ior -r $species1 -r $species2 -r $species1 -u $species3"); -# -n means no name service -i means write individual iors -my($CTR) = new PerlACE::Process (".$build_directory/ft_create", "-f file://$registry_ior -r $species1 -r $species2 -r $species1 -u $species3 -n -i"); +my($FAC1) = new PerlACE::Process (".$build_directory/ft_replica", "-o $factory1_ior $registry_opt -l $location1 -i $species1 -q"); +my($FAC2) = new PerlACE::Process (".$build_directory/ft_replica", "-o $factory2_ior $registry_opt -l $location2 -i $species1 -i $species2 -i $species3 -q -u"); +my($FAC3) = new PerlACE::Process (".$build_directory/ft_replica", "-o $factory3_ior $registry_opt -l $location3 -i $species2 -q -u"); + # -n means no name service -i means write individual iors +my($CTR) = new PerlACE::Process (".$build_directory/ft_create", "$registry_opt -r $species1 -r $species2 -r $species1 -u $species3 -n -i"); my($CL1); my($CL2); my($CL3); -if ($simulated) { +if ($simulated) +{ print "\nTEST: Preparing Client Mediated Fault Tolerance test.\n" if ($verbose); $CL1 = new PerlACE::Process (".$build_directory/ft_client", "-f file://$replica1_ior -f file://$replica2_ior -c testscript"); $CL2 = new PerlACE::Process (".$build_directory/ft_client", "-f file://$replica3_ior -f file://$replica4_ior -c testscript"); $CL3 = new PerlACE::Process (".$build_directory/ft_client", "-f file://$replica5_ior -f file://$replica6_ior -c testscript"); -}else{ +} +else +{ print "\nTEST: Preparing IOGR based test.\n" if ($verbose); $CL1 = new PerlACE::Process (".$build_directory/ft_client", "-f file://$replica1_iogr -c testscript"); $CL2 = new PerlACE::Process (".$build_directory/ft_client", "-f file://$replica2_iogr -c testscript"); @@ -189,15 +223,29 @@ if ($simulated) { ####################### # Start FactoryRegistry - -print "\nTEST: starting registry " . $REG->CommandLine . "\n" if ($verbose); -$REG->Spawn (); - -print "TEST: waiting for registry's IOR\n" if ($verbose); -if (PerlACE::waitforfile_timed ($registry_ior, 5) == -1) { - print STDERR "TEST ERROR: cannot find file <$registry_ior>\n"; - $REG->Kill (); $REG->TimedWait (1); - exit 1; +if ($use_rm) +{ + print "\nTEST: starting ReplicationManager " . $RM->CommandLine . "\n" if ($verbose); + $RM->Spawn (); + + print "TEST: waiting for registry's IOR\n" if ($verbose); + if (PerlACE::waitforfile_timed ($rm_ior, 5) == -1) { + print STDERR "TEST ERROR: cannot find file <$rm_ior>\n"; + $RM->Kill (); $RM->TimedWait (1); + exit 1; + } +} +else +{ + print "\nTEST: starting registry " . $REG->CommandLine . "\n" if ($verbose); + $REG->Spawn (); + + print "TEST: waiting for registry's IOR\n" if ($verbose); + if (PerlACE::waitforfile_timed ($registry_ior, 5) == -1) { + print STDERR "TEST ERROR: cannot find file <$registry_ior>\n"; + $REG->Kill (); $REG->TimedWait (1); + exit 1; + } } ################# @@ -343,14 +391,34 @@ if ($factory3 != 0) { $status = 1; } -print "\nTEST: wait for FactoryRegistry.\n" if ($verbose); -$registry = $REG->WaitKill (30); -if ($registry != 0) { - print STDERR "TEST ERROR: FactoryRegistry returned $registry\n"; - $status = 1; -} +if ($use_rm) +{ + print "\nTEST: shutting down the replication manager.\n" if ($verbose); + $controller = $RMC->SpawnWaitKill (300); + if ($controller != 0) { + print STDERR "TEST ERROR: replication manager controller returned $controller\n"; + $status = 1; + } + print "\nTEST: wait for ReplicationManager.\n" if ($verbose); + #$RM->Kill (); + $repmgr = $RM->WaitKill (30); + if ($repmgr != 0) { + print STDERR "TEST ERROR: ReplicationManager returned $repmgr\n"; + $status = 1; + } +} +else +{ + print "\nTEST: wait for FactoryRegistry.\n" if ($verbose); + $registry = $REG->WaitKill (30); + if ($registry != 0) { + print STDERR "TEST ERROR: FactoryRegistry returned $registry\n"; + $status = 1; + } +} print "\nTEST: releasing scratch files.\n" if ($verbose); +unlink $rm_ior; unlink $registry_ior; unlink $factory1_ior; unlink $factory2_ior; |