summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWilliam R. Otte <wotte@dre.vanderbilt.edu>2011-04-09 01:43:34 +0000
committerWilliam R. Otte <wotte@dre.vanderbilt.edu>2011-04-09 01:43:34 +0000
commit5e866c031134995b1337eafd14262a906d2ec577 (patch)
treed0c87763035787742b742183454e26582478687a
parent969764f1dc1b4c95e8ce02dc1f68fc3d924e592e (diff)
downloadATCD-5e866c031134995b1337eafd14262a906d2ec577.tar.gz
Sat Apr 9 01:42:54 UTC 2011 William R. Otte <wotte@dre.vanderbilt.edu>
* tests/DAnCE/Launch-Failures/Component/Launch_Failure.idl: * tests/DAnCE/Launch-Failures/Component/Launch_Failure_exec.h: * tests/DAnCE/Launch-Failures/Component/Launch_Failure_exec.cpp: * tests/DAnCE/Launch-Failures/descriptors/DestEndpointFailure.cdp: * tests/DAnCE/Launch-Failures/descriptors/SourceEndpointFailure.cdp: * tests/DAnCE/Launch-Failures/descriptors/besteffort.localityconfig: * tests/DAnCE/Launch-Failures/descriptors/run_tests_besteffort.pl: Expanded tested failure cases.
-rw-r--r--CIAO/ChangeLog12
-rw-r--r--CIAO/tests/DAnCE/Launch-Failures/Component/Launch_Failure.idl7
-rw-r--r--CIAO/tests/DAnCE/Launch-Failures/Component/Launch_Failure_exec.cpp35
-rw-r--r--CIAO/tests/DAnCE/Launch-Failures/Component/Launch_Failure_exec.h3
-rw-r--r--CIAO/tests/DAnCE/Launch-Failures/descriptors/DestEndpointFailure.cdp176
-rw-r--r--CIAO/tests/DAnCE/Launch-Failures/descriptors/SourceEndpointFailure.cdp176
-rw-r--r--CIAO/tests/DAnCE/Launch-Failures/descriptors/besteffort.localityconfig7
-rwxr-xr-xCIAO/tests/DAnCE/Launch-Failures/descriptors/run_tests_besteffort.pl237
8 files changed, 627 insertions, 26 deletions
diff --git a/CIAO/ChangeLog b/CIAO/ChangeLog
index 653843704dc..c4f914be41c 100644
--- a/CIAO/ChangeLog
+++ b/CIAO/ChangeLog
@@ -1,3 +1,15 @@
+Sat Apr 9 01:42:54 UTC 2011 William R. Otte <wotte@dre.vanderbilt.edu>
+
+ * tests/DAnCE/Launch-Failures/Component/Launch_Failure.idl:
+ * tests/DAnCE/Launch-Failures/Component/Launch_Failure_exec.h:
+ * tests/DAnCE/Launch-Failures/Component/Launch_Failure_exec.cpp:
+ * tests/DAnCE/Launch-Failures/descriptors/DestEndpointFailure.cdp:
+ * tests/DAnCE/Launch-Failures/descriptors/SourceEndpointFailure.cdp:
+ * tests/DAnCE/Launch-Failures/descriptors/besteffort.localityconfig:
+ * tests/DAnCE/Launch-Failures/descriptors/run_tests_besteffort.pl:
+
+ Expanded tested failure cases.
+
Fri Apr 8 09:22:17 UTC 2011 Marcel Smit <msmit@remedy.nl>
* connectors/dds4ccm/tests/Getter/Sender/Getter_Test_Sender_exec.cpp:
diff --git a/CIAO/tests/DAnCE/Launch-Failures/Component/Launch_Failure.idl b/CIAO/tests/DAnCE/Launch-Failures/Component/Launch_Failure.idl
index 41369f58289..da6ea30e51e 100644
--- a/CIAO/tests/DAnCE/Launch-Failures/Component/Launch_Failure.idl
+++ b/CIAO/tests/DAnCE/Launch-Failures/Component/Launch_Failure.idl
@@ -12,8 +12,11 @@ local interface Local_Interface
enum Failure_Reason
{
+ NO_ERROR,
ATTRIBUTE_EXCEPTION,
- NIL_FACET_REFERENCE
+ NIL_FACET_REFERENCE,
+ FACET_REFERENCE_EXCEPTION
+
};
exception Custom_Exception
@@ -26,7 +29,7 @@ component Launch_Failure
uses Remote_Interface remote_in;
provides Local_Interface local_out;
- provides Local_Interface local_in;
+ uses Local_Interface local_in;
attribute Failure_Reason failure_reason;
diff --git a/CIAO/tests/DAnCE/Launch-Failures/Component/Launch_Failure_exec.cpp b/CIAO/tests/DAnCE/Launch-Failures/Component/Launch_Failure_exec.cpp
index 4cb25b41eb1..5ef33ae41fc 100644
--- a/CIAO/tests/DAnCE/Launch-Failures/Component/Launch_Failure_exec.cpp
+++ b/CIAO/tests/DAnCE/Launch-Failures/Component/Launch_Failure_exec.cpp
@@ -86,7 +86,7 @@ namespace CIAO_Launch_Failure_Impl
*/
Launch_Failure_exec_i::Launch_Failure_exec_i (void)
- : failure_reason_ (static_cast< ::Failure_Reason> (0UL))
+ : failure_reason_ (NO_ERROR)
{
}
@@ -101,6 +101,11 @@ namespace CIAO_Launch_Failure_Impl
::CCM_Remote_Interface_ptr
Launch_Failure_exec_i::get_remote_out (void)
{
+ if (this->failure_reason_ == FACET_REFERENCE_EXCEPTION)
+ {
+ throw 1;
+ }
+
if ( ::CORBA::is_nil (this->ciao_remote_out_.in ()))
{
remote_out_exec_i *tmp = 0;
@@ -121,6 +126,11 @@ namespace CIAO_Launch_Failure_Impl
::CCM_Local_Interface_ptr
Launch_Failure_exec_i::get_local_out (void)
{
+ if (this->failure_reason_ == FACET_REFERENCE_EXCEPTION)
+ {
+ throw 1;
+ }
+
if ( ::CORBA::is_nil (this->ciao_local_out_.in ()))
{
local_out_exec_i *tmp = 0;
@@ -138,26 +148,6 @@ namespace CIAO_Launch_Failure_Impl
this->ciao_local_out_.in ());
}
- ::CCM_Local_Interface_ptr
- Launch_Failure_exec_i::get_local_in (void)
- {
- if ( ::CORBA::is_nil (this->ciao_local_in_.in ()))
- {
- local_in_exec_i *tmp = 0;
- ACE_NEW_RETURN (
- tmp,
- local_in_exec_i (
- this->ciao_context_.in ()),
- ::CCM_Local_Interface::_nil ());
-
- this->ciao_local_in_ = tmp;
- }
-
- return
- ::CCM_Local_Interface::_duplicate (
- this->ciao_local_in_.in ());
- }
-
::Failure_Reason
Launch_Failure_exec_i::failure_reason (void)
{
@@ -168,6 +158,9 @@ namespace CIAO_Launch_Failure_Impl
Launch_Failure_exec_i::failure_reason (
const ::Failure_Reason failure_reason)
{
+ if (failure_reason == ATTRIBUTE_EXCEPTION)
+ throw 1;
+
this->failure_reason_ = failure_reason;
}
diff --git a/CIAO/tests/DAnCE/Launch-Failures/Component/Launch_Failure_exec.h b/CIAO/tests/DAnCE/Launch-Failures/Component/Launch_Failure_exec.h
index 3a111ef73b5..e678623b9a6 100644
--- a/CIAO/tests/DAnCE/Launch-Failures/Component/Launch_Failure_exec.h
+++ b/CIAO/tests/DAnCE/Launch-Failures/Component/Launch_Failure_exec.h
@@ -130,9 +130,6 @@ namespace CIAO_Launch_Failure_Impl
virtual ::CCM_Local_Interface_ptr
get_local_out (void);
- virtual ::CCM_Local_Interface_ptr
- get_local_in (void);
-
virtual ::Failure_Reason failure_reason (void);
virtual void failure_reason (::Failure_Reason failure_reason);
diff --git a/CIAO/tests/DAnCE/Launch-Failures/descriptors/DestEndpointFailure.cdp b/CIAO/tests/DAnCE/Launch-Failures/descriptors/DestEndpointFailure.cdp
new file mode 100644
index 00000000000..3258911a1f1
--- /dev/null
+++ b/CIAO/tests/DAnCE/Launch-Failures/descriptors/DestEndpointFailure.cdp
@@ -0,0 +1,176 @@
+<!-- $Id$ -->
+<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>SimpleComponent_Home</label>
+ <UUID>SimpleComponent_Home</UUID>
+
+ <!-- Implementations declarations -->
+
+ <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>
+
+ <!-- Server Dance implementation-->
+ <implementation xmi:id="Launch_FailureComponentImplementation">
+ <name>Launch_FailureComponentImplementation</name>
+ <source/>
+ <artifact xmi:idref="Launch_Failure_ExecArtifact" />
+ <artifact xmi:idref="Launch_Failure_SvntArtifact" />
+ <execParameter>
+ <!-- entrypoint as exec parameter (see §10.6.1) -->
+ <name>component factory</name>
+ <value>
+ <type>
+ <kind>tk_string</kind>
+ </type>
+ <value>
+ <string>create_Launch_Failure_Impl</string>
+ </value>
+ </value>
+ </execParameter>
+ <execParameter>
+ <name>edu.vanderbilt.dre.CIAO.ServantEntrypoint</name>
+ <value>
+ <type>
+ <kind>tk_string</kind>
+ </type>
+ <value>
+ <string>create_Launch_Failure_Servant</string>
+ </value>
+ </value>
+ </execParameter>
+ <execParameter>
+ <name>edu.vanderbilt.dre.CIAO.ServantArtifact</name>
+ <value>
+ <type>
+ <kind>tk_string</kind>
+ </type>
+ <value>
+ <string>Launch_Failure_svnt</string>
+ </value>
+ </value>
+ </execParameter>
+ <execParameter>
+ <name>edu.vanderbilt.dre.CIAO.ExecutorArtifact</name>
+ <value>
+ <type>
+ <kind>tk_string</kind>
+ </type>
+ <value>
+ <string>Launch_Failure_exec</string>
+ </value>
+ </value>
+ </execParameter>
+ </implementation>
+
+ <instance xmi:id="CompSvrInst">
+ <name>ComponentServerInstance</name>
+ <node>NodeOne</node>
+ <source />
+ <implementation xmi:idref="CompSvrImpl" />
+ <configProperty>
+ <name>edu.vanderbilt.dre.DAnCE.LocalityArguments</name>
+ <value>
+ <type>
+ <kind>tk_string</kind>
+ </type>
+ <value>
+ <string>--plugin-config besteffort.localityconfig</string>
+ </value>
+ </value>
+ </configProperty>
+ </instance>
+
+ <instance xmi:id="Launch_FailureComponentInstanceOne">
+ <name>Launch_FailureComponent_One</name>
+ <node>NodeOne</node>
+ <!-- hostname -->
+ <source/>
+ <implementation xmi:idref="Launch_FailureComponentImplementation" />
+ <configProperty>
+ <name>failure_reason</name>
+ <value>
+ <type>
+ <kind>tk_enum</kind>
+ <enum>
+ <name>Failure_Reason</name>
+ <typeId>IDL:Failure_Reason:1.0</typeId>
+ <member>NO_ERROR</member>
+ <member>ATTRIBUTE_EXCEPTION</member>
+ <member>NIL_FACET_REFERENCE</member>
+ <member>FACET_REFERENCE_EXCEPTION</member>
+ </enum>
+ </type>
+ <value>
+ <enum>ATTRIBUTE_EXCEPTION</enum>
+ </value>
+ </value>
+ </configProperty>
+ </instance>
+
+ <instance xmi:id="Launch_FailureComponentInstanceTwo">
+ <name>Launch_FailureComponent_Two</name>
+ <node>NodeTwo</node>
+ <!-- hostname -->
+ <source/>
+ <implementation xmi:idref="Launch_FailureComponentImplementation" />
+ </instance>
+
+ <connection>
+ <name>FailureTwo_Connection</name>
+ <internalEndpoint>
+ <portName>remote_out</portName>
+ <provider>true</provider>
+ <kind>Facet</kind>
+ <instance xmi:idref="Launch_FailureComponentInstanceTwo" />
+ </internalEndpoint>
+ <internalEndpoint>
+ <portName>remote_in</portName>
+ <provider>false</provider>
+ <kind>SimplexReceptacle</kind>
+ <instance xmi:idref="Launch_FailureComponentInstanceOne" />
+ </internalEndpoint>
+ </connection>
+ <!-- Artifacts declarations -->
+ <artifact xmi:id="CompSvrArt">
+ <name>CompoSvrArtifactName</name>
+ <source />
+ <node />
+ <location>dance_locality_manager</location>
+ </artifact>
+ <artifact xmi:id="Launch_Failure_ExecArtifact">
+ <name>Launch_Failure_exec</name>
+ <source/>
+ <node/>
+ <location>Launch_Failure_exec</location>
+ </artifact>
+ <artifact xmi:id="Launch_Failure_SvntArtifact">
+ <name>Launch_Failure_svnt</name>
+ <source/>
+ <node/>
+ <location>Launch_Failure_svnt</location>
+ </artifact>
+
+ <localityConstraint>
+ <constraint>SameProcess</constraint>
+ <constrainedInstance xmi:idref="CompSvrInst" />
+ <constrainedInstance xmi:idref="Launch_FailureComponentInstanceOne" />
+ </localityConstraint>
+
+ </Deployment:DeploymentPlan>
diff --git a/CIAO/tests/DAnCE/Launch-Failures/descriptors/SourceEndpointFailure.cdp b/CIAO/tests/DAnCE/Launch-Failures/descriptors/SourceEndpointFailure.cdp
new file mode 100644
index 00000000000..29c9b236956
--- /dev/null
+++ b/CIAO/tests/DAnCE/Launch-Failures/descriptors/SourceEndpointFailure.cdp
@@ -0,0 +1,176 @@
+<!-- $Id$ -->
+<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>SimpleComponent_Home</label>
+ <UUID>SimpleComponent_Home</UUID>
+
+ <!-- Implementations declarations -->
+
+ <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>
+
+ <!-- Server Dance implementation-->
+ <implementation xmi:id="Launch_FailureComponentImplementation">
+ <name>Launch_FailureComponentImplementation</name>
+ <source/>
+ <artifact xmi:idref="Launch_Failure_ExecArtifact" />
+ <artifact xmi:idref="Launch_Failure_SvntArtifact" />
+ <execParameter>
+ <!-- entrypoint as exec parameter (see §10.6.1) -->
+ <name>component factory</name>
+ <value>
+ <type>
+ <kind>tk_string</kind>
+ </type>
+ <value>
+ <string>create_Launch_Failure_Impl</string>
+ </value>
+ </value>
+ </execParameter>
+ <execParameter>
+ <name>edu.vanderbilt.dre.CIAO.ServantEntrypoint</name>
+ <value>
+ <type>
+ <kind>tk_string</kind>
+ </type>
+ <value>
+ <string>create_Launch_Failure_Servant</string>
+ </value>
+ </value>
+ </execParameter>
+ <execParameter>
+ <name>edu.vanderbilt.dre.CIAO.ServantArtifact</name>
+ <value>
+ <type>
+ <kind>tk_string</kind>
+ </type>
+ <value>
+ <string>Launch_Failure_svnt</string>
+ </value>
+ </value>
+ </execParameter>
+ <execParameter>
+ <name>edu.vanderbilt.dre.CIAO.ExecutorArtifact</name>
+ <value>
+ <type>
+ <kind>tk_string</kind>
+ </type>
+ <value>
+ <string>Launch_Failure_exec</string>
+ </value>
+ </value>
+ </execParameter>
+ </implementation>
+
+ <instance xmi:id="CompSvrInst">
+ <name>ComponentServerInstance</name>
+ <node>NodeOne</node>
+ <source />
+ <implementation xmi:idref="CompSvrImpl" />
+ <configProperty>
+ <name>edu.vanderbilt.dre.DAnCE.LocalityArguments</name>
+ <value>
+ <type>
+ <kind>tk_string</kind>
+ </type>
+ <value>
+ <string>--plugin-config besteffort.localityconfig</string>
+ </value>
+ </value>
+ </configProperty>
+ </instance>
+
+ <instance xmi:id="Launch_FailureComponentInstanceOne">
+ <name>Launch_FailureComponent_One</name>
+ <node>NodeOne</node>
+ <!-- hostname -->
+ <source/>
+ <implementation xmi:idref="Launch_FailureComponentImplementation" />
+ <configProperty>
+ <name>failure_reason</name>
+ <value>
+ <type>
+ <kind>tk_enum</kind>
+ <enum>
+ <name>Failure_Reason</name>
+ <typeId>IDL:Failure_Reason:1.0</typeId>
+ <member>NO_ERROR</member>
+ <member>ATTRIBUTE_EXCEPTION</member>
+ <member>NIL_FACET_REFERENCE</member>
+ <member>FACET_REFERENCE_EXCEPTION</member>
+ </enum>
+ </type>
+ <value>
+ <enum>ATTRIBUTE_EXCEPTION</enum>
+ </value>
+ </value>
+ </configProperty>
+ </instance>
+
+ <instance xmi:id="Launch_FailureComponentInstanceTwo">
+ <name>Launch_FailureComponent_Two</name>
+ <node>NodeTwo</node>
+ <!-- hostname -->
+ <source/>
+ <implementation xmi:idref="Launch_FailureComponentImplementation" />
+ </instance>
+
+ <connection>
+ <name>FailureOne_Connection</name>
+ <internalEndpoint>
+ <portName>remote_out</portName>
+ <provider>true</provider>
+ <kind>Facet</kind>
+ <instance xmi:idref="Launch_FailureComponentInstanceOne" />
+ </internalEndpoint>
+ <internalEndpoint>
+ <portName>remote_in</portName>
+ <provider>false</provider>
+ <kind>SimplexReceptacle</kind>
+ <instance xmi:idref="Launch_FailureComponentInstanceTwo" />
+ </internalEndpoint>
+ </connection>
+ <!-- Artifacts declarations -->
+ <artifact xmi:id="CompSvrArt">
+ <name>CompoSvrArtifactName</name>
+ <source />
+ <node />
+ <location>dance_locality_manager</location>
+ </artifact>
+ <artifact xmi:id="Launch_Failure_ExecArtifact">
+ <name>Launch_Failure_exec</name>
+ <source/>
+ <node/>
+ <location>Launch_Failure_exec</location>
+ </artifact>
+ <artifact xmi:id="Launch_Failure_SvntArtifact">
+ <name>Launch_Failure_svnt</name>
+ <source/>
+ <node/>
+ <location>Launch_Failure_svnt</location>
+ </artifact>
+
+ <localityConstraint>
+ <constraint>SameProcess</constraint>
+ <constrainedInstance xmi:idref="CompSvrInst" />
+ <constrainedInstance xmi:idref="Launch_FailureComponentInstanceOne" />
+ </localityConstraint>
+
+ </Deployment:DeploymentPlan>
diff --git a/CIAO/tests/DAnCE/Launch-Failures/descriptors/besteffort.localityconfig b/CIAO/tests/DAnCE/Launch-Failures/descriptors/besteffort.localityconfig
new file mode 100644
index 00000000000..685c561bfbe
--- /dev/null
+++ b/CIAO/tests/DAnCE/Launch-Failures/descriptors/besteffort.localityconfig
@@ -0,0 +1,7 @@
+edu.vanderbilt.dre.DAnCE.InstanceHandler CIAO_Deployment_Handlers create_Container_Handler
+edu.vanderbilt.dre.DAnCE.InstanceHandler CIAO_Deployment_Handlers create_Home_Handler
+edu.vanderbilt.dre.DAnCE.InstanceHandler CIAO_Deployment_Handlers create_Component_Handler
+edu.vanderbilt.dre.DAnCE.InstanceHandler CIAO_Deployment_Handlers create_Homed_Component_Handler
+edu.vanderbilt.dre.DAnCE.DeploymentInterceptor CIAO_Deployment_Interceptors create_CIAO_StoreReferences
+edu.vanderbilt.dre.DAnCE.DeploymentInterceptor DAnCE_Error_Interceptors create_DAnCE_Best_Effort
+
diff --git a/CIAO/tests/DAnCE/Launch-Failures/descriptors/run_tests_besteffort.pl b/CIAO/tests/DAnCE/Launch-Failures/descriptors/run_tests_besteffort.pl
new file mode 100755
index 00000000000..cd8c9f44e43
--- /dev/null
+++ b/CIAO/tests/DAnCE/Launch-Failures/descriptors/run_tests_besteffort.pl
@@ -0,0 +1,237 @@
+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'}";
+
+$ENV{'CIAO_LOG_LEVEL'}=0;
+
+$daemons_running = 0;
+$em_running = 0;
+$ns_running = 0;
+
+$nr_daemon = 2;
+@ports = ( 60001, 60002 );
+@iorbases = ( "NodeApp1.ior", "NodeApp2.ior" );
+@iorfiles = 0;
+@nodenames = ( "NodeOne", "NodeTwo" );
+
+@plans = ("SourceEndpointFailure.cdp");
+@nr_plans = 1;
+
+# 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;
+
+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 daemon $i failed\n";
+ $tg_daemons[$i]->AddLibPath ('../lib');
+ $tg_daemons[$i]->AddLibPath ('../lib_stub');
+ }
+ # 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_localities {
+ for ($i = 0; $i < $nr_daemon; ++$i) {
+ # in case shutdown did not perform as expected
+ $tg_daemons[$i]->KillAll ('dance_locality_manager');
+ }
+}
+
+sub kill_node_daemons {
+ for ($i = 0; $i < $nr_daemon; ++$i) {
+ $DEAMONS[$i]->Kill (); $DEAMONS[$i]->TimedWait (1);
+ }
+ kill_localities ();
+}
+
+sub kill_open_processes {
+ if ($daemons_running == 1) {
+ kill_node_daemons ();
+ }
+
+ if ($em_running == 1) {
+ $EM->Kill (); $EM->TimedWait (1);
+ }
+
+ if ($ns_running == 1) {
+ $NS->Kill (); $NS->TimedWait (1);
+ }
+}
+
+
+sub run_node_daemons {
+ for ($i = 0; $i < $nr_daemon; ++$i) {
+ $iorbase = $iorbases[$i];
+ $iorfile = $iorfiles[$i];
+ $port = $ports[$i];
+ $nodename = $nodenames[$i];
+ $node_host = $tg_daemons[$i]->HostName ();
+ $iiop = "iiop://$node_host:$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 --instance-nc corbaloc:rir:/NameService";
+
+ print "Run node daemon\n";
+
+ ## add NameService env setting to node targets
+ $tg_daemons[$i]->SetEnv ('NameServiceIOR', $tg_exe_man->GetEnv ("NameServiceIOR"));
+
+ $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";
+
+ print STDERR "Starting Naming Service\n";
+
+ my $ns_host = $tg_naming->HostName ();
+ $NS = $tg_naming->CreateProcess ("$TAO_ROOT/orbsvcs/Naming_Service/tao_cosnaming", "-m 0 -ORBEndpoint iiop://$ns_host:60003 -o $ior_nsfile");
+ $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->TimedWait (1);
+ exit 1;
+ }
+
+ $ns_running = 1;
+ # Set up NamingService environment
+ $tg_exe_man->SetEnv ("NameServiceIOR", "corbaloc:iiop:$ns_host:60003/NameService");
+ $tg_executor->SetEnv ("NameServiceIOR", "corbaloc:iiop:$ns_host: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 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 --domain-nc corbaloc:rir:/NameService");
+ $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";
+ $E = $tg_executor->CreateProcess ("$DANCE_ROOT/bin/dance_plan_launcher",
+ "-x $file -k file://$ior_emfile -l");
+ $E->SpawnWaitKill (120);
+
+ print "Teardown the application\n";
+ $E = $tg_executor->CreateProcess ("$DANCE_ROOT/bin/dance_plan_launcher",
+ "-k file://$ior_emfile -x $file -s");
+ $E->SpawnWaitKill (120);
+ print "Executor finished.\n";
+
+ delete_ior_files ();
+ kill_open_processes ();
+
+ $daemons_running = 0;
+
+ # Sleep for a couple seconds to make sure everything has a chance to shut down.
+ sleep 5;
+}
+
+delete_ior_files ();
+kill_open_processes ();
+
+exit $status;