diff options
author | msmit <msmit@remedy.nl> | 2009-12-08 16:29:59 +0000 |
---|---|---|
committer | msmit <msmit@remedy.nl> | 2009-12-08 16:29:59 +0000 |
commit | 6eff484ebdad8ec2d19f8eb224d458a6deca617e (patch) | |
tree | 3ae542d31756723124ca1866cfa6a2f40eee0b5c | |
parent | 7b9e7d05ffec89e2137329eca509f9c89099693b (diff) | |
download | ATCD-6eff484ebdad8ec2d19f8eb224d458a6deca617e.tar.gz |
Tue Dec 8 16:31:33 UTC 2009 Marcel Smit <msmit@remedy.nl>
* examples/Hello/descriptors/run_test.pl:
Adapted to the new test framework.
-rw-r--r-- | CIAO/ChangeLog | 5 | ||||
-rwxr-xr-x | CIAO/examples/Hello/descriptors/run_test.pl | 162 |
2 files changed, 101 insertions, 66 deletions
diff --git a/CIAO/ChangeLog b/CIAO/ChangeLog index 3218ada758f..5853cf8cc9a 100644 --- a/CIAO/ChangeLog +++ b/CIAO/ChangeLog @@ -1,3 +1,8 @@ +Tue Dec 8 16:31:33 UTC 2009 Marcel Smit <msmit@remedy.nl> + + * examples/Hello/descriptors/run_test.pl: + Adapted to the new test framework. + Tue Dec 8 15:54:33 UTC 2009 Johnny Willemsen <jwillemsen@remedy.nl> * connectors/dds4ccm/impl/ndds/Updater_T.cpp: diff --git a/CIAO/examples/Hello/descriptors/run_test.pl b/CIAO/examples/Hello/descriptors/run_test.pl index 35928dc3d8e..89814151c14 100755 --- a/CIAO/examples/Hello/descriptors/run_test.pl +++ b/CIAO/examples/Hello/descriptors/run_test.pl @@ -6,11 +6,11 @@ eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' # -*- perl -*- use lib "$ENV{'ACE_ROOT'}/bin"; -use PerlACE::Run_Test; +use PerlACE::TestTarget; $CIAO_ROOT = "$ENV{'CIAO_ROOT'}"; $TAO_ROOT = "$ENV{'TAO_ROOT'}"; -$DAnCE = "$ENV{'DANCE_ROOT'}"; +$DANCE_ROOT = "$ENV{'DANCE_ROOT'}"; $daemons_running = 0; $em_running = 0; @@ -18,7 +18,8 @@ $ns_running = 0; $daemons = 2; @ports = ( 60001, 60002 ); -@iorfiles = ( "NodeApp1.ior", "NodeApp2.ior" ); +@iorbases = ( "NodeApp1.ior", "NodeApp2.ior" ); +@iorfiles = 0; @nodenames = ( "Sender", "Receiver" ); $status = 0; @@ -27,30 +28,66 @@ $cdp_file = "DeploymentPlan.cdp"; $controller_exec = "$CIAO_ROOT/examples/Hello/Sender/starter"; -$nsior = PerlACE::LocalFile ("ns.ior"); +# ior files other than daemon +$ior_nsbase = "ns.ior"; +$ior_nsfile = 0; +$ior_embase = "EM.ior"; +$ior_emfile = 0; + +# Processes +$E = 0; +$EM = 0; +$NS = 0; +@DEAMONS = 0; + +# targets +@tg_daemons = 0; +$tg_naming = 0; +$tg_exe_man = 0; +$tg_executor = 0; PerlACE::add_lib_path ('../lib'); +$ENV{"DANCE_TRACE_ENABLE"} = 0; +$ENV{"CIAO_TRACE_ENABLE"} = 0; -unlink $nsior; +sub create_targets { + # naming service + $tg_naming = PerlACE::TestTarget::create_target (1) || die "Create target for ns failed\n"; -$E = 0; -$EM = 0; + # daemon + for ($i = 0; $i < $daemons; ++$i) { + $tg_daemons[$i] = PerlACE::TestTarget::create_target ($i+1) || die "Create target for deamon $i failed\n"; + } + # execution manager + $tg_exe_man = PerlACE::TestTarget::create_target (1) || die "Create target for EM failed\n"; + # executor (plan_launcher) + $tg_executor = PerlACE::TestTarget::create_target (1) || die "Create target for executor failed\n"; +} + +sub init_ior_files { + $ior_nsfile = $tg_naming->LocalFile ($ior_nsbase); + $ior_emfile = $tg_exe_man->LocalFile ($ior_embase); + for ($i = 0; $i < $daemons; ++$i) { + $iorfiles[$i] = $tg_daemons[$i]->LocalFile ($iorbases[$i]); + } + delete_ior_files (); +} # Delete if there are any .ior files. sub delete_ior_files { for ($i = 0; $i < $daemons; ++$i) { - unlink $iorfiles[$i]; + $tg_daemons[$i]->DeleteFile ($iorbases[$i]); + } + $tg_naming->DeleteFile ($ior_nsbase); + $tg_exe_man->DeleteFile ($ior_embase); + for ($i = 0; $i < $daemons; ++$i) { + $iorfiles[$i] = $tg_daemons[$i]->LocalFile ($iorbases[$i]); } - unlink PerlACE::LocalFile ("EM.ior"); - unlink PerlACE::LocalFile ("Receiver.ior"); - unlink PerlACE::LocalFile ("Sender.ior"); - unlink PerlACE::LocalFile ("DAM.ior"); - unlink PerlACE::LocalFile ("ns.ior"); } sub kill_node_daemons { for ($i = 0; $i < $daemons; ++$i) { - $Daemons[$i]->Kill (); $Daemons[$i]->TimedWait (1); + @DEAMONS[$i]->Kill (); @DEAMONS[$i]->TimedWait (1); } } @@ -72,58 +109,58 @@ sub kill_open_processes { sub run_node_daemons { for ($i = 0; $i < $daemons; ++$i) { + $iorbase = $iorbases[$i]; $iorfile = $iorfiles[$i]; $port = $ports[$i]; $nodename = $nodenames[$i]; $iiop = "iiop://localhost:$port"; $node_app = "$CIAO_ROOT/bin/ciao_componentserver"; - $d_cmd = "$DAnCE/bin/dance_node_manager"; + $d_cmd = "$DANCE_ROOT/bin/dance_node_manager"; $d_param = "-ORBEndpoint $iiop -s $node_app -n $nodename=$iorfile -t 30 --instance-nc corbaloc:rir:/NameService"; print "Run dance_node_manager with $d_param\n"; - $Daemons[$i] = new PerlACE::Process ($d_cmd, $d_param); - $Daemons[$i]->Spawn (); + $DEAMONS[$i] = $tg_daemons[$i]->CreateProcess ($d_cmd, $d_param); + $DEAMONS[$i]->Spawn (); - if (PerlACE::waitforfile_timed ($iorfile, - 30) == -1) { + if ($tg_daemons[$i]->WaitForFileTimed($iorbase, + $tg_daemons[$i]->ProcessStartWaitInterval ()) == -1) { print STDERR - "ERROR: The ior $iorfile file of node daemon $i could not be found\n"; + "ERROR: The ior $iorfile file of node daemon $i could not be found\n"; for (; $i >= 0; --$i) { - $Daemons[$i]->Kill (); $Daemons[$i]->TimedWait (1); + $DEAMONS[$i]->Kill (); $DEAMONS[$i]->TimedWait (1); } return -1; } } - return 0; + return 0; } -delete_ior_files (); +create_targets (); +init_ior_files (); # Invoke naming service -$NS = new PerlACE::Process ("$TAO_ROOT/orbsvcs/Naming_Service/Naming_Service", "-m 0 -ORBEndpoint iiop://localhost:60003 -o ns.ior"); - -$NS->Spawn (); +$NS = $tg_naming->CreateProcess ("$TAO_ROOT/orbsvcs/Naming_Service/Naming_Service", "-m 0 -ORBEndpoint iiop://localhost:60003 -o $ior_nsfile"); print STDERR "Starting Naming Service with -m 0 -ORBEndpoint iiop://localhost:60003 -o ns.ior\n"; -if (PerlACE::waitforfile_timed ($nsior, $PerlACE::wait_interval_for_process_creation) == -1) -{ +$NS->Spawn (); + +if ($tg_naming->WaitForFileTimed ($ior_nsbase, + $tg_naming->ProcessStartWaitInterval ()) == -1) { print STDERR "ERROR: cannot find naming service IOR file\n"; - $NS->Kill (); + $NS->Kill (); $NS->TimedWait (1); exit 1; } $ns_running = 1; - # Set up NamingService environment $ENV{"NameServiceIOR"} = "corbaloc:iiop:localhost:60003/NameService"; - -# Invoke node daemons. -print "Invoking node daemons\n"; +# Invoke node daemon. +print "Invoking node daemon\n"; $status = run_node_daemons (); if ($status != 0) { @@ -135,15 +172,15 @@ if ($status != 0) { $daemons_running = 1; # Invoke execution manager. -print "Invoking execution manager (dance_execution_manager.exe) with -eEM.ior --node-map $dat_file\n"; -$EM = new PerlACE::Process ("$DAnCE/bin/dance_execution_manager", - "-eEM.ior --node-map $dat_file"); +print "Invoking execution manager (dance_execution_manager.exe) with -e$ior_emfile\n"; +$EM = $tg_exe_man->CreateProcess ("$DANCE_ROOT/bin/dance_execution_manager", + "-e$ior_emfile --node-map $dat_file"); $EM->Spawn (); -if (PerlACE::waitforfile_timed ("EM.ior", - $PerlACE::wait_interval_for_process_creation) == -1) { +if ($tg_exe_man->WaitForFileTimed ($ior_embase, + $tg_exe_man->ProcessStartWaitInterval ()) == -1) { print STDERR - "ERROR: The ior file of execution manager could not be found\n"; + "ERROR: The ior file of execution manager could not be found\n"; kill_open_processes (); exit 1; } @@ -151,32 +188,25 @@ if (PerlACE::waitforfile_timed ("EM.ior", $em_running = 1; # Invoke executor - start the application -. -print "Invoking executor - start the application -\n"; - -print "Start dance_plan_launcher.exe with -x DeploymentPlan.cdp -k file://EM.ior\n"; -$E = new PerlACE::Process ("$DAnCE/bin/dance_plan_launcher", - "-x DeploymentPlan.cdp -k file://EM.ior"); - -$E->SpawnWaitKill (50); - -if (PerlACE::waitforfile_timed ( - "Receiver.ior", - $PerlACE::wait_interval_for_process_creation) == -1) { - print STDERR "ERROR: The ior file of receiver could not be found\n"; - kill_open_processes (); - exit 1; -} - -if (PerlACE::waitforfile_timed ("Sender.ior", - $PerlACE::wait_interval_for_process_creation) == -1) { - print STDERR "ERROR: The ior file of sender could not be found\n"; - kill_open_processes (); - exit 1; +print "Invoking executor - launch the application -\n"; + +print "Start dance_plan_launcher.exe with -x $cdp_file -k file://$ior_emfile\n"; +$E = $tg_executor->CreateProcess ("$DANCE_ROOT/bin/dance_plan_launcher", + "-x $cdp_file -k file://$ior_emfile"); +$E->SpawnWaitKill (2*$tg_executor->ProcessStartWaitInterval ()); + +for ($i = 0; $i < $$daemons; ++$i) { + if ($tg_daemons[$i]->WaitForFileTimed ($iorbases[$i], + $tg_daemons[$i]->ProcessStopWaitInterval ()) == -1) { + print STDERR "ERROR: The ior file of daemon $i could not be found\n"; + kill_open_processes (); + exit 1; + } } print "Invoking the controller ($controller_exec -k file://Sender.ior)\n"; -$controller = new PerlACE::Process ("$controller_exec", "-k file://Sender.ior"); -$result = $controller->SpawnWaitKill (30); +$CTRL = $tg_executor->CreateProcess ("$controller_exec", "-k file://Sender.ior"); +$result = $CTRL->SpawnWaitKill ($tg_executor->ProcessStartWaitInterval ()); if ($result != 0) { print STDERR "ERROR: The controller returned $result\n"; @@ -185,11 +215,11 @@ if ($result != 0) { # Invoke executor - stop the application -. print "Invoking executor - stop the application -\n"; -print "by running dance_plan_launcher.exe with -k file://EM.ior -x DeploymentPlan.cdp -q\n"; +print "by running dance_plan_launcher.exe with -k file://$ior_emfile -x $cdp_file -q\n"; -$E = new PerlACE::Process ("$DAnCE/bin/dance_plan_launcher", - "-k file://EM.ior -x DeploymentPlan.cdp -q"); -$E->SpawnWaitKill (30); +$E = $tg_executor->CreateProcess ("$DANCE_ROOT/bin/dance_plan_launcher", + "-k file://$ior_emfile -x $cdp_file -q"); +$E->SpawnWaitKill ($tg_executor->ProcessStopWaitInterval ()); print "Executor returned.\n"; print "Shutting down rest of the processes.\n"; |