diff options
author | msmit <msmit@remedy.nl> | 2009-12-10 10:10:27 +0000 |
---|---|---|
committer | msmit <msmit@remedy.nl> | 2009-12-10 10:10:27 +0000 |
commit | ab61df574e8c4a0ccb0128ec639fab5c9efb4bdb (patch) | |
tree | 5c20d6cac6a8f11ba976ab51bc62aab74954bd13 | |
parent | 11bd9c4d2d7513b2bf9c0b33f18c4d1c347e4c37 (diff) | |
download | ATCD-ab61df574e8c4a0ccb0128ec639fab5c9efb4bdb.tar.gz |
Thu Dec 10 10:11:56 UTC 2009 Marcel Smit <msmit@remedy.nl>
* examples/Hello/descriptors/run_test_without_ns.pl:
* examples/Null_Component/descriptors/run_test.pl:
Resolved fuzz errors/warnings.
-rw-r--r-- | CIAO/ChangeLog | 6 | ||||
-rwxr-xr-x | CIAO/examples/Hello/descriptors/run_test_without_ns.pl | 167 | ||||
-rwxr-xr-x | CIAO/examples/Null_Component/descriptors/run_test.pl | 2 |
3 files changed, 100 insertions, 75 deletions
diff --git a/CIAO/ChangeLog b/CIAO/ChangeLog index afb9963c382..8f92b414270 100644 --- a/CIAO/ChangeLog +++ b/CIAO/ChangeLog @@ -1,3 +1,9 @@ +Thu Dec 10 10:11:56 UTC 2009 Marcel Smit <msmit@remedy.nl> + + * examples/Hello/descriptors/run_test_without_ns.pl: + * examples/Null_Component/descriptors/run_test.pl: + Resolved fuzz errors/warnings. + Thu Dec 10 10:00:16 UTC 2009 Johnny Willemsen <jwillemsen@remedy.nl> * DAnCE/NodeApplication/NodeApplication_Impl.cpp: diff --git a/CIAO/examples/Hello/descriptors/run_test_without_ns.pl b/CIAO/examples/Hello/descriptors/run_test_without_ns.pl index 96a15b205ce..b8fb80666f3 100755 --- a/CIAO/examples/Hello/descriptors/run_test_without_ns.pl +++ b/CIAO/examples/Hello/descriptors/run_test_without_ns.pl @@ -6,19 +6,19 @@ 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; -$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,27 +27,57 @@ $cdp_file = "DeploymentPlan_without_ns.cdp"; $controller_exec = "$CIAO_ROOT/examples/Hello/Sender/starter"; -PerlACE::add_lib_path ('../lib'); - -unlink $nsior; +# ior files other than daemon +$ior_embase = "EM.ior"; +$ior_emfile = 0; +# Processes $E = 0; $EM = 0; +@DEAMONS = 0; + +# targets +@tg_daemons = 0; +$tg_exe_man = 0; +$tg_executor = 0; + +PerlACE::add_lib_path ('../lib'); +$ENV{"DANCE_TRACE_ENABLE"} = 0; +$ENV{"CIAO_TRACE_ENABLE"} = 0; + +sub create_targets { + # 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_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_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"); } sub kill_node_daemons { for ($i = 0; $i < $daemons; ++$i) { - $Daemons[$i]->Kill (); $Daemons[$i]->TimedWait (1); + $DEAMONS[$i]->Kill (); $DEAMONS[$i]->TimedWait (1); } } @@ -60,43 +90,41 @@ sub kill_open_processes { $EM->Kill (); $EM->TimedWait (1); } - - if ($ns_running == 1) { - $NS->Kill (); - $NS->TimedWait (1); - } } + sub run_node_daemons { - for ($i = 0; $i < $daemons; ++$i) { - $iorfile = $iorfiles[$i]; - $port = $ports[$i]; - $nodename = $nodenames[$i]; - $iiop = "iiop://localhost:$port"; - $node_app = "$CIAO_ROOT/bin/ciao_componentserver"; + 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_param = "-ORBEndpoint $iiop -s $node_app -n $nodename=$iorfile -t 30"; + $d_cmd = "$DANCE_ROOT/bin/dance_node_manager"; + $d_param = "-ORBEndpoint $iiop -s $node_app -n $nodename=$iorfile -t 30"; - print "Run dance_node_manager with $d_param\n"; + print "Run dance_node_manager with $d_param\n"; - $Daemons[$i] = new PerlACE::Process ($d_cmd, $d_param); - $result = $Daemons[$i]->Spawn (); - push(@processes, $Daemons[$i]); + $DEAMONS[$i] = $tg_daemons[$i]->CreateProcess ($d_cmd, $d_param); + $DEAMONS[$i]->Spawn (); - if (PerlACE::waitforfile_timed ($iorfile, 30) == -1) { - print STDERR + 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"; - for (; $i >= 0; --$i) { - $Daemons[$i]->Kill (); $Daemons[$i]->TimedWait (1); - } - return -1; - } - } - return 0; + for (; $i >= 0; --$i) { + $DEAMONS[$i]->Kill (); $DEAMONS[$i]->TimedWait (1); + } + return -1; + } + } + return 0; } -delete_ior_files (); +create_targets (); +init_ior_files (); # Invoke node daemons. print "Invoking node daemons\n"; @@ -111,15 +139,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; } @@ -127,32 +155,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_without_ns.cdp -k file://EM.ior\n"; -$E = new PerlACE::Process ("$DAnCE/bin/dance_plan_launcher", - "-x DeploymentPlan_without_ns.cdp -k file://EM.ior"); - -$E->SpawnWaitKill (30); - -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 (120); +$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"; @@ -161,11 +182,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"; diff --git a/CIAO/examples/Null_Component/descriptors/run_test.pl b/CIAO/examples/Null_Component/descriptors/run_test.pl index 9ed9e0bd6ce..d5bd163ac53 100755 --- a/CIAO/examples/Null_Component/descriptors/run_test.pl +++ b/CIAO/examples/Null_Component/descriptors/run_test.pl @@ -41,8 +41,6 @@ $tg_exe_man = 0; $tg_executor = 0; $status = 0; -$cdp_file = ""; -$dat_file = "NodeMap.dat"; PerlACE::add_lib_path ('..'); $ENV{"DANCE_TRACE_ENABLE"} = 0; |