diff options
Diffstat (limited to 'TAO/orbsvcs/examples/RtEC')
-rwxr-xr-x | TAO/orbsvcs/examples/RtEC/IIOPGateway/consumerec_crash.pl | 260 | ||||
-rwxr-xr-x | TAO/orbsvcs/examples/RtEC/IIOPGateway/run_test.pl | 228 | ||||
-rwxr-xr-x | TAO/orbsvcs/examples/RtEC/Simple/run_test.pl | 126 |
3 files changed, 437 insertions, 177 deletions
diff --git a/TAO/orbsvcs/examples/RtEC/IIOPGateway/consumerec_crash.pl b/TAO/orbsvcs/examples/RtEC/IIOPGateway/consumerec_crash.pl index cc5e25194a4..a34cba2cb9e 100755 --- a/TAO/orbsvcs/examples/RtEC/IIOPGateway/consumerec_crash.pl +++ b/TAO/orbsvcs/examples/RtEC/IIOPGateway/consumerec_crash.pl @@ -6,145 +6,253 @@ eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' # -*- perl -*- use lib "$ENV{ACE_ROOT}/bin"; -use PerlACE::Run_Test; +use PerlACE::TestTarget; $status = 0; +$debug_level = '0'; -$ns_ior = PerlACE::LocalFile ("ns.ior"); -$conffile = PerlACE::LocalFile ("ec" . "$PerlACE::svcconf_ext"); -$gatewayconffile = PerlACE::LocalFile ("gateway" . "$PerlACE::svcconf_ext"); - -unlink $ns_ior; - -$NS = new PerlACE::Process ("../../../Naming_Service/Naming_Service", - "-o $ns_ior"); - -$T1 = new PerlACE::Process ("EC", - "-ORBInitRef NameService=file://$ns_ior " - . "-ORBsvcconf $conffile " -# . "-ORBDebug -ORBDebugLevel 10 -ORBLogFile supplierec.log " - . "-e channel1 "); - -$T2 = new PerlACE::Process ("EC", - "-ORBInitRef NameService=file://$ns_ior -ORBEndpoint iiop://localhost:6000 " - . "-ORBsvcconf $conffile " -# . "-ORBDebug -ORBDebugLevel 10 -ORBLogFile consumerec.log " - . "-e channel2 "); +foreach $i (@ARGV) { + if ($i eq '-debug') { + $debug_level = '10'; + } +} -$G = new PerlACE::Process ("Gateway", - "-ORBInitRef NameService=file://$ns_ior " - . "-ORBSvcconf $gatewayconffile " - . "-c channel2 " -# . "-ORBDebug -ORBDebugLevel 10 -ORBLogFile gateway.log " - . "-s channel1 "); +my $ns = PerlACE::TestTarget::create_target (1) || die "Create target 1 failed\n"; +my $t1 = PerlACE::TestTarget::create_target (2) || die "Create target 2 failed\n"; +my $t2 = PerlACE::TestTarget::create_target (3) || die "Create target 3 failed\n"; +my $g = PerlACE::TestTarget::create_target (4) || die "Create target 4 failed\n"; +my $c = PerlACE::TestTarget::create_target (5) || die "Create target 5 failed\n"; +my $s = PerlACE::TestTarget::create_target (6) || die "Create target 6 failed\n"; + +$nsiorfile = "ns.ior"; +$conffile = "ec" . "$PerlACE::svcconf_ext"; +$gconffile = "gateway" . "$PerlACE::svcconf_ext"; + +my $ns_nsiorfile = $ns->LocalFile ($nsiorfile); +my $t1_nsiorfile = $t1->LocalFile ($nsiorfile); +my $t2_nsiorfile = $t2->LocalFile ($nsiorfile); +my $g_nsiorfile = $g->LocalFile ($nsiorfile); +my $c_nsiorfile = $c->LocalFile ($nsiorfile); +my $s_nsiorfile = $s->LocalFile ($nsiorfile); +my $t1_conffile = $t1->LocalFile ($conffile); +my $t2_conffile = $t2->LocalFile ($conffile); +my $g_gconffile = $g->LocalFile ($gconffile); +$ns->DeleteFile ($nsiorfile); +$t1->DeleteFile ($nsiorfile); +$t2->DeleteFile ($nsiorfile); +$g->DeleteFile ($nsiorfile); +$c->DeleteFile ($nsiorfile); +$s->DeleteFile ($nsiorfile); + +$NS = $ns->CreateProcess ("$ENV{TAO_ROOT}/orbsvcs/Naming_Service/Naming_Service", + " -o $ns_nsiorfile"); + +$T1 = $t1->CreateProcess ("EC", + " -ORBInitRef NameService=file://$t1_nsiorfile ". + "-ORBsvcconf $t1_conffile ". + "-e channel1"); + +$T2 = $t2->CreateProcess ("EC", + " -ORBInitRef NameService=file://$t2_nsiorfile ". + "-ORBsvcconf $t2_conffile ". + "-e channel2"); + +$G = $g->CreateProcess ("Gateway", + " -ORBInitRef NameService=file://$g_nsiorfile ". + "-ORBSvcconf $g_gconffile ". + "-c channel2 ". + "-s channel1"); + +$C = $c->CreateProcess ("Consumer", + " -ORBInitRef NameService=file://$c_nsiorfile ". + "-ORBDebugLevel $debug_level ". + "-e channel2"); + +$S = $s->CreateProcess ("Supplier", + " -ORBInitRef NameService=file://$s_nsiorfile ". + "-e channel1"); -$C = new PerlACE::Process ("Consumer", - "-ORBInitRef NameService=file://$ns_ior " -# . "-ORBDebug -ORBDebugLevel 10 -ORBLogFile consumer.log " - . "-e channel2 "); +print STDOUT "Starting name server\n"; +$NS_status = $NS->Spawn (); -$S = new PerlACE::Process ("Supplier", - "-ORBInitRef NameService=file://$ns_ior " -# . "-ORBDebug -ORBDebugLevel 10 -ORBLogFile supplier.log " - . "-e channel1 "); +if ($NS_status != 0) { + print STDERR "ERROR: Name Service returned $NS_status\n"; + exit 1; +} -print STDOUT "Starting name server\n"; -$NS->Spawn (); +if ($ns->WaitForFileTimed ($nsiorfile,$ns->ProcessStartWaitInterval()) == -1) { + print STDERR "ERROR: cannot find file <$ns_nsiorfile>\n"; + $NS->Kill (); $NS->TimedWait (1); + exit 1; +} -if (PerlACE::waitforfile_timed ($ns_ior, $PerlACE::wait_interval_for_process_creation) == -1) { - print STDERR "ERROR: cannot find file <$ns_ior>\n"; - $NS->Kill (); +if ($ns->GetFile ($nsiorfile) == -1) { + print STDERR "ERROR: cannot retrieve file <$ns_nsiorfile>\n"; + $NS->Kill (); $NS->TimedWait (1); + exit 1; +} +if ($t1->PutFile ($nsiorfile) == -1) { + print STDERR "ERROR: cannot set file <$t1_nsiorfile>\n"; + $NS->Kill (); $NS->TimedWait (1); + exit 1; +} +if ($t2->PutFile ($nsiorfile) == -1) { + print STDERR "ERROR: cannot set file <$t2_nsiorfile>\n"; + $NS->Kill (); $NS->TimedWait (1); + exit 1; +} +if ($g->PutFile ($nsiorfile) == -1) { + print STDERR "ERROR: cannot set file <$g_nsiorfile>\n"; + $NS->Kill (); $NS->TimedWait (1); + exit 1; +} +if ($c->PutFile ($nsiorfile) == -1) { + print STDERR "ERROR: cannot set file <$c_nsiorfile>\n"; + $NS->Kill (); $NS->TimedWait (1); + exit 1; +} +if ($s->PutFile ($nsiorfile) == -1) { + print STDERR "ERROR: cannot set file <$s_nsiorfile>\n"; + $NS->Kill (); $NS->TimedWait (1); exit 1; } print STDOUT "Starting event channel 1\n"; -$T1->Spawn (); +$T1_status = $T1->Spawn (); + +if ($T1_status != 0) { + print STDERR "ERROR: T1 returned $T1_status\n"; + exit 1; +} sleep 2; print STDOUT "Starting event channel 2\n"; -$T2->Spawn (); +$T2_status = $T2->Spawn (); + +if ($T2_status != 0) { + print STDERR "ERROR: T2 returned $T2_status\n"; + exit 1; +} sleep 2; print STDOUT "Starting gateway\n"; -$G->Spawn (); +$G_status = $G->Spawn (); + +if ($G_status != 0) { + print STDERR "ERROR: Gateway returned $G_status\n"; + exit 1; +} sleep 2; print STDOUT "Starting consumer\n"; -$C->Spawn (); +$C_status = $C->Spawn (); + +if ($C_status != 0) { + print STDERR "ERROR: Consumer returned $C_status\n"; + exit 1; +} sleep 1; print STDOUT "Starting supplier\n"; -#$supplier = $S->SpawnWaitKill (12000); -$S->Spawn(); +$S_status = $S->Spawn (); + +if ($S_status != 0) { + print STDERR "ERROR: Supplier returned $S_status\n"; + exit 1; +} sleep 1; + if ($supplier != 0) { print STDERR "ERROR: supplier returned $supplier\n"; $status = 1; } -#$consumer = $C->WaitKill (10); -# -#if ($consumer != 0) { -# print STDERR "ERROR: consumer returned $consumer\n"; -# $status = 1; -#} - print STDOUT "Terminating event channel 2 and consumer in 10 seconds...\n"; -#$service = $T2->TerminateWaitKill (5); -$service = $T2->WaitKill (10); -$C->Kill(); - -if ($service != 0) { - print STDERR "ERROR: service returned $service\n"; +$T2_status = $T2->WaitKill ($t2->ProcessStopWaitInterval()); +if ($T2_status != 0) { + print STDERR "ERROR: service returned $T2_status\n"; $status = 1; } +$C->Kill(); sleep 10; print STDOUT "Starting event channel 2 again...\n"; -$T2->Spawn (); +$T2_status = $T2->Spawn (); + +if ($T2_status != 0) { + print STDERR "ERROR: T2 returned $T2_status\n"; + exit 1; +} sleep 2; print STDOUT "Starting consumer again...\n"; -$C->Spawn (); +$C_status = $C->Spawn (); -#$supplier = $C->WaitKill (15); -# -#if ($supplier != 0) { -# print STDERR "ERROR: supplier returned $supplier\n"; -# $status = 1; -#} +if ($C_status != 0) { + print STDERR "ERROR: Consumer returned $C_status\n"; + exit 1; +} print STDOUT "1500 seconds before termination...\n"; sleep 1500; print STDOUT "Terminating supplier...\n"; -$S->TerminateWaitKill (5); +$S_status = $S->WaitKill ($s->ProcessStopWaitInterval()); +if ($S_status != 0) { + print STDERR "ERROR: Supplier returned $S_status\n"; + $status = 1; +} print STDOUT "Terminating consumer...\n"; -$C->TerminateWaitKill (5); +$C_status = $C->WaitKill ($c->ProcessStopWaitInterval()); +if ($C_status != 0) { + print STDERR "ERROR: Consumer returned $C_status\n"; + $status = 1; +} print STDOUT "Terminating gateway...\n"; -$G->TerminateWaitKill (5); +$G_status = $G->TerminateWaitKill ($g->ProcessStopWaitInterval()); + +if ($G_status != 0) { + print STDERR "ERROR: Gateway returned $G_status\n"; + $status = 1; +} print STDOUT "Terminating event channels...\n"; -$T1->TerminateWaitKill (5); -$T2->TerminateWaitKill (5); +$T1_status = $T1->TerminateWaitKill ($t1->ProcessStopWaitInterval()); + +if ($T1_status != 0) { + print STDERR "ERROR: service returned $T1_status\n"; + $status = 1; +} + +$T2_status = $T2->TerminateWaitKill ($t2->ProcessStopWaitInterval()); + +if ($T2_status != 0) { + print STDERR "ERROR: service returned $T2_status\n"; + $status = 1; +} -$nserver = $NS->TerminateWaitKill (5); +$NS_status = $NS->TerminateWaitKill ($ns->ProcessStopWaitInterval()); -if ($nserver != 0) { - print STDERR "ERROR: name server returned $nserver\n"; +if ($NS_status != 0) { + print STDERR "ERROR: Name Service returned $NS_status\n"; $status = 1; } -unlink $ns_ior; +$ns->DeleteFile ($nsiorfile); +$t1->DeleteFile ($nsiorfile); +$t2->DeleteFile ($nsiorfile); +$g->DeleteFile ($nsiorfile); +$c->DeleteFile ($nsiorfile); +$s->DeleteFile ($nsiorfile); exit $status; diff --git a/TAO/orbsvcs/examples/RtEC/IIOPGateway/run_test.pl b/TAO/orbsvcs/examples/RtEC/IIOPGateway/run_test.pl index 8bef21e4f6c..4a6868692c2 100755 --- a/TAO/orbsvcs/examples/RtEC/IIOPGateway/run_test.pl +++ b/TAO/orbsvcs/examples/RtEC/IIOPGateway/run_test.pl @@ -6,119 +6,215 @@ eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' # -*- perl -*- use lib "$ENV{ACE_ROOT}/bin"; -use PerlACE::Run_Test; +use PerlACE::TestTarget; $status = 0; +$debug_level = '0'; -$ns_ior = PerlACE::LocalFile ("ns.ior"); -$conffile = PerlACE::LocalFile ("ec" . "$PerlACE::svcconf_ext"); -$gatewayconffile = PerlACE::LocalFile ("gateway" . "$PerlACE::svcconf_ext"); - -unlink $ns_ior; - -$NS = new PerlACE::Process ("../../../Naming_Service/Naming_Service", - "-o $ns_ior "); - -$T1 = new PerlACE::Process ("EC", - "-ORBInitRef NameService=file://$ns_ior " -# . "-ORBDebug -ORBDebugLevel 10 -ORBLogFile supplierec.log " - . "-ORBsvcconf $conffile " - . "-e channel1 "); - -$T2 = new PerlACE::Process ("EC", - "-ORBInitRef NameService=file://$ns_ior " -# . "-ORBDebug -ORBDebugLevel 10 -ORBLogFile consumerec.log " - . "-ORBsvcconf $conffile " - . "-e channel2 "); +foreach $i (@ARGV) { + if ($i eq '-debug') { + $debug_level = '10'; + } +} -$G = new PerlACE::Process ("Gateway", - "-ORBInitRef NameService=file://$ns_ior " -# . "-ORBDebug -ORBDebugLevel 10 -ORBLogFile gateway.log " - . "-ORBSvcconf $gatewayconffile " - . "-c channel2 " - . "-s channel1 "); +my $ns = PerlACE::TestTarget::create_target (1) || die "Create target 1 failed\n"; +my $t1 = PerlACE::TestTarget::create_target (2) || die "Create target 2 failed\n"; +my $t2 = PerlACE::TestTarget::create_target (3) || die "Create target 3 failed\n"; +my $g = PerlACE::TestTarget::create_target (4) || die "Create target 4 failed\n"; +my $c = PerlACE::TestTarget::create_target (5) || die "Create target 5 failed\n"; +my $s = PerlACE::TestTarget::create_target (6) || die "Create target 6 failed\n"; + +$nsiorfile = "ns.ior"; +$conffile = "ec" . "$PerlACE::svcconf_ext"; +$gconffile = "gateway" . "$PerlACE::svcconf_ext"; + +my $ns_nsiorfile = $ns->LocalFile ($nsiorfile); +my $t1_nsiorfile = $t1->LocalFile ($nsiorfile); +my $t2_nsiorfile = $t2->LocalFile ($nsiorfile); +my $g_nsiorfile = $g->LocalFile ($nsiorfile); +my $c_nsiorfile = $c->LocalFile ($nsiorfile); +my $s_nsiorfile = $s->LocalFile ($nsiorfile); +my $t1_conffile = $t1->LocalFile ($conffile); +my $t2_conffile = $t2->LocalFile ($conffile); +my $g_gconffile = $g->LocalFile ($gconffile); +$ns->DeleteFile ($nsiorfile); +$t1->DeleteFile ($nsiorfile); +$t2->DeleteFile ($nsiorfile); +$g->DeleteFile ($nsiorfile); +$c->DeleteFile ($nsiorfile); +$s->DeleteFile ($nsiorfile); + +$NS = $ns->CreateProcess ("$ENV{TAO_ROOT}/orbsvcs/Naming_Service/Naming_Service", + " -o $ns_nsiorfile"); + +$T1 = $t1->CreateProcess ("EC", + " -ORBInitRef NameService=file://$t1_nsiorfile ". + "-ORBsvcconf $t1_conffile ". + "-e channel1"); + +$T2 = $t2->CreateProcess ("EC", + " -ORBInitRef NameService=file://$t2_nsiorfile ". + "-ORBsvcconf $t2_conffile ". + "-e channel2"); + +$G = $g->CreateProcess ("Gateway", + " -ORBInitRef NameService=file://$g_nsiorfile ". + "-ORBSvcconf $g_gconffile ". + "-c channel2 ". + "-s channel1"); + +$C = $c->CreateProcess ("Consumer", + " -ORBInitRef NameService=file://$c_nsiorfile ". + "-ORBDebugLevel $debug_level ". + "-e channel2"); + +$S = $s->CreateProcess ("Supplier", + " -ORBInitRef NameService=file://$s_nsiorfile ". + "-e channel1"); -$C = new PerlACE::Process ("Consumer", - "-ORBInitRef NameService=file://$ns_ior " -# . "-ORBDebug -ORBDebugLevel 10 -ORBLogFile consumer.log " - . "-e channel2 "); +print STDOUT "Starting name server\n"; +$NS_status = $NS->Spawn (); -$S = new PerlACE::Process ("Supplier", - "-ORBInitRef NameService=file://$ns_ior " -# . "-ORBDebug -ORBDebugLevel 10 -ORBLogFile supplier.log " - . "-e channel1 "); +if ($NS_status != 0) { + print STDERR "ERROR: Name Service returned $NS_status\n"; + exit 1; +} -print STDOUT "Starting name server\n"; -$NS->Spawn (); +if ($ns->WaitForFileTimed ($nsiorfile,$ns->ProcessStartWaitInterval()) == -1) { + print STDERR "ERROR: cannot find file <$ns_nsiorfile>\n"; + $NS->Kill (); $NS->TimedWait (1); + exit 1; +} -if (PerlACE::waitforfile_timed ($ns_ior, $PerlACE::wait_interval_for_process_creation) == -1) { - print STDERR "ERROR: cannot find file <$ns_ior>\n"; - $NS->Kill (); +if ($ns->GetFile ($nsiorfile) == -1) { + print STDERR "ERROR: cannot retrieve file <$ns_nsiorfile>\n"; + $NS->Kill (); $NS->TimedWait (1); + exit 1; +} +if ($t1->PutFile ($nsiorfile) == -1) { + print STDERR "ERROR: cannot set file <$t1_nsiorfile>\n"; + $NS->Kill (); $NS->TimedWait (1); + exit 1; +} +if ($t2->PutFile ($nsiorfile) == -1) { + print STDERR "ERROR: cannot set file <$t2_nsiorfile>\n"; + $NS->Kill (); $NS->TimedWait (1); + exit 1; +} +if ($g->PutFile ($nsiorfile) == -1) { + print STDERR "ERROR: cannot set file <$g_nsiorfile>\n"; + $NS->Kill (); $NS->TimedWait (1); + exit 1; +} +if ($c->PutFile ($nsiorfile) == -1) { + print STDERR "ERROR: cannot set file <$c_nsiorfile>\n"; + $NS->Kill (); $NS->TimedWait (1); + exit 1; +} +if ($s->PutFile ($nsiorfile) == -1) { + print STDERR "ERROR: cannot set file <$s_nsiorfile>\n"; + $NS->Kill (); $NS->TimedWait (1); exit 1; } print STDOUT "Starting event channel 1\n"; -$T1->Spawn (); +$T1_status = $T1->Spawn (); + +if ($T1_status != 0) { + print STDERR "ERROR: T1 returned $T1_status\n"; + exit 1; +} sleep 2; print STDOUT "Starting event channel 2\n"; -$T2->Spawn (); +$T2_status = $T2->Spawn (); + +if ($T2_status != 0) { + print STDERR "ERROR: T2 returned $T2_status\n"; + exit 1; +} sleep 2; print STDOUT "Starting gateway\n"; -$G->Spawn (); +$G_status = $G->Spawn (); + +if ($G_status != 0) { + print STDERR "ERROR: Gateway returned $G_status\n"; + exit 1; +} sleep 2; print STDOUT "Starting consumer\n"; -$C->Spawn (); +$C_status = $C->Spawn (); + +if ($C_status != 0) { + print STDERR "ERROR: Consumer returned $C_status\n"; + exit 1; +} sleep 1; print STDOUT "Starting supplier\n"; -#$supplier = $S->SpawnWaitKill (12000); -$S->Spawn(); +$S_status = $S->Spawn (); + +if ($S_status != 0) { + print STDERR "ERROR: Supplier returned $S_status\n"; + exit 1; +} sleep 1; -if ($supplier != 0) { - print STDERR "ERROR: supplier returned $supplier\n"; +$C_status = $C->WaitKill ($c->ProcessStopWaitInterval()); +if ($C_status != 0) { + print STDERR "ERROR: Consumer returned $C_status\n"; $status = 1; } -$consumer = $C->WaitKill (10); +$T2_status = $T2->TerminateWaitKill ($t2->ProcessStopWaitInterval()); -if ($consumer != 0) { - print STDERR "ERROR: consumer returned $consumer\n"; +if ($T2_status != 0) { + print STDERR "ERROR: service returned $T2_status\n"; $status = 1; } -$service = $T2->TerminateWaitKill (5); +print STDOUT "15 seconds before termination...\n"; +sleep 15; -if ($service != 0) { - print STDERR "ERROR: service returned $service\n"; +$S_status = $S->WaitKill ($s->ProcessStopWaitInterval()); +if ($S_status != 0) { + print STDERR "ERROR: Supplier returned $S_status\n"; $status = 1; } -#$supplier = $C->WaitKill (15); -# -#if ($supplier != 0) { -# print STDERR "ERROR: supplier returned $supplier\n"; -# $status = 1; -#} +$T1_status = $T1->TerminateWaitKill ($t1->ProcessStopWaitInterval()); -print STDOUT "15 seconds before termination...\n"; -sleep 15; +if ($T1_status != 0) { + print STDERR "ERROR: service returned $T1_status\n"; + $status = 1; +} + +$G_status = $G->TerminateWaitKill ($g->ProcessStopWaitInterval()); + +if ($G_status != 0) { + print STDERR "ERROR: Gateway returned $G_status\n"; + $status = 1; +} -$nserver = $NS->TerminateWaitKill (5); +$NS_status = $NS->TerminateWaitKill ($ns->ProcessStopWaitInterval()); -if ($nserver != 0) { - print STDERR "ERROR: name server returned $nserver\n"; +if ($NS_status != 0) { + print STDERR "ERROR: Name Service returned $NS_status\n"; $status = 1; } -unlink $ns_ior; +$ns->DeleteFile ($nsiorfile); +$t1->DeleteFile ($nsiorfile); +$t2->DeleteFile ($nsiorfile); +$g->DeleteFile ($nsiorfile); +$c->DeleteFile ($nsiorfile); +$s->DeleteFile ($nsiorfile); exit $status; diff --git a/TAO/orbsvcs/examples/RtEC/Simple/run_test.pl b/TAO/orbsvcs/examples/RtEC/Simple/run_test.pl index 76e90d89f72..c481f933413 100755 --- a/TAO/orbsvcs/examples/RtEC/Simple/run_test.pl +++ b/TAO/orbsvcs/examples/RtEC/Simple/run_test.pl @@ -6,78 +6,134 @@ eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' # -*- perl -*- use lib "$ENV{ACE_ROOT}/bin"; -use PerlACE::Run_Test; +use PerlACE::TestTarget; $status = 0; +$debug_level = '0'; -$ns_ior = PerlACE::LocalFile ("ns.ior"); -$conffile = PerlACE::LocalFile ("ec" . "$PerlACE::svcconf_ext"); +foreach $i (@ARGV) { + if ($i eq '-debug') { + $debug_level = '10'; + } +} + +my $ns = PerlACE::TestTarget::create_target (1) || die "Create target 1 failed\n"; +my $t = PerlACE::TestTarget::create_target (2) || die "Create target 2 failed\n"; +my $c = PerlACE::TestTarget::create_target (3) || die "Create target 3 failed\n"; +my $s = PerlACE::TestTarget::create_target (4) || die "Create target 4 failed\n"; -unlink $ns_ior; +$nsiorfile = "ns.ior"; +$conffile = "ec" . "$PerlACE::svcconf_ext"; -$NS = new PerlACE::Process ("../../../Naming_Service/Naming_Service", - "-o $ns_ior "); +my $ns_nsiorfile = $ns->LocalFile ($nsiorfile); +my $t_nsiorfile = $t->LocalFile ($nsiorfile); +my $c_nsiorfile = $c->LocalFile ($nsiorfile); +my $s_nsiorfile = $s->LocalFile ($nsiorfile); +my $t_conffile = $t->LocalFile ($conffile); +$ns->DeleteFile ($nsiorfile); +$t->DeleteFile ($nsiorfile); +$c->DeleteFile ($nsiorfile); +$s->DeleteFile ($nsiorfile); -$T = new PerlACE::Process ("Service", - "-ORBInitRef NameService=file://$ns_ior " - . "-ORBsvcconf $conffile"); +$NS = $ns->CreateProcess ("$ENV{TAO_ROOT}/orbsvcs/Naming_Service/Naming_Service", + " -o $ns_nsiorfile"); -$C = new PerlACE::Process ("Consumer", - "-ORBInitRef NameService=file://$ns_ior "); +$T = $t->CreateProcess ("Service", + " -ORBInitRef NameService=file://$t_nsiorfile ". + "-ORBsvcconf $t_conffile "); -$S = new PerlACE::Process ("Supplier", - "-ORBInitRef NameService=file://$ns_ior "); +$C = $c->CreateProcess ("Consumer", + " -ORBInitRef NameService=file://$c_nsiorfile "); +$S = $s->CreateProcess ("Supplier", + " -ORBInitRef NameService=file://$s_nsiorfile "); print STDOUT "Starting name server\n"; -$NS->Spawn (); +$NS_status = $NS->Spawn (); + +if ($NS_status != 0) { + print STDERR "ERROR: Name Service returned $NS_status\n"; + exit 1; +} + +if ($ns->WaitForFileTimed ($nsiorfile,$ns->ProcessStartWaitInterval()) == -1) { + print STDERR "ERROR: cannot find file <$ns_nsiorfile>\n"; + $NS->Kill (); $NS->TimedWait (1); + exit 1; +} -if (PerlACE::waitforfile_timed ($ns_ior, $PerlACE::wait_interval_for_process_creation) == -1) { - print STDERR "ERROR: cannot find file <$ns_ior>\n"; - $NS->Kill (); +if ($ns->GetFile ($nsiorfile) == -1) { + print STDERR "ERROR: cannot retrieve file <$ns_nsiorfile>\n"; + $NS->Kill (); $NS->TimedWait (1); + exit 1; +} +if ($t->PutFile ($nsiorfile) == -1) { + print STDERR "ERROR: cannot set file <$t_nsiorfile>\n"; + $NS->Kill (); $NS->TimedWait (1); + exit 1; +} +if ($c->PutFile ($nsiorfile) == -1) { + print STDERR "ERROR: cannot set file <$c_nsiorfile>\n"; + $NS->Kill (); $NS->TimedWait (1); + exit 1; +} +if ($s->PutFile ($nsiorfile) == -1) { + print STDERR "ERROR: cannot set file <$s_nsiorfile>\n"; + $NS->Kill (); $NS->TimedWait (1); exit 1; } print STDOUT "Starting event server\n"; -$T->Spawn (); +$T_status = $T->Spawn (); + +if ($T_status != 0) { + print STDERR "ERROR: Service returned $T_status\n"; + exit 1; +} sleep 2; print STDOUT "Starting consumer\n"; -$C->Spawn (); +$C_status = $C->Spawn (); + +if ($C_status != 0) { + print STDERR "ERROR: Consumer returned $C_status\n"; + exit 1; +} sleep 1; print STDOUT "Starting supplier\n"; -$supplier = $S->SpawnWaitKill (120); - -if ($supplier != 0) { - print STDERR "ERROR: supplier returned $supplier\n"; - $status = 1; +$S_status = $S->SpawnWaitKill ($s->ProcessStopWaitInterval()+105); +if ($S_status != 0) { + print STDERR "ERROR: Supplier returned $S_status\n"; + exit 1; } -$consumer = $C->WaitKill (15); - -if ($consumer != 0) { - print STDERR "ERROR: consumer returned $consumer\n"; +$C_status = $C->WaitKill ($c->ProcessStopWaitInterval()); +if ($C_status != 0) { + print STDERR "ERROR: Consumer returned $C_status\n"; $status = 1; } -$service = $T->TerminateWaitKill (5); +$T_status = $T->TerminateWaitKill ($t->ProcessStopWaitInterval()); -if ($service != 0) { - print STDERR "ERROR: service returned $service\n"; +if ($T_status != 0) { + print STDERR "ERROR: service returned $T_status\n"; $status = 1; } -$nserver = $NS->TerminateWaitKill (5); +$NS_status = $NS->TerminateWaitKill ($ns->ProcessStopWaitInterval()); -if ($nserver != 0) { - print STDERR "ERROR: name server returned $nserver\n"; +if ($NS_status != 0) { + print STDERR "ERROR: Name Service returned $NS_status\n"; $status = 1; } -unlink $ns_ior; +$ns->DeleteFile ($nsiorfile); +$t->DeleteFile ($nsiorfile); +$c->DeleteFile ($nsiorfile); +$s->DeleteFile ($nsiorfile); exit $status; |