diff options
author | dbudko <dbudko@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2009-12-08 10:26:33 +0000 |
---|---|---|
committer | dbudko <dbudko@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2009-12-08 10:26:33 +0000 |
commit | c0a6b86eac1e67e87239e400dcc89511df96e175 (patch) | |
tree | 4a490f9c81b6f16f663c6efc5ce47662008187f5 /TAO/orbsvcs/tests/FT_App | |
parent | 86980a288b4c0c8a54b6c6ae6c368fcdfb7b31e3 (diff) | |
download | ATCD-c0a6b86eac1e67e87239e400dcc89511df96e175.tar.gz |
Tue Dec 8 10:25:47 UTC 2009 Denis Budko <denis.budko@remedy.nl>
* orbsvcs/tests/Notify/Bug_2561_Regression/run_test.pl:
* orbsvcs/tests/Notify/Persistent_POA/Structured_Supplier.cpp:
* orbsvcs/tests/Notify/Persistent_POA/run_test.pl:
* orbsvcs/tests/Notify/Blocking/run_test.pl:
* orbsvcs/tests/Notify/Structured_Filter/Structured_Consumer.cpp:
* orbsvcs/tests/Notify/Structured_Filter/Structured_Supplier.cpp:
* orbsvcs/tests/Notify/Structured_Filter/run_test.pl:
* orbsvcs/tests/FT_App/run_test_rmregistry.pl:
* orbsvcs/tests/FT_App/run_test_registry.pl:
* orbsvcs/tests/EC_Throughput/run_test_overflow.pl:
* orbsvcs/tests/EC_Throughput/run_test.pl:
* orbsvcs/tests/Event/Mcast/RTEC_MCast_Federated/run_test.pl:
* orbsvcs/tests/Event/Mcast/Simple/run_test.pl:
* orbsvcs/tests/Event/Mcast/Two_Way/run_test.pl:
* orbsvcs/tests/Bug_2248_Regression/client.cpp:
* orbsvcs/tests/Bug_2248_Regression/run_test.pl:
* orbsvcs/tests/RTCosScheduling/run_test.pl:
* orbsvcs/tests/Bug_3387_Regression/run_test.pl:
* performance-tests/CSD_Strategy/TestApps/run_test.pl:
* performance-tests/RTCorba/Thread_Pool/run_test.pl:
* tests/CSD_Strategy_Tests/Broken/run_test.pl:
* tests/CSD_Strategy_Tests/TP_Test_4/run_test.pl:
Tests are converted to use new test framework
and added to fuzz build.
Diffstat (limited to 'TAO/orbsvcs/tests/FT_App')
-rwxr-xr-x | TAO/orbsvcs/tests/FT_App/run_test_registry.pl | 797 | ||||
-rwxr-xr-x | TAO/orbsvcs/tests/FT_App/run_test_rmregistry.pl | 570 |
2 files changed, 937 insertions, 430 deletions
diff --git a/TAO/orbsvcs/tests/FT_App/run_test_registry.pl b/TAO/orbsvcs/tests/FT_App/run_test_registry.pl index ac31e8a34f0..6948b684dd2 100755 --- a/TAO/orbsvcs/tests/FT_App/run_test_registry.pl +++ b/TAO/orbsvcs/tests/FT_App/run_test_registry.pl @@ -93,346 +93,649 @@ eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' # # The factory registry is also run with the quit-on-idle option so when the last # factory unregisters itself, the factory registry shuts down to end the test. - use lib "$ENV{ACE_ROOT}/bin"; -#use lib '$ENV{ACE_ROOT}/bin'; -use PerlACE::Run_Test; +use PerlACE::TestTarget; ######################## #command line options #set defaults: +my($status) = 0; 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; - } - elsif ($i eq "-v") - { - $verbose += 1; - } - else - { - print "unknown option $i. Expecting: --debug_build, -r --no_simulate, -v\n"; - exit(-1); - } + 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; + } + elsif ($i eq "-v"){ + $verbose += 1; + } + else{ + print "unknown option $i. Expecting: --debug_build, -r --no_simulate, -v\n"; + exit(-1); + } } my($build_directory) = "/Release"; if ( $debug_builds ) { - $build_directory = ""; + $build_directory = ""; } if ( $verbose > 1) { - print "verbose: $verbose\n"; - print "debug_builds: $debug_builds -> $build_directory\n"; - print "simulated: $simulated\n"; + print "verbose: $verbose\n"; + print "debug_builds: $debug_builds -> $build_directory\n"; + print "simulated: $simulated\n"; +} + +# List of the proccess which must be killed before exit with error +@kill_list = (); + +sub add_to_kills{ + $goal = shift; + @kill_list = (@kill_list, $goal); +} +sub exit_and_kill{ + $status = shift; + foreach $goal (@kill_list){ + $goal->Kill (); $goal->TimedWait (1); + } + exit $status; } -my($species1) = "hobbit"; -my($species2) = "elf"; -my($species3) = "human"; +my $rp_manager = PerlACE::TestTarget::create_target (1) || die "Create target 1 failed\n"; +my $rp_manager_controller = PerlACE::TestTarget::create_target (2) || die "Create target 2 failed\n"; +my $ft_replica1 = PerlACE::TestTarget::create_target (3) || die "Create target 3 failed\n"; +my $ft_replica2 = PerlACE::TestTarget::create_target (4) || die "Create target 4 failed\n"; +my $ft_replica3 = PerlACE::TestTarget::create_target (5) || die "Create target 5 failed\n"; +my $ft_creator = PerlACE::TestTarget::create_target (6) || die "Create target 6 failed\n"; +my $client1 = PerlACE::TestTarget::create_target (7) || die "Create target 7 failed\n"; +my $client2 = PerlACE::TestTarget::create_target (8) || die "Create target 8 failed\n"; +my $client3 = PerlACE::TestTarget::create_target (9) || die "Create target 9 failed\n"; +my $ft_registry = PerlACE::TestTarget::create_target (10) || die "Create target 10 failed\n"; + +my($role1) = "hobbit"; +my($role2) = "elf"; +my($role3) = "human"; + my($location1) = "shire"; my($location2) = "bree"; 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"); -my($factory3_ior) = PerlACE::LocalFile ("factory3.ior"); -my($replica1_ior) = PerlACE::LocalFile ("${species1}_${location1}_0.ior"); -my($replica2_ior) = PerlACE::LocalFile ("${species1}_${location2}_0.ior"); -my($replica3_ior) = PerlACE::LocalFile ("${species2}_${location2}_1.ior"); -my($replica4_ior) = PerlACE::LocalFile ("${species2}_${location3}_0.ior"); -my($replica5_ior) = PerlACE::LocalFile ("${species1}_${location1}_1.ior"); -my($replica6_ior) = PerlACE::LocalFile ("${species1}_${location2}_2.ior"); - -my($replica1_iogr) = PerlACE::LocalFile ("${species1}_0.iogr"); -my($replica2_iogr) = PerlACE::LocalFile ("${species2}_1.iogr"); -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; -unlink $factory3_ior; -unlink $replica1_ior; -unlink $replica2_ior; -unlink $replica3_ior; -unlink $replica4_ior; -unlink $replica5_ior; -unlink $replica6_ior; -unlink $replica1_iogr; -unlink $replica2_iogr; - -unlink $client_data; +my($rm_ior) = "rm.ior"; +my($registry_ior) = "registry.ior"; -my($status) = 0; +my($factory1_ior) = "factory1.ior"; +my($factory2_ior) = "factory2.ior"; +my($factory3_ior) = "factory3.ior"; + +my($replica1_ior) = "${role1}_${location1}_0.ior"; +my($replica2_ior) = "${role1}_${location2}_0.ior"; +my($replica3_ior) = "${role2}_${location2}_1.ior"; +my($replica4_ior) = "${role2}_${location3}_0.ior"; +my($replica5_ior) = "${role1}_${location1}_1.ior"; +my($replica6_ior) = "${role1}_${location2}_2.ior"; + +my($replica1_iogr) = "${role1}_0.iogr"; +my($replica2_iogr) = "${role2}_1.iogr"; +my($replica3_iogr) = "${role1}_2.iogr"; + +my($client_data) = "persistent.dat"; + +# Files for rp_manager +my $rp_manager_ior = $rp_manager->LocalFile ($rm_ior); +$rp_manager->DeleteFile ($rm_ior); + +# Files for ft_registry +my $ft_registry_registry_ior = $ft_registry->LocalFile ($registry_ior); +$ft_registry->DeleteFile ($registry_ior); + +# Files for rp_manager_controller + +my ($rp_manager_controller_registry_ior); +if(!$use_rm){ + $rp_manager_controller_registry_ior = $rp_manager_controller->LocalFile ($registry_ior); + $rp_manager_controller->DeleteFile ($registry_ior); +} + +# Files for ft_replica1 +my $ft_replica1_factory1_ior = $ft_replica1->LocalFile ($factory1_ior); +my $ft_replica1_client_data = $ft_replica1->LocalFile ($client_data); + +$ft_replica1->DeleteFile ($factory1_ior); +$ft_replica1->DeleteFile ($client_data); + +my($ft_replica1_registry_ior); + +if(!$use_rm){ + $ft_replica1_registry_ior = $ft_replica1->LocalFile ($registry_ior); + $ft_replica1->DeleteFile ($registry_ior); +} + +# Files for ft_replica2 +my $ft_replica2_factory2_ior = $ft_replica2->LocalFile ($factory2_ior); +my $ft_replica2_client_data = $ft_replica2->LocalFile ($client_data); -my ($rm_endpoint) = "-ORBEndpoint iiop://localhost:2833"; -my ($registry_opt) = "-f file://$registry_ior"; +$ft_replica2->DeleteFile ($factory2_ior); +$ft_replica2->DeleteFile ($client_data); -if ($use_rm) { - $registry_opt = "-ORBInitRef ReplicationManager=corbaloc::localhost:2833/ReplicationManager"; +my($ft_replica2_registry_ior); +if(!$use_rm){ + $ft_replica2_registry_ior = $ft_replica2->LocalFile ($registry_ior); + $ft_replica2->DeleteFile ($registry_ior); } -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 $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) -{ - 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"); +# Files for ft_replica3 +my $ft_replica3_factory3_ior = $ft_replica3->LocalFile ($factory3_ior); +my $ft_replica3_client_data = $ft_replica3->LocalFile ($client_data); + +$ft_replica3->DeleteFile ($factory3_ior); +$ft_replica3->DeleteFile ($client_data); + +my($ft_replica3_registry_ior); +if(!$use_rm){ + $ft_replica3_registry_ior = $ft_replica3->LocalFile ($registry_ior); + $ft_replica3->DeleteFile ($registry_ior); +} + +# Files for ft_creator +my $creator_replica1_ior = $ft_creator->LocalFile ($replica1_ior); +my $creator_replica2_ior = $ft_creator->LocalFile ($replica2_ior); +my $creator_replica3_ior = $ft_creator->LocalFile ($replica3_ior); +my $creator_replica4_ior = $ft_creator->LocalFile ($replica4_ior); +my $creator_replica5_ior = $ft_creator->LocalFile ($replica5_ior); +my $creator_replica6_ior = $ft_creator->LocalFile ($replica6_ior); + +my $creator_replica1_iogr = $ft_creator->LocalFile ($replica1_iogr); +my $creator_replica2_iogr = $ft_creator->LocalFile ($replica2_iogr); +my $creator_replica3_iogr = $ft_creator->LocalFile ($replica3_iogr); + +my($ft_creator_registry_ior); +if(!$use_rm){ + $ft_creator_registry_ior = $ft_creator->LocalFile ($registry_ior); + $ft_creator->DeleteFile ($registry_ior); +} + +$ft_creator->DeleteFile ($replica1_ior); +$ft_creator->DeleteFile ($replica2_ior); +$ft_creator->DeleteFile ($replica3_ior); +$ft_creator->DeleteFile ($replica4_ior); +$ft_creator->DeleteFile ($replica5_ior); +$ft_creator->DeleteFile ($replica6_ior); + +$ft_creator->DeleteFile ($replica1_iogr); +$ft_creator->DeleteFile ($replica2_iogr); +$ft_creator->DeleteFile ($replica3_iogr); + +# Files for client1 +my $client1_replica1_ior = $client1->LocalFile ($replica1_ior); +my $client1_replica2_ior = $client1->LocalFile ($replica2_ior); +my $client1_replica1_iogr = $client1->LocalFile ($replica1_iogr); + +$client1->DeleteFile ($replica1_ior); +$client1->DeleteFile ($replica2_ior); +$client1->DeleteFile ($replica1_iogr); + +# Files for client2 +my $client2_replica3_ior = $client2->LocalFile ($replica3_ior); +my $client2_replica4_ior = $client2->LocalFile ($replica4_ior); +my $client2_replica2_iogr = $client2->LocalFile ($replica2_iogr); + +$client2->DeleteFile ($replica3_ior); +$client2->DeleteFile ($replica4_ior); +$client2->DeleteFile ($replica2_iogr); + +# Files for client3 +my $client3_replica5_ior = $client3->LocalFile ($replica5_ior); +my $client3_replica6_ior = $client3->LocalFile ($replica6_ior); +my $client3_replica3_iogr = $client3->LocalFile ($replica3_iogr); + +$client3->DeleteFile ($replica5_ior); +$client3->DeleteFile ($replica6_ior); +$client3->DeleteFile ($replica3_iogr); + +$hostname = $rp_manager->HostName (); +$port = $rp_manager->RandomPort (); + +$RM = $rp_manager->CreateProcess ("$ENV{'TAO_ROOT'}/orbsvcs/FT_ReplicationManager" . + "$build_directory/FT_ReplicationManager", + "-o $rp_manager_ior " . + "-ORBEndpoint iiop://$hostname:$port"); +my($RMC); +if ($use_rm){ + $RMC = $rp_manager_controller->CreateProcess (".$build_directory/replmgr_controller" , + "-ORBInitRef ReplicationManager=corbaloc::$hostname:$port/ReplicationManager " . + "-x"); +} +else{ + $RMC = $rp_manager_controller->CreateProcess (".$build_directory/replmgr_controller" , + "-f file://$rp_manager_controller_registry_ior " . + "-x"); +} + +$REG = $ft_registry->CreateProcess (".$build_directory/ft_registry" , + "-o $ft_registry_registry_ior " . + "-q"); + + +my($REP1); +my($REP2); +my($REP3); + +if ($use_rm){ + $REP1 = $ft_replica1->CreateProcess (".$build_directory/ft_replica" , + "-o $ft_replica1_factory1_ior ". + "-ORBInitRef ReplicationManager=corbaloc::$hostname:$port/ReplicationManager " . + "-l $location1 -i $role1 -q -p $ft_replica1_client_data"); + + $REP2 = $ft_replica2->CreateProcess (".$build_directory/ft_replica" , + "-o $ft_replica2_factory2_ior ". + "-ORBInitRef ReplicationManager=corbaloc::$hostname:$port/ReplicationManager " . + "-l $location2 ". + "-i $role1 -i $role2 -i $role3 -q -u " . + "-p $ft_replica2_client_data"); + + $REP3 = $ft_replica3->CreateProcess (".$build_directory/ft_replica" , + "-o $ft_replica3_factory3_ior ". + "-ORBInitRef ReplicationManager=corbaloc::$hostname:$port/ReplicationManager " . + "-l $location3 -i $role2 -q -u -p $ft_replica1_client_data"); + + $CTR = $ft_creator->CreateProcess (".$build_directory/ft_create" , + "-ORBInitRef ReplicationManager=corbaloc::$hostname:$port/ReplicationManager " . + "-n -r $role1 -r $role2 -r $role1 -u $role3 -i"); + } -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"); - $CL3 = new PerlACE::Process (".$build_directory/ft_client", "-f file://$replica3_iogr -c testscript"); +else{ + $REP1 = $ft_replica1->CreateProcess (".$build_directory/ft_replica" , + "-o $ft_replica1_factory1_ior ". + "-f file://$ft_replica1_registry_ior " . + "-l $location1 -i $role1 -q -p $ft_replica1_client_data"); + + $REP2 = $ft_replica2->CreateProcess (".$build_directory/ft_replica" , + "-o $ft_replica2_factory2_ior ". + "-f file://$ft_replica2_registry_ior " . + "-l $location2 ". + "-i $role1 -i $role2 -i $role3 -q -u " . + "-p $ft_replica2_client_data"); + + $REP3 = $ft_replica3->CreateProcess (".$build_directory/ft_replica" , + "-o $ft_replica3_factory3_ior ". + "-f file://$ft_replica3_registry_ior " . + "-l $location3 -i $role2 -q -u -p $ft_replica1_client_data"); + + $CTR = $ft_creator->CreateProcess (".$build_directory/ft_create" , + "-f file://$ft_creator_registry_ior " . + "-n -r $role1 -r $role2 -r $role1 -u $role3 -i"); +} + +my($CL1) = $client1->CreateProcess (".$build_directory/ft_client" , + "-f file://$client1_replica1_ior " . + "-f file://$client1_replica2_ior " . + "-c testscript"); + +my($CL2) = $client2->CreateProcess (".$build_directory/ft_client" , + "-f file://$client2_replica3_ior " . + "-f file://$client2_replica4_ior " . + "-c testscript"); + +my($CL3) = $client3->CreateProcess (".$build_directory/ft_client" , + "-f file://$client3_replica5_ior " . + "-f file://$client3_replica6_ior " . + "-c testscript"); + + +if ($simulated) { + print "\nTEST: Preparing Client Mediated Fault Tolerance test.\n" if ($verbose); +}else{ + print "\nTEST: Preparing IOGR based test.\n" if ($verbose); + $CL1->Arguments ("-f file://$client1_replica1_iogr -c testscript"); + $CL2->Arguments ("-f file://$client2_replica2_iogr -c testscript"); + $CL3->Arguments ("-f file://$client3_replica3_iogr -c testscript"); } ####################### # Start FactoryRegistry -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, $PerlACE::wait_interval_for_process_creation) == -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, $PerlACE::wait_interval_for_process_creation) == -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 (); + add_to_kills ($RM); + + print "TEST: waiting for registry's IOR\n" if ($verbose); + + if ($rp_manager->WaitForFileTimed ($rm_ior, + $rp_manager->ProcessStartWaitInterval()) == -1) { + print STDERR "ERROR: cannot find file <$rp_manager_ior>\n"; + exit_and_kill (1); + } +} +else{ + print "\nTEST: starting registry " . $REG->CommandLine . "\n" if ($verbose); + $REG->Spawn (); + + add_to_kills ($REG); + + print "TEST: waiting for registry's IOR\n" if ($verbose); + + if ($ft_registry->WaitForFileTimed ($registry_ior, + $ft_registry->ProcessStartWaitInterval()) == -1) { + print STDERR "ERROR: cannot find file <$rp_manager_ior>\n"; + exit_and_kill (1); + } + + if ($ft_registry->GetFile ($registry_ior) == -1) { + print STDERR "ERROR: cannot retrieve file <$ft_registry_registry_ior\n"; + exit_and_kill (1); + } + if ($ft_replica1->PutFile ($registry_ior) == -1) { + print STDERR "ERROR: cannot set file <$ft_replica1_registry_ior>\n"; + exit_and_kill (1); + } + if ($ft_replica2->PutFile ($registry_ior) == -1) { + print STDERR "ERROR: cannot set file <$ft_replica2_registry_ior>\n"; + exit_and_kill (1); + } + if ($ft_replica3->PutFile ($registry_ior) == -1) { + print STDERR "ERROR: cannot set file <$ft_replica3_registry_ior>\n"; + exit_and_kill (1); + } + if ($ft_creator->PutFile ($registry_ior) == -1) { + print STDERR "ERROR: cannot set file <$ft_creator_registry_ior>\n"; + exit_and_kill (1); + } } ################# # Start Factories -print "\nTEST: starting factory 1 " . $FAC1->CommandLine . "\n" if ($verbose); -$FAC1->Spawn (); +print "\nTEST: starting factory 1 " . $REP1->CommandLine . "\n" if ($verbose); +$REP1->Spawn (); + +add_to_kills ($REP1); print "TEST: waiting for factory 1's IOR\n" if ($verbose); -if (PerlACE::waitforfile_timed ($factory1_ior, $PerlACE::wait_interval_for_process_creation) == -1) { - print STDERR "TEST ERROR: cannot find file <$factory1_ior>\n"; - $REG->Kill (); $REG->TimedWait (1); - $FAC1->Kill (); $FAC1->TimedWait (1); - exit 1; +if ($ft_replica1->WaitForFileTimed ($factory1_ior, + $ft_replica1->ProcessStartWaitInterval()) == -1) { + print STDERR "ERROR: cannot find file <$ft_replica1_factory1_ior>\n"; + exit_and_kill (1); } -print "\nTEST: starting factory 2 " . $FAC2->CommandLine . "\n" if ($verbose); -$FAC2->Spawn (); +print "\nTEST: starting factory 2 " . $REP2->CommandLine . "\n" if ($verbose); +$REP2->Spawn (); + +add_to_kills ($REP2); print "TEST: waiting for factory 2's IOR\n" if ($verbose); -if (PerlACE::waitforfile_timed ($factory2_ior, $PerlACE::wait_interval_for_process_creation) == -1) { - print STDERR "TEST ERROR: cannot find file <$factory2_ior>\n"; - $FAC1->Kill (); $FAC1->TimedWait (1); - $REG->Kill (); $REG->TimedWait (1); - $FAC2->Kill (); $FAC2->TimedWait (1); - exit 1; +if ($ft_replica2->WaitForFileTimed ($factory2_ior, + $ft_replica2->ProcessStartWaitInterval()) == -1) { + print STDERR "ERROR: cannot find file <$ft_replica2_factory2_ior>\n"; + exit_and_kill (1); } -print "\nTEST: starting factory 3 " . $FAC3->CommandLine . "\n" if ($verbose); -$FAC3->Spawn (); +print "\nTEST: starting factory 3 " . $REP3->CommandLine . "\n" if ($verbose); +$REP3->Spawn (); + +add_to_kills ($REP3); print "TEST: waiting for factory 3's IOR\n" if ($verbose); -if (PerlACE::waitforfile_timed ($factory3_ior, $PerlACE::wait_interval_for_process_creation) == -1) { - print STDERR "TEST ERROR: cannot find file <$factory3_ior>\n"; - $FAC1->Kill (); $FAC1->TimedWait (1); - $FAC2->Kill (); $FAC2->TimedWait (1); - $REG->Kill (); $REG->TimedWait (1); - $FAC3->Kill (); $FAC3->TimedWait (1); - exit 1; +if ($ft_replica3->WaitForFileTimed ($factory3_ior, + $ft_replica3->ProcessStartWaitInterval()) == -1) { + print STDERR "ERROR: cannot find file <$ft_replica3_factory3_ior>\n"; + exit_and_kill (1); } - ###################### # Create object groups print "\nTEST: starting object group creator " . $CTR->CommandLine . "\n" if ($verbose); $CTR->Spawn (); +add_to_kills ($CTR); + print "TEST: waiting for Replica IOR files from object group creator\n" if ($verbose); -if (PerlACE::waitforfile_timed ($replica1_ior, $PerlACE::wait_interval_for_process_creation) == -1){ - print STDERR "TEST ERROR: cannot find file <$replica1_ior>\n"; - $status = 1; -} -elsif (PerlACE::waitforfile_timed ($replica2_ior, $PerlACE::wait_interval_for_process_creation) == -1){ - print STDERR "TEST ERROR: cannot find file <$replica2_ior> \n"; - $status = 1; + +if ($ft_creator->WaitForFileTimed ($replica1_ior, + $ft_creator->ProcessStartWaitInterval()) == -1) { + print STDERR "ERROR: cannot find file <$ft_creator_replica1_ior>\n"; + exit_and_kill (1); } -elsif (PerlACE::waitforfile_timed ($replica3_ior, $PerlACE::wait_interval_for_process_creation) == -1){ - print STDERR "TEST ERROR: cannot find file <$replica3_ior> \n"; - $status = 1; + +if ($ft_creator->WaitForFileTimed ($replica2_ior, + $ft_creator->ProcessStartWaitInterval()) == -1) { + print STDERR "ERROR: cannot find file <$ft_creator_replica2_ior>\n"; + exit_and_kill (1); } -elsif (PerlACE::waitforfile_timed ($replica4_ior, $PerlACE::wait_interval_for_process_creation) == -1){ - print STDERR "TEST ERROR: cannot find file <$replica4_ior> \n"; - $status = 1; + +if ($ft_creator->WaitForFileTimed ($replica3_ior, + $ft_creator->ProcessStartWaitInterval()) == -1) { + print STDERR "ERROR: cannot find file <$ft_creator_replica3_ior>\n"; + exit_and_kill (1); } -elsif (PerlACE::waitforfile_timed ($replica5_ior, $PerlACE::wait_interval_for_process_creation) == -1){ - print STDERR "TEST ERROR: cannot find file <$replica5_ior> \n"; - $status = 1; + +if ($ft_creator->WaitForFileTimed ($replica4_ior, + $ft_creator->ProcessStartWaitInterval()) == -1) { + print STDERR "ERROR: cannot find file <$ft_creator_replica4_ior>\n"; + exit_and_kill (1); } -elsif (PerlACE::waitforfile_timed ($replica6_ior, $PerlACE::wait_interval_for_process_creation) == -1){ - print STDERR "TEST ERROR: cannot find file <$replica6_ior> \n"; - $status = 1; + +if ($ft_creator->WaitForFileTimed ($replica5_ior, + $ft_creator->ProcessStartWaitInterval()) == -1) { + print STDERR "ERROR: cannot find file <$ft_creator_replica5_ior>\n"; + exit_and_kill (1); } -if($status != 0){ - $FAC3->Kill (); $FAC3->TimedWait (1); - $FAC2->Kill (); $FAC2->TimedWait (1); - $FAC1->Kill (); $FAC1->TimedWait (1); - $REG->Kill (); $REG->TimedWait (1); - $CTR->Kill (); $CTR->TimedWait(1); - exit 1; +if ($ft_creator->WaitForFileTimed ($replica6_ior, + $ft_creator->ProcessStartWaitInterval()) == -1) { + print STDERR "ERROR: cannot find file <$ft_creator_replica6_ior>\n"; + exit_and_kill (1); } -print "\nTEST: wait for object group creator.\n" if ($verbose); -$config = $CTR->WaitKill (5); -if ($config != 0) { - print STDERR "TEST ERROR: configuration manager returned $config\n"; - $FAC3->Kill (); $FAC3->TimedWait (1); - $FAC2->Kill (); $FAC2->TimedWait (1); - $FAC1->Kill (); $FAC1->TimedWait (1); - $REG->Kill (); $REG->TimedWait (1); - exit 1; +# Get/Put files: +# replica1_ior: client1 +if ($ft_creator->GetFile ($replica1_ior) == -1) { + print STDERR "ERROR: cannot retrieve file <$ft_creator_replica1_ior\n"; + exit_and_kill (1); +} +if ($client1->PutFile ($replica1_ior) == -1) { + print STDERR "ERROR: cannot set file <$client1_replica1_ior>\n"; + exit_and_kill (1); +} +# replica2_ior: client1 +if ($ft_creator->GetFile ($replica2_ior) == -1) { + print STDERR "ERROR: cannot retrieve file <$ft_creator_replica2_ior\n"; + exit_and_kill (1); +} +if ($client1->PutFile ($replica2_ior) == -1) { + print STDERR "ERROR: cannot set file <$client1_replica2_ior>\n"; + exit_and_kill (1); +} +# replica3_ior: client2 +if ($ft_creator->GetFile ($replica3_ior) == -1) { + print STDERR "ERROR: cannot retrieve file <$ft_creator_replica3_ior\n"; + exit_and_kill (1); +} +if ($client2->PutFile ($replica3_ior) == -1) { + print STDERR "ERROR: cannot set file <$client2_replica3_ior>\n"; + exit_and_kill (1); +} +# replica4_ior: client2 +if ($ft_creator->GetFile ($replica4_ior) == -1) { + print STDERR "ERROR: cannot retrieve file <$ft_creator_replica4_ior\n"; + exit_and_kill (1); +} +if ($client2->PutFile ($replica4_ior) == -1) { + print STDERR "ERROR: cannot set file <$client2_replica4_ior>\n"; + exit_and_kill (1); +} +# replica5_ior: client3 +if ($ft_creator->GetFile ($replica5_ior) == -1) { + print STDERR "ERROR: cannot retrieve file <$ft_creator_replica5_ior\n"; + exit_and_kill (1); +} +if ($client3->PutFile ($replica5_ior) == -1) { + print STDERR "ERROR: cannot set file <$client3_replica5_ior>\n"; + exit_and_kill (1); +} +# replica6_ior: client3 +if ($ft_creator->GetFile ($replica6_ior) == -1) { + print STDERR "ERROR: cannot retrieve file <$ft_creator_replica6_ior\n"; + exit_and_kill (1); +} +if ($client3->PutFile ($replica6_ior) == -1) { + print STDERR "ERROR: cannot set file <$client3_replica6_ior>\n"; + exit_and_kill (1); } +print "\nTEST: wait for object group creator.\n" if ($verbose); +$status_creator = $CTR->WaitKill ($ft_creator->ProcessStopWaitInterval()); +if ($status_creator != 0) { + print STDERR "TEST ERROR: configuration manager returned $status_creator\n"; + exit_and_kill(1); +} ############# # Run clients print "\nTEST: starting client " . $CL1->CommandLine . "\n" if ($verbose); -$client = $CL1->SpawnWaitKill (60); - -if ($client != 0) { - print STDERR "TEST ERROR: client returned $client\n"; - $status = 1; +$status_client = $CL1->SpawnWaitKill ($client1->ProcessStartWaitInterval() + 45); +if ($status_client != 0) { + print STDERR "TEST ERROR: client returned $status_client\n"; + exit_and_kill(1); } print "\nTEST: starting client again " . $CL2->CommandLine . "\n" if ($verbose); -$client2 = $CL2->SpawnWaitKill (60); -if ($client2 != 0) { - print STDERR "TEST ERROR: client returned $client2\n"; - $status = 1; +$status_client = $CL2->SpawnWaitKill ($client2->ProcessStartWaitInterval() + 45); +if ($status_client != 0) { + print STDERR "TEST ERROR: client returned $status_client\n"; + exit_and_kill(1); } print "\nTEST: starting client, one more time with feeling " . $CL3->CommandLine . "\n" if ($verbose); -$client3 = $CL3->SpawnWaitKill (60); - -if ($client3 != 0) { - print STDERR "TEST ERROR: client returned $client3\n"; - $status = 1; +$status_client = $CL3->SpawnWaitKill ($client3->ProcessStartWaitInterval() + 45); +if ($status_client != 0) { + print STDERR "TEST ERROR: client returned $status_client\n"; + exit_and_kill(1); } ###################### # Clean house and exit print "\nTEST: wait for factory 1.\n" if ($verbose); -$factory1 = $FAC1->WaitKill (30); -if ($factory1 != 0) { - print STDERR "TEST ERROR: replica returned $factory 1\n"; - $status = 1; -} +$status_replica = $REP1->WaitKill ($ft_replica1->ProcessStopWaitInterval() + 15); +if ($status_replica != 0) { + print STDERR "TEST ERROR: replica returned $status_replica\n"; + exit_and_kill(1); +} print "\nTEST: wait for factory 2.\n" if ($verbose); -$factory2 = $FAC2->WaitKill (30); -if ($factory2 != 0) { - print STDERR "TEST ERROR: factory 2 returned $factory2\n"; - $status = 1; +$status_replica = $REP2->WaitKill ($ft_replica2->ProcessStopWaitInterval() + 15); +if ($status_replica != 0) { + print STDERR "TEST ERROR: replica returned $status_replica\n"; + exit_and_kill(1); } print "\nTEST: wait for factory 3.\n" if ($verbose); -$factory3 = $FAC3->WaitKill (30); -if ($factory3 != 0) { - print STDERR "TEST ERROR: factory 3 returned $factory3\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; - } +$status_replica = $REP3->WaitKill ($ft_replica3->ProcessStopWaitInterval() + 15); +if ($status_replica != 0) { + print STDERR "TEST ERROR: replica returned $status_replica\n"; + exit_and_kill(1); +} + +if ($use_rm){ + print "\nTEST: shutting down the replication manager.\n" if ($verbose); + $status_controller = $RMC->SpawnWaitKill ($rp_manager_controller->ProcessStartWaitInterval() + 285); + if ($status_controller != 0) { + print STDERR "TEST ERROR: replication manager controller returned $status_controller\n"; + $status = 1; + } + + print "\nTEST: wait for ReplicationManager.\n" if ($verbose); + $status_repmgr = $RM->WaitKill ($rp_manager->ProcessStopWaitInterval() + 15); + if ($status_repmgr != 0) { + print STDERR "TEST ERROR: ReplicationManager returned $status_repmgr\n"; + $status = 1; + } } +else{ + print "\nTEST: wait for FactoryRegistry.\n" if ($verbose); + $status_reg = $REG->WaitKill ($ft_registry->ProcessStopWaitInterval() + 15); + if ($status_reg != 0) { + print STDERR "TEST ERROR: FactoryRegistry returned $status_reg\n"; + $status = 1; + } +} + print "\nTEST: releasing scratch files.\n" if ($verbose); -unlink $rm_ior; -unlink $registry_ior; -unlink $factory1_ior; -unlink $factory2_ior; -unlink $factory3_ior; -unlink $replica1_ior; -unlink $replica2_ior; -unlink $replica3_ior; -unlink $replica4_ior; -unlink $replica5_ior; -unlink $replica6_ior; -unlink $replica1_iogr; -unlink $replica2_iogr; - -unlink $client_data; +# Files for rp_manager +$rp_manager->DeleteFile ($rm_ior); + +# Files for ft_registry +$ft_registry->DeleteFile ($registry_ior); + +if(!$use_rm){ + $rp_manager_controller->DeleteFile ($registry_ior); +} + +# Files for ft_replica1 +$ft_replica1->DeleteFile ($factory1_ior); +$ft_replica1->DeleteFile ($client_data); + +if(!$use_rm){ + $ft_replica1->DeleteFile ($registry_ior); +} + +# Files for ft_replica2 +$ft_replica2->DeleteFile ($factory2_ior); +$ft_replica2->DeleteFile ($client_data); + +if(!$use_rm){ + $ft_replica2->DeleteFile ($registry_ior); +} +# Files for ft_replica3 +$ft_replica3->DeleteFile ($factory3_ior); +$ft_replica3->DeleteFile ($client_data); + +if(!$use_rm){ + $ft_replica3->DeleteFile ($registry_ior); +} + +# Files for ft_creator +if(!$use_rm){ + $ft_creator->DeleteFile ($registry_ior); +} + +$ft_creator->DeleteFile ($replica1_ior); +$ft_creator->DeleteFile ($replica2_ior); +$ft_creator->DeleteFile ($replica3_ior); +$ft_creator->DeleteFile ($replica4_ior); +$ft_creator->DeleteFile ($replica5_ior); +$ft_creator->DeleteFile ($replica6_ior); + +$ft_creator->DeleteFile ($replica1_iogr); +$ft_creator->DeleteFile ($replica2_iogr); +$ft_creator->DeleteFile ($replica3_iogr); + +# Files for client1 +$client1->DeleteFile ($replica1_ior); +$client1->DeleteFile ($replica2_ior); +$client1->DeleteFile ($replica1_iogr); + +# Files for client2 +$client2->DeleteFile ($replica3_ior); +$client2->DeleteFile ($replica4_ior); +$client2->DeleteFile ($replica2_iogr); + +# Files for client3 +$client3->DeleteFile ($replica5_ior); +$client3->DeleteFile ($replica6_ior); +$client3->DeleteFile ($replica3_iogr); exit $status; diff --git a/TAO/orbsvcs/tests/FT_App/run_test_rmregistry.pl b/TAO/orbsvcs/tests/FT_App/run_test_rmregistry.pl index 0d959b3789c..f0b28c6240e 100755 --- a/TAO/orbsvcs/tests/FT_App/run_test_rmregistry.pl +++ b/TAO/orbsvcs/tests/FT_App/run_test_rmregistry.pl @@ -85,42 +85,55 @@ eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' # The factory registry is also run with the quit-on-idle option so when the last # factory unregisters itself. # The ReplicationManager is killed because it doesn't have a quit-on-idle option. - use lib "$ENV{ACE_ROOT}/bin"; -#use lib '$ENV{ACE_ROOT}/bin'; -use PerlACE::Run_Test; +use PerlACE::TestTarget; ######################## #command line options #set defaults: + +my($status) = 0; 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 + +# List of the proccess which must be killed before exit with error +@kill_list = (); + +sub add_to_kills{ + $goal = shift; + @kill_list = (@kill_list, $goal); +} +sub exit_and_kill{ + $status = shift; + foreach $goal (@kill_list){ + $goal->Kill (); $goal->TimedWait (1); + } + exit $status; +} + foreach $i (@ARGV) { - if ($i eq "--debug_build") - { - $debug_builds = 1; - } - elsif ($i eq "--no_simulate") # reverse this once we have FT ORB support - { - $simulated = 0; - } - elsif ($i eq "-v") - { - $verbose += 1; - } + if ($i eq "--debug_build"){ + $debug_builds = 1; + } + elsif ($i eq "--no_simulate"){ # reverse this once we have FT ORB support + $simulated = 0; + } + elsif ($i eq "-v"){ + $verbose += 1; + } } my($build_directory) = "/Release"; if ( $debug_builds ) { - $build_directory = ""; + $build_directory = ""; } if ( $verbose > 1) { - print "verbose: $verbose\n"; - print "debug_builds: $debug_builds -> $build_directory\n"; - print "simulated: $simulated\n"; + print "verbose: $verbose\n"; + print "debug_builds: $debug_builds -> $build_directory\n"; + print "simulated: $simulated\n"; } my($role1) = "hobbit"; @@ -132,118 +145,228 @@ my($location2) = "bree"; my($location3) = "rivendell"; my($location4) = "rohan"; -my ($rm_endpoint) = "-ORBEndpoint iiop://localhost:2833"; -my ($rm_initref) = "-ORBInitRef ReplicationManager=corbaloc::localhost:2833/ReplicationManager"; +my $rp_manager = PerlACE::TestTarget::create_target (1) || die "Create target 1 failed\n"; +my $rp_manager_controller = PerlACE::TestTarget::create_target (2) || die "Create target 2 failed\n"; +my $ft_replica1 = PerlACE::TestTarget::create_target (3) || die "Create target 3 failed\n"; +my $ft_replica2 = PerlACE::TestTarget::create_target (4) || die "Create target 4 failed\n"; +my $ft_replica3 = PerlACE::TestTarget::create_target (5) || die "Create target 5 failed\n"; +my $ft_creator = PerlACE::TestTarget::create_target (6) || die "Create target 6 failed\n"; +my $client1 = PerlACE::TestTarget::create_target (7) || die "Create target 7 failed\n"; +my $client2 = PerlACE::TestTarget::create_target (8) || die "Create target 8 failed\n"; +my $client3 = PerlACE::TestTarget::create_target (9) || die "Create target 9 failed\n"; + +$hostname = $rp_manager->HostName (); +$port = $rp_manager->RandomPort (); #define temp files -my($rm_ior) = PerlACE::LocalFile ("rm.ior"); -my($factory1_ior) = PerlACE::LocalFile ("factory1.ior"); -my($factory2_ior) = PerlACE::LocalFile ("factory2.ior"); -my($factory3_ior) = PerlACE::LocalFile ("factory3.ior"); -my($replica1_ior) = PerlACE::LocalFile ("${role1}_${location1}_0.ior"); -my($replica2_ior) = PerlACE::LocalFile ("${role1}_${location2}_0.ior"); -my($replica3_ior) = PerlACE::LocalFile ("${role2}_${location2}_1.ior"); -my($replica4_ior) = PerlACE::LocalFile ("${role2}_${location3}_0.ior"); -my($replica5_ior) = PerlACE::LocalFile ("${role1}_${location1}_1.ior"); -my($replica6_ior) = PerlACE::LocalFile ("${role1}_${location2}_2.ior"); - -my($replica1_iogr) = PerlACE::LocalFile ("${role1}_0.iogr"); -my($replica2_iogr) = PerlACE::LocalFile ("${role2}_1.iogr"); -my($replica3_iogr) = PerlACE::LocalFile ("${role1}_2.iogr"); - -my($client_data) = PerlACE::LocalFile ("persistent.dat"); - -#discard junk from previous tests -unlink $rm_ior; -unlink $factory1_ior; -unlink $factory2_ior; -unlink $factory3_ior; -unlink $replica1_ior; -unlink $replica2_ior; -unlink $replica3_ior; -unlink $replica4_ior; -unlink $replica5_ior; -unlink $replica6_ior; -unlink $replica1_iogr; -unlink $replica2_iogr; - -unlink $client_data; +my($rm_ior) = "rm.ior"; -my($status) = 0; +my($factory1_ior) = "factory1.ior"; +my($factory2_ior) = "factory2.ior"; +my($factory3_ior) = "factory3.ior"; + +my($replica1_ior) = "${role1}_${location1}_0.ior"; +my($replica2_ior) = "${role1}_${location2}_0.ior"; +my($replica3_ior) = "${role2}_${location2}_1.ior"; +my($replica4_ior) = "${role2}_${location3}_0.ior"; +my($replica5_ior) = "${role1}_${location1}_1.ior"; +my($replica6_ior) = "${role1}_${location2}_2.ior"; + +my($replica1_iogr) = "${role1}_0.iogr"; +my($replica2_iogr) = "${role2}_1.iogr"; +my($replica3_iogr) = "${role1}_2.iogr"; + +my($client_data) = "persistent.dat"; + +# Files for rp_manager +my $rp_manager_ior = $rp_manager->LocalFile ($rm_ior); +$rp_manager->DeleteFile ($rm_ior); + +# Files for ft_replica1 +my $ft_replica1_factory1_ior = $ft_replica1->LocalFile ($factory1_ior); +my $ft_replica1_client_data = $ft_replica1->LocalFile ($client_data); + +$ft_replica1->DeleteFile ($factory1_ior); +$ft_replica1->DeleteFile ($client_data); + +# Files for ft_replica2 +my $ft_replica2_factory2_ior = $ft_replica2->LocalFile ($factory2_ior); +my $ft_replica2_client_data = $ft_replica2->LocalFile ($client_data); + +$ft_replica2->DeleteFile ($factory2_ior); +$ft_replica2->DeleteFile ($client_data); + + +# Files for ft_replica3 +my $ft_replica3_factory3_ior = $ft_replica3->LocalFile ($factory3_ior); +my $ft_replica3_client_data = $ft_replica3->LocalFile ($client_data); + +$ft_replica3->DeleteFile ($factory3_ior); +$ft_replica3->DeleteFile ($client_data); + + +# Files for ft_creator +my $creator_replica1_ior = $ft_creator->LocalFile ($replica1_ior); +my $creator_replica2_ior = $ft_creator->LocalFile ($replica2_ior); +my $creator_replica3_ior = $ft_creator->LocalFile ($replica3_ior); +my $creator_replica4_ior = $ft_creator->LocalFile ($replica4_ior); +my $creator_replica5_ior = $ft_creator->LocalFile ($replica5_ior); +my $creator_replica6_ior = $ft_creator->LocalFile ($replica6_ior); + +my $creator_replica1_iogr = $ft_creator->LocalFile ($replica1_iogr); +my $creator_replica2_iogr = $ft_creator->LocalFile ($replica2_iogr); +my $creator_replica3_iogr = $ft_creator->LocalFile ($replica3_iogr); + + +$ft_creator->DeleteFile ($replica1_ior); +$ft_creator->DeleteFile ($replica2_ior); +$ft_creator->DeleteFile ($replica3_ior); +$ft_creator->DeleteFile ($replica4_ior); +$ft_creator->DeleteFile ($replica5_ior); +$ft_creator->DeleteFile ($replica6_ior); + +$ft_creator->DeleteFile ($replica1_iogr); +$ft_creator->DeleteFile ($replica2_iogr); +$ft_creator->DeleteFile ($replica3_iogr); + +# Files for client1 +my $client1_replica1_ior = $client1->LocalFile ($replica1_ior); +my $client1_replica2_ior = $client1->LocalFile ($replica2_ior); +my $client1_replica1_iogr = $client1->LocalFile ($replica1_iogr); + +$client1->DeleteFile ($replica1_ior); +$client1->DeleteFile ($replica2_ior); +$client1->DeleteFile ($replica1_iogr); + +# Files for client2 +my $client2_replica3_ior = $client2->LocalFile ($replica3_ior); +my $client2_replica4_ior = $client2->LocalFile ($replica4_ior); +my $client2_replica2_iogr = $client2->LocalFile ($replica2_iogr); + +$client2->DeleteFile ($replica3_ior); +$client2->DeleteFile ($replica4_ior); +$client2->DeleteFile ($replica2_iogr); + +# Files for client3 +my $client3_replica5_ior = $client3->LocalFile ($replica5_ior); +my $client3_replica6_ior = $client3->LocalFile ($replica6_ior); +my $client3_replica3_iogr = $client3->LocalFile ($replica3_iogr); + +$client3->DeleteFile ($replica5_ior); +$client3->DeleteFile ($replica6_ior); +$client3->DeleteFile ($replica3_iogr); + +$RM = $rp_manager->CreateProcess ("$ENV{'TAO_ROOT'}/orbsvcs/FT_ReplicationManager" . + "$build_directory/FT_ReplicationManager", + "-o $rp_manager_ior " . + "-ORBEndpoint iiop://$hostname:$port"); + +$RMC = $rp_manager_controller->CreateProcess (".$build_directory/replmgr_controller" , + "-ORBInitRef ReplicationManager=corbaloc::$hostname:$port/ReplicationManager " . + "-x"); + +$REP1 = $ft_replica1->CreateProcess (".$build_directory/ft_replica" , + "-o $ft_replica1_factory1_ior ". + "-ORBInitRef ReplicationManager=corbaloc::$hostname:$port/ReplicationManager " . + "-l $location1 -i $role1 -q -p $ft_replica1_client_data"); + +$REP2 = $ft_replica2->CreateProcess (".$build_directory/ft_replica" , + "-o $ft_replica2_factory2_ior ". + "-ORBInitRef ReplicationManager=corbaloc::$hostname:$port/ReplicationManager " . + "-l $location2 ". + "-i $role1 -i $role2 -i $role3 -q -u " . + "-p $ft_replica2_client_data"); + +$REP3 = $ft_replica3->CreateProcess (".$build_directory/ft_replica" , + "-o $ft_replica3_factory3_ior ". + "-ORBInitRef ReplicationManager=corbaloc::$hostname:$port/ReplicationManager " . + "-l $location3 -i $role2 -q -u -p $ft_replica1_client_data"); + + +$CTR = $ft_creator->CreateProcess (".$build_directory/ft_create" , + "-ORBInitRef ReplicationManager=corbaloc::$hostname:$port/ReplicationManager " . + "-n -r $role1 -r $role2 -r $role1 -u $role3 -i"); + + + +my($CL1) = $client1->CreateProcess (".$build_directory/ft_client" , + "-f file://$client1_replica1_ior " . + "-f file://$client1_replica2_ior " . + "-c testscript"); + +my($CL2) = $client2->CreateProcess (".$build_directory/ft_client" , + "-f file://$client2_replica3_ior " . + "-f file://$client2_replica4_ior " . + "-c testscript"); + +my($CL3) = $client3->CreateProcess (".$build_directory/ft_client" , + "-f file://$client3_replica5_ior " . + "-f file://$client3_replica6_ior " . + "-c testscript"); -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", "$rm_initref -x"); -my($FAC1) = new PerlACE::Process (".$build_directory/ft_replica", "-o $factory1_ior $rm_initref -l $location1 -i $role1 -q"); -my($FAC2) = new PerlACE::Process (".$build_directory/ft_replica", "-o $factory2_ior $rm_initref -l $location2 -i $role1 -i $role2 -i $role3 -q -u"); -my($FAC3) = new PerlACE::Process (".$build_directory/ft_replica", "-o $factory3_ior $rm_initref -l $location3 -i $role2 -q -u"); -my($CTR) = new PerlACE::Process (".$build_directory/ft_create", "$rm_initref -n -r $role1 -r $role2 -r $role1 -u $role3 -i"); -my($CL1); -my($CL2); -my($CL3); 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"); + print "\nTEST: Preparing Client Mediated Fault Tolerance test.\n" if ($verbose); }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"); - $CL3 = new PerlACE::Process (".$build_directory/ft_client", "-f file://$replica3_iogr -c testscript"); + print "\nTEST: Preparing IOGR based test.\n" if ($verbose); + $CL1->Arguments ("-f file://$client1_replica1_iogr -c testscript"); + $CL2->Arguments ("-f file://$client2_replica2_iogr -c testscript"); + $CL3->Arguments ("-f file://$client3_replica3_iogr -c testscript"); } ####################### -# Start ReplicationManager +# ReplicationManager print "\nTEST: starting ReplicationManager " . $RM->CommandLine . "\n" if ($verbose); $RM->Spawn (); +add_to_kills ($RM); + print "TEST: waiting for registry's IOR\n" if ($verbose); -if (PerlACE::waitforfile_timed ($rm_ior, $PerlACE::wait_interval_for_process_creation) == -1) { - print STDERR "TEST ERROR: cannot find file <$rm_ior>\n"; - $RM->Kill (); $RM->TimedWait (1); - exit 1; -} +if ($rp_manager->WaitForFileTimed ($rm_ior, + $rp_manager->ProcessStartWaitInterval()) == -1) { + print STDERR "ERROR: cannot find file <$rp_manager_ior>\n"; + exit_and_kill (1); +} ################# # Start Factories -print "\nTEST: starting factory 1 " . $FAC1->CommandLine . "\n" if ($verbose); -$FAC1->Spawn (); +print "\nTEST: starting factory 1 " . $REP1->CommandLine . "\n" if ($verbose); +$REP1->Spawn (); + +add_to_kills ($REP1); print "TEST: waiting for factory 1's IOR\n" if ($verbose); -if (PerlACE::waitforfile_timed ($factory1_ior, $PerlACE::wait_interval_for_process_creation) == -1) { - print STDERR "TEST ERROR: cannot find file <$factory1_ior>\n"; - $RM->Kill (); $RM->TimedWait (1); - $FAC1->Kill (); $FAC1->TimedWait (1); - exit 1; +if ($ft_replica1->WaitForFileTimed ($factory1_ior, + $ft_replica1->ProcessStartWaitInterval()) == -1) { + print STDERR "ERROR: cannot find file <$ft_replica1_factory1_ior>\n"; + exit_and_kill (1); } -print "\nTEST: starting factory 2 " . $FAC2->CommandLine . "\n" if ($verbose); -$FAC2->Spawn (); +print "\nTEST: starting factory 2 " . $REP2->CommandLine . "\n" if ($verbose); +$REP2->Spawn (); + +add_to_kills ($REP2); print "TEST: waiting for factory 2's IOR\n" if ($verbose); -if (PerlACE::waitforfile_timed ($factory2_ior, $PerlACE::wait_interval_for_process_creation) == -1) { - print STDERR "TEST ERROR: cannot find file <$factory2_ior>\n"; - $FAC1->Kill (); $FAC1->TimedWait (1); - $RM->Kill (); $RM->TimedWait (1); - $FAC2->Kill (); $FAC2->TimedWait (1); - exit 1; +if ($ft_replica2->WaitForFileTimed ($factory2_ior, + $ft_replica2->ProcessStartWaitInterval()) == -1) { + print STDERR "ERROR: cannot find file <$ft_replica2_factory2_ior>\n"; + exit_and_kill (1); } -print "\nTEST: starting factory 3 " . $FAC3->CommandLine . "\n" if ($verbose); -$FAC3->Spawn (); +print "\nTEST: starting factory 3 " . $REP3->CommandLine . "\n" if ($verbose); +$REP3->Spawn (); + +add_to_kills ($REP3); print "TEST: waiting for factory 3's IOR\n" if ($verbose); -if (PerlACE::waitforfile_timed ($factory3_ior, $PerlACE::wait_interval_for_process_creation) == -1) { - print STDERR "TEST ERROR: cannot find file <$factory3_ior>\n"; - $FAC1->Kill (); $FAC1->TimedWait (1); - $FAC2->Kill (); $FAC2->TimedWait (1); - $RM->Kill (); $RM->TimedWait (1); - $FAC3->Kill (); $FAC3->TimedWait (1); - exit 1; +if ($ft_replica3->WaitForFileTimed ($factory3_ior, + $ft_replica3->ProcessStartWaitInterval()) == -1) { + print STDERR "ERROR: cannot find file <$ft_replica3_factory3_ior>\n"; + exit_and_kill (1); } ###################### @@ -252,134 +375,215 @@ if (PerlACE::waitforfile_timed ($factory3_ior, $PerlACE::wait_interval_for_proce print "\nTEST: starting object group creator " . $CTR->CommandLine . "\n" if ($verbose); $CTR->Spawn (); +add_to_kills ($CTR); + print "TEST: waiting for Replica IOR files from object group creator\n" if ($verbose); -if (PerlACE::waitforfile_timed ($replica1_ior, $PerlACE::wait_interval_for_process_creation) == -1){ - print STDERR "TEST ERROR: cannot find file <$replica1_ior>\n"; - $status = 1; + +if ($ft_creator->WaitForFileTimed ($replica1_ior, + $ft_creator->ProcessStartWaitInterval()) == -1) { + print STDERR "ERROR: cannot find file <$ft_creator_replica1_ior>\n"; + exit_and_kill (1); } -elsif (PerlACE::waitforfile_timed ($replica2_ior, $PerlACE::wait_interval_for_process_creation) == -1){ - print STDERR "TEST ERROR: cannot find file <$replica2_ior> \n"; - $status = 1; + +if ($ft_creator->WaitForFileTimed ($replica2_ior, + $ft_creator->ProcessStartWaitInterval()) == -1) { + print STDERR "ERROR: cannot find file <$ft_creator_replica2_ior>\n"; + exit_and_kill (1); } -elsif (PerlACE::waitforfile_timed ($replica3_ior, $PerlACE::wait_interval_for_process_creation) == -1){ - print STDERR "TEST ERROR: cannot find file <$replica3_ior> \n"; - $status = 1; + +if ($ft_creator->WaitForFileTimed ($replica3_ior, + $ft_creator->ProcessStartWaitInterval()) == -1) { + print STDERR "ERROR: cannot find file <$ft_creator_replica3_ior>\n"; + exit_and_kill (1); } -elsif (PerlACE::waitforfile_timed ($replica4_ior, $PerlACE::wait_interval_for_process_creation) == -1){ - print STDERR "TEST ERROR: cannot find file <$replica4_ior> \n"; - $status = 1; + +if ($ft_creator->WaitForFileTimed ($replica4_ior, + $ft_creator->ProcessStartWaitInterval()) == -1) { + print STDERR "ERROR: cannot find file <$ft_creator_replica4_ior>\n"; + exit_and_kill (1); } -elsif (PerlACE::waitforfile_timed ($replica5_ior, $PerlACE::wait_interval_for_process_creation) == -1){ - print STDERR "TEST ERROR: cannot find file <$replica5_ior> \n"; - $status = 1; + +if ($ft_creator->WaitForFileTimed ($replica5_ior, + $ft_creator->ProcessStartWaitInterval()) == -1) { + print STDERR "ERROR: cannot find file <$ft_creator_replica5_ior>\n"; + exit_and_kill (1); } -elsif (PerlACE::waitforfile_timed ($replica6_ior, $PerlACE::wait_interval_for_process_creation) == -1){ - print STDERR "TEST ERROR: cannot find file <$replica6_ior> \n"; - $status = 1; + +if ($ft_creator->WaitForFileTimed ($replica6_ior, + $ft_creator->ProcessStartWaitInterval()) == -1) { + print STDERR "ERROR: cannot find file <$ft_creator_replica6_ior>\n"; + exit_and_kill (1); } -if($status != 0){ - $FAC3->Kill (); $FAC3->TimedWait (1); - $FAC2->Kill (); $FAC2->TimedWait (1); - $FAC1->Kill (); $FAC1->TimedWait (1); - $RM->Kill (); $RM->TimedWait (1); - $CTR->Kill (); $CTR->TimedWait(1); - exit 1; +# Get/Put files: +# replica1_ior: client1 +if ($ft_creator->GetFile ($replica1_ior) == -1) { + print STDERR "ERROR: cannot retrieve file <$ft_creator_replica1_ior\n"; + exit_and_kill (1); +} +if ($client1->PutFile ($replica1_ior) == -1) { + print STDERR "ERROR: cannot set file <$client1_replica1_ior>\n"; + exit_and_kill (1); +} +# replica2_ior: client1 +if ($ft_creator->GetFile ($replica2_ior) == -1) { + print STDERR "ERROR: cannot retrieve file <$ft_creator_replica2_ior\n"; + exit_and_kill (1); +} +if ($client1->PutFile ($replica2_ior) == -1) { + print STDERR "ERROR: cannot set file <$client1_replica2_ior>\n"; + exit_and_kill (1); +} +# replica3_ior: client2 +if ($ft_creator->GetFile ($replica3_ior) == -1) { + print STDERR "ERROR: cannot retrieve file <$ft_creator_replica3_ior\n"; + exit_and_kill (1); +} +if ($client2->PutFile ($replica3_ior) == -1) { + print STDERR "ERROR: cannot set file <$client2_replica3_ior>\n"; + exit_and_kill (1); +} +# replica4_ior: client2 +if ($ft_creator->GetFile ($replica4_ior) == -1) { + print STDERR "ERROR: cannot retrieve file <$ft_creator_replica4_ior\n"; + exit_and_kill (1); +} +if ($client2->PutFile ($replica4_ior) == -1) { + print STDERR "ERROR: cannot set file <$client2_replica4_ior>\n"; + exit_and_kill (1); +} +# replica5_ior: client3 +if ($ft_creator->GetFile ($replica5_ior) == -1) { + print STDERR "ERROR: cannot retrieve file <$ft_creator_replica5_ior\n"; + exit_and_kill (1); +} +if ($client3->PutFile ($replica5_ior) == -1) { + print STDERR "ERROR: cannot set file <$client3_replica5_ior>\n"; + exit_and_kill (1); +} +# replica6_ior: client3 +if ($ft_creator->GetFile ($replica6_ior) == -1) { + print STDERR "ERROR: cannot retrieve file <$ft_creator_replica6_ior\n"; + exit_and_kill (1); +} +if ($client3->PutFile ($replica6_ior) == -1) { + print STDERR "ERROR: cannot set file <$client3_replica6_ior>\n"; + exit_and_kill (1); } print "\nTEST: wait for object group creator.\n" if ($verbose); -$config = $CTR->WaitKill (5); -if ($config != 0) { - print STDERR "TEST ERROR: configuration manager returned $config\n"; - $FAC3->Kill (); $FAC3->TimedWait (1); - $FAC2->Kill (); $FAC2->TimedWait (1); - $FAC1->Kill (); $FAC1->TimedWait (1); - $RM->Kill (); $RM->TimedWait (1); - exit 1; -} +$status_creator = $CTR->WaitKill ($ft_creator->ProcessStopWaitInterval()); +if ($status_creator != 0) { + print STDERR "TEST ERROR: configuration manager returned $status_creator\n"; + exit_and_kill(1); +} ############# # Run clients print "\nTEST: starting client " . $CL1->CommandLine . "\n" if ($verbose); -$client = $CL1->SpawnWaitKill (60); - -if ($client != 0) { - print STDERR "TEST ERROR: client returned $client\n"; - $status = 1; +$status_client = $CL1->SpawnWaitKill ($client1->ProcessStartWaitInterval() + 45); +if ($status_client != 0) { + print STDERR "TEST ERROR: client returned $status_client\n"; + exit_and_kill(1); } print "\nTEST: starting client again " . $CL2->CommandLine . "\n" if ($verbose); -$client2 = $CL2->SpawnWaitKill (60); -if ($client2 != 0) { - print STDERR "TEST ERROR: client returned $client2\n"; - $status = 1; +$status_client = $CL2->SpawnWaitKill ($client2->ProcessStartWaitInterval() + 45); +if ($status_client != 0) { + print STDERR "TEST ERROR: client returned $status_client\n"; + exit_and_kill(1); } print "\nTEST: starting client, one more time with feeling " . $CL3->CommandLine . "\n" if ($verbose); -$client3 = $CL3->SpawnWaitKill (60); - -if ($client3 != 0) { - print STDERR "TEST ERROR: client returned $client3\n"; - $status = 1; +$status_client = $CL3->SpawnWaitKill ($client3->ProcessStartWaitInterval() + 45); +if ($status_client != 0) { + print STDERR "TEST ERROR: client returned $status_client\n"; + exit_and_kill(1); } ###################### # Clean house and exit print "\nTEST: wait for factory 1.\n" if ($verbose); -$factory1 = $FAC1->WaitKill (30); -if ($factory1 != 0) { - print STDERR "TEST ERROR: replica returned $factory 1\n"; - $status = 1; -} +$status_replica = $REP1->WaitKill ($ft_replica1->ProcessStopWaitInterval() + 15); +if ($status_replica != 0) { + print STDERR "TEST ERROR: replica returned $status_replica\n"; + exit_and_kill(1); +} print "\nTEST: wait for factory 2.\n" if ($verbose); -$factory2 = $FAC2->WaitKill (30); -if ($factory2 != 0) { - print STDERR "TEST ERROR: factory 2 returned $factory2\n"; - $status = 1; +$status_replica = $REP2->WaitKill ($ft_replica2->ProcessStopWaitInterval() + 15); +if ($status_replica != 0) { + print STDERR "TEST ERROR: replica returned $status_replica\n"; + exit_and_kill(1); } print "\nTEST: wait for factory 3.\n" if ($verbose); -$factory3 = $FAC3->WaitKill (30); -if ($factory3 != 0) { - print STDERR "TEST ERROR: factory 3 returned $factory3\n"; - $status = 1; +$status_replica = $REP3->WaitKill ($ft_replica3->ProcessStopWaitInterval() + 15); +if ($status_replica != 0) { + print STDERR "TEST ERROR: replica returned $status_replica\n"; + exit_and_kill(1); } 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_controller = $RMC->SpawnWaitKill ($rp_manager_controller->ProcessStartWaitInterval() + 285); +if ($status_controller != 0) { + print STDERR "TEST ERROR: replication manager controller returned $status_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_repmgr = $RM->WaitKill ($rp_manager->ProcessStopWaitInterval() + 15); +if ($status_repmgr != 0) { + print STDERR "TEST ERROR: ReplicationManager returned $status_repmgr\n"; $status = 1; } print "\nTEST: releasing scratch files.\n" if ($verbose); -unlink $rm_ior; -unlink $factory1_ior; -unlink $factory2_ior; -unlink $factory3_ior; -unlink $replica1_ior; -unlink $replica2_ior; -unlink $replica3_ior; -unlink $replica4_ior; -unlink $replica5_ior; -unlink $replica6_ior; -unlink $replica1_iogr; -unlink $replica2_iogr; - -unlink $client_data; +# Files for rp_manager +$rp_manager->DeleteFile ($rm_ior); + +# Files for ft_replica1 +$ft_replica1->DeleteFile ($factory1_ior); +$ft_replica1->DeleteFile ($client_data); + +# Files for ft_replica2 +$ft_replica2->DeleteFile ($factory2_ior); +$ft_replica2->DeleteFile ($client_data); + +# Files for ft_replica3 +$ft_replica3->DeleteFile ($factory3_ior); +$ft_replica3->DeleteFile ($client_data); + +# Files for ft_creator +$ft_creator->DeleteFile ($replica1_ior); +$ft_creator->DeleteFile ($replica2_ior); +$ft_creator->DeleteFile ($replica3_ior); +$ft_creator->DeleteFile ($replica4_ior); +$ft_creator->DeleteFile ($replica5_ior); +$ft_creator->DeleteFile ($replica6_ior); + +$ft_creator->DeleteFile ($replica1_iogr); +$ft_creator->DeleteFile ($replica2_iogr); +$ft_creator->DeleteFile ($replica3_iogr); + +# Files for client1 +$client1->DeleteFile ($replica1_ior); +$client1->DeleteFile ($replica2_ior); +$client1->DeleteFile ($replica1_iogr); + +# Files for client2 +$client2->DeleteFile ($replica3_ior); +$client2->DeleteFile ($replica4_ior); +$client2->DeleteFile ($replica2_iogr); + +# Files for client3 +$client3->DeleteFile ($replica5_ior); +$client3->DeleteFile ($replica6_ior); +$client3->DeleteFile ($replica3_iogr); exit $status; |