diff options
author | William R. Otte <wotte@dre.vanderbilt.edu> | 2010-09-10 15:48:08 +0000 |
---|---|---|
committer | William R. Otte <wotte@dre.vanderbilt.edu> | 2010-09-10 15:48:08 +0000 |
commit | 79b5eca39258da18051769b226e0454cadde6bbc (patch) | |
tree | 70a0dee127edb23cfbb9599400eb49ec0f962c3d /CIAO/tests/DAnCE/LocalityManager/CommandlinePassage | |
parent | 49bd93928d1b031cae7287a57402c3348c8514a4 (diff) | |
download | ATCD-79b5eca39258da18051769b226e0454cadde6bbc.tar.gz |
Fri Sep 10 15:47:32 UTC 2010 William R. Otte <wotte@dre.vanderbilt.edu>
* tests/DAnCE/LocalityManager:
* tests/DAnCE/LocalityManager/CPUAffinity:
* tests/DAnCE/LocalityManager/CommandlinePassage:
* tests/DAnCE/LocalityManager/UnexpectedShutdown:
* tests/DAnCE/ParseError:
Import tests from DAnCE.
Diffstat (limited to 'CIAO/tests/DAnCE/LocalityManager/CommandlinePassage')
6 files changed, 697 insertions, 0 deletions
diff --git a/CIAO/tests/DAnCE/LocalityManager/CommandlinePassage/CommandlinePassage.idl b/CIAO/tests/DAnCE/LocalityManager/CommandlinePassage/CommandlinePassage.idl new file mode 100644 index 00000000000..e01d7c16d2c --- /dev/null +++ b/CIAO/tests/DAnCE/LocalityManager/CommandlinePassage/CommandlinePassage.idl @@ -0,0 +1,22 @@ +// $Id$ + +/** + * @file + * @author Marcel Smit <msmit@remedy.nl> + * + * by-hand idl3 translation of sender components. + */ + +#ifndef COMMAND_LINE_PASSAGE_IDL_ +#define COMMAND_LINE_PASSAGE_IDL_ + +#include <Components.idl> + +module command_line_test +{ + component A + { + attribute long tc_max; + }; +}; +#endif diff --git a/CIAO/tests/DAnCE/LocalityManager/CommandlinePassage/CommandlinePassage.mpc b/CIAO/tests/DAnCE/LocalityManager/CommandlinePassage/CommandlinePassage.mpc new file mode 100644 index 00000000000..5840be245b0 --- /dev/null +++ b/CIAO/tests/DAnCE/LocalityManager/CommandlinePassage/CommandlinePassage.mpc @@ -0,0 +1,124 @@ +// $Id$ + +project(CommandlinePassage_idl_gen) : componentidldefaults { + after += + custom_only = 1 + idlflags += -Wb,stub_export_macro=COMMANDLINEPASSAGE_STUB_Export \ + -Wb,stub_export_include=CommandlinePassage_stub_export.h \ + -Wb,skel_export_macro=COMMANDLINEPASSAGE_SVNT_Export \ + -Wb,skel_export_include=CommandlinePassage_svnt_export.h \ + -Wb,exec_export_macro=COMMANDLINEPASSAGE_EXEC_Export \ + -Wb,exec_export_include=CommandlinePassage_exec_export.h \ + -I .. + + IDL_Files { + CommandlinePassage.idl + } +} + +project(CommandlinePassage_lem_gen) : ciaoidldefaults { + after += CommandlinePassage_idl_gen + custom_only = 1 + idlflags += -Wb,stub_export_macro=COMMANDLINEPASSAGE_EXEC_Export \ + -Wb,stub_export_include=CommandlinePassage_exec_export.h \ + -SS -Gxhst -I .. + + IDL_Files { + CommandlinePassageE.idl + } +} + +project(CommandlinePassage_lem_stub) : ccm_svnt { + after += CommandlinePassage_lem_gen CommandlinePassage_stub + libs += CommandlinePassage_stub + sharedname = CommandlinePassage_lem_stub + dynamicflags += COMMANDLINEPASSAGE_EXEC_BUILD_DLL + + IDL_Files { + } + + Source_Files { + CommandlinePassageEC.cpp + } + + Header_Files { + CommandlinePassageEC.h + CommandlinePassage_exec_export.h + } + + Inline_Files { + CommandlinePassageEC.inl + } +} + +project(CommandlinePassage_stub) : ccm_stub { + after += CommandlinePassage_idl_gen + libs += + sharedname = CommandlinePassage_stub + dynamicflags += COMMANDLINEPASSAGE_STUB_BUILD_DLL + + IDL_Files { + } + + Source_Files { + CommandlinePassageC.cpp + } + + Header_Files { + CommandlinePassageC.h + CommandlinePassage_stub_export.h + } + + Inline_Files { + CommandlinePassageC.inl + } +} + +project(CommandlinePassage_exec) : ciao_executor { + after += CommandlinePassage_lem_stub CommandlinePassage_stub + sharedname = CommandlinePassage_exec + libs += CommandlinePassage_stub CommandlinePassage_lem_stub + dynamicflags += COMMANDLINEPASSAGE_EXEC_BUILD_DLL + + IDL_Files { + } + + Source_Files { + CommandlinePassage_exec.cpp + } + + Header_Files { + CommandlinePassage_exec.h + CommandlinePassage_exec_export.h + } + + Inline_Files { + } +} + + +project(CommandlinePassage_svnt) : ciao_servant { + after += CommandlinePassage_lem_stub + sharedname = CommandlinePassage_svnt + libs += CommandlinePassage_stub CommandlinePassage_lem_stub + dynamicflags += COMMANDLINEPASSAGE_SVNT_BUILD_DLL + + IDL_Files { + } + + Source_Files { + CommandlinePassageS.cpp + CommandlinePassage_svnt.cpp + } + + Header_Files { + CommandlinePassageS.h + CommandlinePassage_svnt.h + CommandlinePassage_svnt_export.h + } + + Inline_Files { + CommandlinePassageS.inl + } +} + diff --git a/CIAO/tests/DAnCE/LocalityManager/CommandlinePassage/CommandlinePassage_exec.cpp b/CIAO/tests/DAnCE/LocalityManager/CommandlinePassage/CommandlinePassage_exec.cpp new file mode 100644 index 00000000000..bb39ab4e3a3 --- /dev/null +++ b/CIAO/tests/DAnCE/LocalityManager/CommandlinePassage/CommandlinePassage_exec.cpp @@ -0,0 +1,99 @@ +// -*- C++ -*- +// $Id$ + +#include "CommandlinePassage_exec.h" +#include "DAnCE/Logger/Log_Macros.h" +#include "tao/ORB_Core.h" +#include "tao/Transport_Cache_Manager.h" +#include "tao/Thread_Lane_Resources.h" + +namespace CIAO_command_line_test_A_Impl +{ + //============================================================ + // Pulse generator + //============================================================ + + Component_exec_i::Component_exec_i (void) + : tc_max_ (3) + { + } + + Component_exec_i::~Component_exec_i (void) + { + } + + // Port operations. + void Component_exec_i::tc_max (CORBA::Long tc_max) + { + this->tc_max_ = tc_max; + } + + CORBA::Long Component_exec_i::tc_max (void) + { + return this->tc_max_; + } + // Operations from Components::SessionComponent. + void + Component_exec_i::set_session_context ( + ::Components::SessionContext_ptr ctx) + { + this->context_ = + ::command_line_test::CCM_A_Context::_narrow (ctx); + + if ( ::CORBA::is_nil (this->context_.in ())) + { + throw ::CORBA::INTERNAL (); + } + } + + void + Component_exec_i::configuration_complete (void) + { + } + + void + Component_exec_i::ccm_activate (void) + { + } + + void + Component_exec_i::ccm_passivate (void) + { + } + + void + Component_exec_i::ccm_remove (void) + { + try + { + long tc = + this->context_->get_CCM_object ()->_get_orb ()->orb_core ()->lane_resources ().transport_cache ().total_size (); + ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Transport cache : set <%d>, current_size <%d>\n"), + this->tc_max_, tc)); + if (this->tc_max_ != tc) + { + ACE_ERROR ((LM_ERROR, ACE_TEXT ("ERROR : Commandline parameter isn't not passed properly ") + ACE_TEXT ("should be <%d>, is <%d>\n"), + this->tc_max_, tc)); + } + } + catch (...) + { + ACE_ERROR ((LM_ERROR, ACE_TEXT ("ERROR : Exception caught while checking transport cache.\n"))); + } + } + + extern "C" COMMANDLINEPASSAGE_EXEC_Export ::Components::EnterpriseComponent_ptr + create_Component_Impl (void) + { + ::Components::EnterpriseComponent_ptr retval = + ::Components::EnterpriseComponent::_nil (); + + ACE_NEW_NORETURN ( + retval, + Component_exec_i ); + + return retval; + } +} + diff --git a/CIAO/tests/DAnCE/LocalityManager/CommandlinePassage/CommandlinePassage_exec.h b/CIAO/tests/DAnCE/LocalityManager/CommandlinePassage/CommandlinePassage_exec.h new file mode 100644 index 00000000000..d8bcc90c430 --- /dev/null +++ b/CIAO/tests/DAnCE/LocalityManager/CommandlinePassage/CommandlinePassage_exec.h @@ -0,0 +1,54 @@ +// -*- C++ -*- +// $Id$ + +#ifndef COMPONENTLINPASSAGE_EXEC_H_ +#define COMPONENTLINPASSAGE_EXEC_H_ + + +#include "CommandlinePassageEC.h" + +#include /**/ "CommandlinePassage_exec_export.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "tao/LocalObject.h" + +#include <map> + +namespace CIAO_command_line_test_A_Impl +{ + class Component_exec_i + : public virtual A_Exec, + public virtual ::CORBA::LocalObject + { + public: + Component_exec_i (void); + virtual ~Component_exec_i (void); + + virtual void + tc_max (CORBA::Long tc_max); + + virtual CORBA::Long + tc_max (void); + + virtual void + set_session_context ( + ::Components::SessionContext_ptr ctx); + virtual void configuration_complete (void); + virtual void ccm_activate (void); + virtual void ccm_passivate (void); + virtual void ccm_remove (void); + + private: + ::command_line_test::CCM_A_Context_var context_; + CORBA::Long tc_max_; + }; + + extern "C" COMMANDLINEPASSAGE_EXEC_Export ::Components::EnterpriseComponent_ptr + create_Component_Impl (void); +} + +#endif /* ifndef */ + diff --git a/CIAO/tests/DAnCE/LocalityManager/CommandlinePassage/Component.cdp b/CIAO/tests/DAnCE/LocalityManager/CommandlinePassage/Component.cdp new file mode 100644 index 00000000000..432e01f72a6 --- /dev/null +++ b/CIAO/tests/DAnCE/LocalityManager/CommandlinePassage/Component.cdp @@ -0,0 +1,153 @@ +<Deployment:DeploymentPlan + xmlns:Deployment="http://www.omg.org/Deployment" + xmlns:xmi="http://www.omg.org/XMI" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://www.omg.org/Deployment Deployment.xsd"> + <label>Hello_DDS_Deployment_1</label> + <UUID>Hello_DDS_Deployment_1</UUID> + + <!-- Implementations declarations --> + + <!-- Home implementation --> + + <implementation xmi:id="CompSvrImpl"> + <name>CompSvr</name> + <source /> + <artifact xmi:idref="CompSvrArt" /> + <execParameter> + <name>edu.vanderbilt.dre.DAnCE.ImplementationType</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>edu.vanderbilt.dre.DAnCE.LocalityManager</string> + </value> + </value> + </execParameter> + </implementation> + + <implementation xmi:id="CommandlinePassageComponentImplementation"> + <name>CommandlinePassageComponentImplementation</name> + <source/> + <artifact xmi:idref="CommandlinePassage_ExecArtifact" /> + <artifact xmi:idref="CommandlinePassage_SvntArtifact" /> + <execParameter> + <!-- entrypoint as exec parameter (see 10.6.1) --> + <name>component factory</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>create_Component_Impl</string> + </value> + </value> + </execParameter> + <execParameter> + <name>edu.vanderbilt.dre.CIAO.ServantEntrypoint</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>create_command_line_test_A_Servant</string> + </value> + </value> + </execParameter> + <execParameter> + <name>edu.vanderbilt.dre.CIAO.ServantArtifact</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>CommandlinePassage_svnt</string> + </value> + </value> + </execParameter> + <execParameter> + <name>edu.vanderbilt.dre.CIAO.ExecutorArtifact</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>CommandlinePassage_exec</string> + </value> + </value> + </execParameter> + </implementation> + + <instance xmi:id="CompSvrInst"> + <name>ComponentServerInstance</name> + <node>CommandlinePassageNode</node> + <source /> + <implementation xmi:idref="CompSvrImpl" /> + <configProperty> + <name>edu.vanderbilt.dre.DAnCE.LocalityArguments</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>-ORBSvcConfDirective "static Resource_Factory '-ORBConnectionCacheMax 33'"</string> + </value> + </value> + </configProperty> + </instance> + + <instance xmi:id="CommandlinePassageComponentInstance"> + <name>CommandlinePassageComponent</name> + <node>CommandlinePassageNode</node> + <!-- hostname --> + <source/> + <implementation xmi:idref="CommandlinePassageComponentImplementation" /> + <!-- set both edu.vanderbilt.dre.CIAO.ComponentServer.Args and + tc_max to the same number --> + <configProperty> + <name>tc_max</name> + <value> + <type> + <kind>tk_long</kind> + </type> + <value> + <long>33</long> + </value> + </value> + </configProperty> + </instance> + + <!-- Artifacts declarations --> + <artifact xmi:id="CompSvrArt"> + <name>CompoSvrArtifactName</name> + <source /> + <node /> + <location>dance_locality_manager</location> + </artifact> + <artifact xmi:id="CommandlinePassage_ExecArtifact"> + <name>CommandlinePassage_exec</name> + <source/> + <node/> + <location>CommandlinePassage_exec</location> + </artifact> + <artifact xmi:id="CommandlinePassage_SvntArtifact"> + <name>CommandlinePassage_svnt</name> + <source/> + <node/> + <location>CommandlinePassage_svnt</location> + </artifact> + <artifact xmi:id="CommandlinePassage_StubArtifact"> + <name>CommandlinePassage_stub</name> + <source/> + <node/> + <location>CommandlinePassage_stub</location> + </artifact> + + <localityConstraint> + <constraint>SameProcess</constraint> + <constrainedInstance xmi:idref="CompSvrInst" /> + <constrainedInstance xmi:idref="CommandlinePassageComponentInstance" /> + </localityConstraint> + +</Deployment:DeploymentPlan> diff --git a/CIAO/tests/DAnCE/LocalityManager/CommandlinePassage/run_test.pl b/CIAO/tests/DAnCE/LocalityManager/CommandlinePassage/run_test.pl new file mode 100755 index 00000000000..085056a2e69 --- /dev/null +++ b/CIAO/tests/DAnCE/LocalityManager/CommandlinePassage/run_test.pl @@ -0,0 +1,245 @@ +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 = ( "CommandlinePassage.ior" ); +@iorfiles = 0; +@nodenames = ( "CommandlinePassageNode" ); + +# ior files other than daemon +# 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; + +$status = 0; +$cdp_file = "Component.cdp"; + + +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_nsfile = $tg_naming->LocalFile ($ior_nsbase); + $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_naming->DeleteFile ($ior_nsbase); + $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); + } + + if ($ns_running == 1) { + $NS->Kill (); $NS->TimedWait (1); + } + # in case shutdown did not perform as expected + $tg_executor->KillAll ('dance_locality_manager'); +} + +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 = $tg_daemons[$i]->GetArchDir("$DANCE_ROOT/bin/") . "dance_locality_manager"; + + $d_cmd = "$DANCE_ROOT/bin/dance_node_manager"; + $d_param = "-ORBEndpoint $iiop -s $node_app -n $nodename=$iorfile -t 30 --domain-nc corbaloc:rir:/NameService"; + + 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; +} + +create_targets (); +init_ior_files (); + +# Invoke naming service + +$NS = $tg_naming->CreateProcess ("$TAO_ROOT/orbsvcs/Naming_Service/Naming_Service", " -ORBEndpoint iiop://localhost:60003 -o $ior_nsfile"); + +print STDERR "Starting Naming Service with -ORBEndpoint iiop://localhost:60003 -o ns.ior\n"; + +$ns_status = $NS->Spawn (); + +if ($ns_status != 0) { + print STDERR "ERROR: Unable to execute the naming service\n"; + kill_open_processes (); + exit 1; +} + +if ($tg_naming->WaitForFileTimed ($ior_nsbase, + $tg_naming->ProcessStartWaitInterval ()) == -1) { + print STDERR "ERROR: cannot find naming service IOR file\n"; + $NS->Kill (); $NS->TimedWait (1); + exit 1; +} + +$ns_running = 1; +# Set up NamingService environment +$ENV{"NameServiceIOR"} = "corbaloc:iiop:localhost:60003/NameService"; + +# Invoke node daemon. +print "Invoking node daemon\n"; +$status = run_node_daemons (); + +if ($status != 0) { + print STDERR "ERROR: Unable to execute the node daemon\n"; + kill_open_processes (); + exit 1; +} + +$daemons_running = 1; + +# Invoke execution manager. +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 --domain-nc corbaloc:rir:/NameService"); +$em_status = $EM->Spawn (); + +if ($em_status != 0) { + print STDERR "ERROR: dance_execution_manager returned $em_status"; + exit 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"; + 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 $cdp_file -k file://$ior_emfile\n"; +$E = $tg_executor->CreateProcess ("$DANCE_ROOT/bin/dance_plan_launcher", + "-x $cdp_file -k file://$ior_emfile"); + +$pl_status = $E->SpawnWaitKill (2 * $tg_executor->ProcessStartWaitInterval ()); + +if ($pl_status != 0) { + print STDERR "ERROR: dance_plan_launcher returned $pl_status\n"; + kill_open_processes (); + exit 1; +} + +for ($i = 0; $i < $nr_daemon; ++$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 "Sleeping 10 seconds to allow task to complete\n"; +sleep (10); + +# Invoke executor - stop the application -. +print "Invoking executor - stop the application -\n"; +print "by running dance_plan_launcher.exe with -k file://$ior_emfile -x $cdp_file\n"; + +$E = $tg_executor->CreateProcess ("$DANCE_ROOT/bin/dance_plan_launcher", + "-k file://$ior_emfile -x $cdp_file -s"); +$pl_status = $E->SpawnWaitKill ($tg_executor->ProcessStartWaitInterval ()); + +if ($pl_status != 0) { + print STDERR "ERROR: dance_plan_launcher returned $pl_status\n"; + kill_open_processes (); + exit 1; +} + +print "Executor returned.\n"; +print "Shutting down rest of the processes.\n"; + +delete_ior_files (); +kill_open_processes (); + +exit $status; |