diff options
author | Abdullah Sowayan <sowayan@users.noreply.github.com> | 2010-02-22 19:50:52 +0000 |
---|---|---|
committer | Abdullah Sowayan <sowayan@users.noreply.github.com> | 2010-02-22 19:50:52 +0000 |
commit | 1f7c3ca91d0e988296eacbad4713005615c6a052 (patch) | |
tree | 8e9a50618dff27cf8b54b22b48ab2c5ac1b7b943 | |
parent | d69441f3878a3ce9ff0ddde91753cb16f572790a (diff) | |
download | ATCD-1f7c3ca91d0e988296eacbad4713005615c6a052.tar.gz |
Mon Feb 22 19:49:01 UTC 2010 Abdul Sowayan <sowayan@gmail.com>
-rw-r--r-- | CIAO/ChangeLog | 7 | ||||
-rwxr-xr-x | CIAO/bin/generate_component_mpc.pl | 3 | ||||
-rw-r--r-- | CIAO/examples/Null_Component/Null_Component_exec.cpp | 4 | ||||
-rwxr-xr-x | CIAO/examples/Null_Component/descriptors/run_test_no_ns.pl | 198 | ||||
-rw-r--r-- | CIAO/examples/Null_Component_Glfa/Null_Component_exec.cpp | 4 | ||||
-rw-r--r-- | CIAO/examples/Null_Component_Glfa/Null_Interface.mpc | 1 |
6 files changed, 215 insertions, 2 deletions
diff --git a/CIAO/ChangeLog b/CIAO/ChangeLog index d9754316085..e6e5df77934 100644 --- a/CIAO/ChangeLog +++ b/CIAO/ChangeLog @@ -1,3 +1,10 @@ +Mon Feb 22 19:49:01 UTC 2010 Abdul Sowayan <sowayan@gmail.com> + + * examples/Null_Component/descriptors/run_test_no_ns.pl: + + Place holder file. We need to get this example working + without Naming Service. + Mon Feb 22 14:26:16 UTC 2010 Marcel Smit <msmit@remedy.nl> * connectors/dds4ccm/tests/Getter/Base/Get_Invoker.idl: diff --git a/CIAO/bin/generate_component_mpc.pl b/CIAO/bin/generate_component_mpc.pl index dc02c0eba4b..a1afa4eb1f7 100755 --- a/CIAO/bin/generate_component_mpc.pl +++ b/CIAO/bin/generate_component_mpc.pl @@ -12,7 +12,7 @@ use Getopt::Std; $flags = join (" ", @ARGV); -if (!getopts ('np:l:c:u:b:ho:') || $opt_h) { +if (!getopts ('np:l:c:u:b:ho:g:') || $opt_h) { print "generate_component_mpc.pl [-h] component_name\n"; print "\n"; print " -h print help message explaining various options\n"; @@ -23,6 +23,7 @@ if (!getopts ('np:l:c:u:b:ho:') || $opt_h) { print " -c Create a client makefile\n"; print " -u Unique project name prefix (if not defined, name for -p flag will be used). \n"; print " -b common base project(s) for all generated projects\n"; + print " -g use this option when you want to use the -Glfa option of TAO_IDL\n" print "\n"; print "generate_component_mpc creates and save a minimum mpc file\n"; print "called $com_name.mpc that is needed for a single component implementation\n"; diff --git a/CIAO/examples/Null_Component/Null_Component_exec.cpp b/CIAO/examples/Null_Component/Null_Component_exec.cpp index d9eff1f8476..888383fef74 100644 --- a/CIAO/examples/Null_Component/Null_Component_exec.cpp +++ b/CIAO/examples/Null_Component/Null_Component_exec.cpp @@ -1,6 +1,9 @@ // $Id$ #include "Null_Component_exec.h" +#include <iostream> + +using namespace std; namespace CIAO_Null_Component_Impl { @@ -74,6 +77,7 @@ namespace CIAO_Null_Component_Impl Null_Component_exec_i::ccm_activate () { // Your code here. + cout << "Horray, Abdul activating" << endl; } void diff --git a/CIAO/examples/Null_Component/descriptors/run_test_no_ns.pl b/CIAO/examples/Null_Component/descriptors/run_test_no_ns.pl new file mode 100755 index 00000000000..29bfb4680b9 --- /dev/null +++ b/CIAO/examples/Null_Component/descriptors/run_test_no_ns.pl @@ -0,0 +1,198 @@ +eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' + & eval 'exec perl -S $0 $argv:q' + if 0; + +# $Id$ +# -*- perl -*- + +use lib "$ENV{'ACE_ROOT'}/bin"; +use PerlACE::TestTarget; + +$CIAO_ROOT = "$ENV{'CIAO_ROOT'}"; +$TAO_ROOT = "$ENV{'TAO_ROOT'}"; +$DANCE_ROOT = "$ENV{'DANCE_ROOT'}"; + +$daemons_running = 0; +$em_running = 0; +$ns_running = 0; + +$nr_daemon = 1; +@ports = ( 60001 ); +@iorbases = ( "NodeApp1.ior" ); +@iorfiles = 0; +@nodenames = ( "NodeOne" ); + +# ior files other than daemon +$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; + +$status = 0; + +$ENV{"DANCE_TRACE_ENABLE"} = 0; +$ENV{"CIAO_TRACE_ENABLE"} = 0; + +sub create_targets { + # naming service + $tg_naming = PerlACE::TestTarget::create_target (1) || die "Create target for ns failed\n"; + $tg_naming->AddLibPath ('..'); + # daemon + for ($i = 0; $i < $nr_daemon; ++$i) { + $tg_daemons[$i] = PerlACE::TestTarget::create_target ($i+1) || die "Create target for deamon $i failed\n"; + $tg_daemons[$i]->AddLibPath ('..'); + } + # execution manager + $tg_exe_man = PerlACE::TestTarget::create_target (1) || die "Create target for EM failed\n"; + $tg_exe_man->AddLibPath ('..'); + # executor (plan_launcher) + $tg_executor = PerlACE::TestTarget::create_target (1) || die "Create target for executor failed\n"; + $tg_executor->AddLibPath ('..'); +} + +sub init_ior_files { + $ior_emfile = $tg_exe_man->LocalFile ($ior_embase); + for ($i = 0; $i < $nr_daemon; ++$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 < $nr_daemon; ++$i) { + $tg_daemons[$i]->DeleteFile ($iorbases[$i]); + } + $tg_exe_man->DeleteFile ($ior_embase); + for ($i = 0; $i < $nr_daemon; ++$i) { + $iorfiles[$i] = $tg_daemons[$i]->LocalFile ($iorbases[$i]); + } +} + +sub kill_node_daemon { + for ($i = 0; $i < $nr_daemon; ++$i) { + $DEAMONS[$i]->Kill (); $DEAMONS[$i]->TimedWait (1); + } +} + +sub kill_open_processes { + if ($daemons_running == 1) { + kill_node_daemon (); + } + + if ($em_running == 1) { + $EM->Kill (); $EM->TimedWait (1); + } + + # in case shutdown did not perform as expected + $tg_executor->KillAll ('ciao_componentserver'); +} + + +sub run_node_daemons { + for ($i = 0; $i < $nr_daemon; ++$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_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"; + + $DEAMONS[$i] = $tg_daemons[$i]->CreateProcess ($d_cmd, $d_param); + $DEAMONS[$i]->Spawn (); + + 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) { + $DEAMONS[$i]->Kill (); $DEAMONS[$i]->TimedWait (1); + } + return -1; + } + } + return 0; +} + +if ($#ARGV == -1) { + opendir(DIR, "."); + @files = grep(/\.cdp$/,readdir(DIR)); + closedir(DIR); +} +else { + @files = @ARGV; +} + +create_targets (); +init_ior_files (); + +foreach $file (@files) { + print "Starting test for deployment $file\n"; + + # Invoke node daemon. + print "Invoking node daemon\n"; + $status = run_node_daemons (); + + if ($status != 0) { + print STDERR "ERROR: Unable to execute the node daemons\n"; + kill_open_processes (); + exit 1; + } + + $daemons_running = 1; + + # Invoke execution manager. + print "Invoking execution manager\n"; + $EM = $tg_exe_man->CreateProcess ("$DANCE_ROOT/bin/dance_execution_manager", + "-e$ior_emfile"); + $EM->Spawn (); + + 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"; + kill_open_processes (); + exit 1; + } + + $em_running = 1; + + # Invoke executor - start the application -. + print "Invoking executor - launch the application -\n"; + + print "Start dance_plan_launcher.exe with -x $file -k file://$ior_emfile\n"; + $E = $tg_executor->CreateProcess ("$DANCE_ROOT/bin/dance_plan_launcher", + "-x $file -k file://$ior_emfile"); + $E->SpawnWaitKill (2*$tg_executor->ProcessStartWaitInterval ()); + + # Invoke executor - stop the application -. + print "Invoking executor - stop the application -\n"; + $E = $tg_executor->CreateProcess ("$DANCE_ROOT/bin/dance_plan_launcher", + "-k file://$ior_emfile -x $file -q"); + $E->SpawnWaitKill ($tg_executor->ProcessStopWaitInterval ()); + + print "Executor returned.\n"; + + delete_ior_files (); + kill_open_processes (); +} + +delete_ior_files (); +kill_open_processes (); + +exit $status; diff --git a/CIAO/examples/Null_Component_Glfa/Null_Component_exec.cpp b/CIAO/examples/Null_Component_Glfa/Null_Component_exec.cpp index d9eff1f8476..e206f3cb17c 100644 --- a/CIAO/examples/Null_Component_Glfa/Null_Component_exec.cpp +++ b/CIAO/examples/Null_Component_Glfa/Null_Component_exec.cpp @@ -1,6 +1,9 @@ // $Id$ #include "Null_Component_exec.h" +#include <iostream> + +using namespace std; namespace CIAO_Null_Component_Impl { @@ -74,6 +77,7 @@ namespace CIAO_Null_Component_Impl Null_Component_exec_i::ccm_activate () { // Your code here. + cout << "Abdul activating YAAAAAY" << endl << endl<< endl << endl << endl; } void diff --git a/CIAO/examples/Null_Component_Glfa/Null_Interface.mpc b/CIAO/examples/Null_Component_Glfa/Null_Interface.mpc index eba4706c3d4..3b5fbb4d477 100644 --- a/CIAO/examples/Null_Component_Glfa/Null_Interface.mpc +++ b/CIAO/examples/Null_Component_Glfa/Null_Interface.mpc @@ -4,7 +4,6 @@ project(Null_Interface_Glfa_idl_gen) : componentidldefaults { custom_only = 1 idlflags -= -Glem -Gxhex - idlflags += -Wb,stub_export_macro=NULL_INTERFACE_STUB_Export \ -Wb,stub_export_include=Null_Interface_stub_export.h \ -Wb,skel_export_macro=NULL_INTERFACE_SKEL_Export \ |