From d7af9170bb8be7d35f2bcc996561b028f441fdd3 Mon Sep 17 00:00:00 2001 From: nanbor Date: Mon, 24 Nov 2003 03:59:30 +0000 Subject: ChangeLogTag:Sun Nov 23 20:45:24 2003 Nanbor Wang --- .../RTCCM/Priority_Test/descriptors/NOTE-win.txt | 6 +- .../RTCCM/Priority_Test/descriptors/basic_test.pl | 116 +++++++++++++++++++++ .../tools/Assembly_Deployer/Assembly_Deployer.cpp | 51 ++++++--- TAO/CIAO/tools/Daemon/CIAO_Daemon.cpp | 9 +- 4 files changed, 165 insertions(+), 17 deletions(-) create mode 100755 TAO/CIAO/tests/RTCCM/Priority_Test/descriptors/basic_test.pl diff --git a/TAO/CIAO/tests/RTCCM/Priority_Test/descriptors/NOTE-win.txt b/TAO/CIAO/tests/RTCCM/Priority_Test/descriptors/NOTE-win.txt index b81a4099026..abb666d5671 100644 --- a/TAO/CIAO/tests/RTCCM/Priority_Test/descriptors/NOTE-win.txt +++ b/TAO/CIAO/tests/RTCCM/Priority_Test/descriptors/NOTE-win.txt @@ -1,6 +1,8 @@ Conventional test: ================== +SET CIAO_DEBUG_LEVEL=25 + Remote Daemon: -------------- @@ -29,7 +31,9 @@ Assembly Deployer w:\TAO\CIAO\tests\RTCCM\Priority_Test\descriptors\ title Assembly Deployer - .....\tools\Assembly_Deployer\Assembly_Deployer -k file://ior -a demo.cad + .....\tools\Assembly_Deployer\Assembly_Deployer -k file://ior -o ck_file -a demo.cad + + .....\tools\Assembly_Deployer\Assembly_Deployer -k file://ior -d ck_file client ------ diff --git a/TAO/CIAO/tests/RTCCM/Priority_Test/descriptors/basic_test.pl b/TAO/CIAO/tests/RTCCM/Priority_Test/descriptors/basic_test.pl new file mode 100755 index 00000000000..1e5b437d1ba --- /dev/null +++ b/TAO/CIAO/tests/RTCCM/Priority_Test/descriptors/basic_test.pl @@ -0,0 +1,116 @@ +eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' + & eval 'exec perl -S $0 $argv:q' + if 0; + +# $Id$ +# -*- perl -*- + +# +# @@ Run this script from ../descriptors/ instead. +# + +use lib "$ENV{'ACE_ROOT'}/bin"; +use PerlACE::Run_Test; + +$status = 0; +$assembly = PerlACE::LocalFile ("demo.cad"); +$daemon_ior = PerlACE::LocalFile ("daemon.ior"); +$am_ior = PerlACE::LocalFile ("am.ior"); +$controller_ior = PerlACE::LocalFile ("controller.ior"); +$cookie = PerlACE::LocalFile ("ck_demo_deployment"); + +$ACE_ROOT=$ENV{'ACE_ROOT'}; +$CIAO_ROOT=$ENV{'CIAO_ROOT'}; + +if ($CIAO_ROOT eq "") { + $CIAO_ROOT="$ACE_ROOT/TAO/CIAO"; +} + +unlink $daemon_ior; +unlink $am_ior; +unlink $cookie; + + +# CIAO Daemon command line arguments +$daemon_args1 = "-ORBEndpoint iiop://localhost:10000 -o $daemon_ior -i CIAO_Installation_Data.ini -n $CIAO_ROOT/tools/ComponentServer/ComponentServer"; + +$assembly_manager_args = "-o $am_ior -c test.dat"; + +$ad_deploy = " -k file://$am_ior -o $cookie -a demo.cad"; + +$ad_teardown = " -k file://$am_ior -d $cookie -x"; + +# CIAO daemon process definition +$DS = new PerlACE::Process ("$CIAO_ROOT/tools/Daemon/CIAO_Daemon", + "$daemon_args1"); + +## Starting up the CIAO daemon +$DS->Spawn (); +if (PerlACE::waitforfile_timed ($daemon_ior, 15) == -1) { + print STDERR "ERROR: Could not find daemon ior file <$daemon_ior>\n"; + $DS->Kill (); + exit 1; +} + +## Starting up the CIAO Assembly Manager +$AM = new PerlACE::Process("$CIAO_ROOT/tools/Assembly_Deployer/Assembly_Manager", + $assembly_manager_args); +$AM->Spawn (); +if (PerlACE::waitforfile_timed ($am_ior, 15) == -1) { + print STDERR "ERROR: Could not find assembly ior file <$am_ior>\n"; + $AM->Kill (); + $DS->Kill (); + exit 1; +} + +## Now actually deploy the application +$AD = new PerlACE::Process("$CIAO_ROOT/tools/Assembly_Deployer/Assembly_Deployer", + $ad_deploy); +if ($AD->SpawnWaitKill (60) == -1) { + print STDERR "ERROR: Failed to deploy assembly file <$assembly>\n"; + $AD->Kill (); + $AM->Kill (); + $DS->Kill (); +} + +## Make sure the application is up and running +if (PerlACE::waitforfile_timed ($controller_ior, 15) == -1) { + print STDERR "ERROR: Could not find controller ior file <$controller_ior>\n"; + $AM->Kill (); + $DS->Kill (); + exit 1; +} + +#Start the client to send the trigger message +$CL = new PerlACE::Process ("../Controllers/client", "-k file://$controller_ior"); +$CL->SpawnWaitKill(60); + +## Now wait for the test to complete. Need to figure out a way to +## detect this. +sleep (60); + +## Now teardown the application +$AD = new PerlACE::Process("$CIAO_ROOT/tools/Assembly_Deployer/Assembly_Deployer", + $ad_teardown); +if ($AD->SpawnWaitKill (60) == -1) { + print STDERR "ERROR: Failed to teardown assembly file <$assembly>\n"; + $AD->Kill (); + $AM->Kill (); + $DS->Kill (); + exit 1; +} + +#$ctrl = $DS->WaitKill (5); +#$AM->WaitKill(5); +#$AD->WaitKill(5); + +$AM->WaitKill (40); +$DS->Kill (); + + +unlink $cookie; +unlink $controller_ior; +unlink $daemon_ior; +unlink $am_ior; + +exit $status; diff --git a/TAO/CIAO/tools/Assembly_Deployer/Assembly_Deployer.cpp b/TAO/CIAO/tools/Assembly_Deployer/Assembly_Deployer.cpp index aa6032190e7..5efaf6cf80d 100644 --- a/TAO/CIAO/tools/Assembly_Deployer/Assembly_Deployer.cpp +++ b/TAO/CIAO/tools/Assembly_Deployer/Assembly_Deployer.cpp @@ -2,7 +2,8 @@ #include "CCM_DeploymentC.h" #include "Assembly_ServiceC.h" -#include "Client_init.h" +#include "Server_init.h" +#include "Cookies.h" #include "ace/Get_Opt.h" #include "ace/streams.h" #include "ace/High_Res_Timer.h" @@ -78,9 +79,13 @@ parse_args (int argc, char *argv[]) } void -create_assembly (Components::Deployment::AssemblyFactory_ptr *factory +create_assembly (Components::Deployment::AssemblyFactory_ptr factory ACE_ENV_ARG_DECL_WITH_DEFAULTS) { + ACE_High_Res_Timer overall, make_assembly, build_assembly; + overall.start (); // Start measuring the overall time to + // deploy an application. + ACE_DEBUG ((LM_DEBUG, "Creating an Assembly with %s\n", cad)); make_assembly.start (); // Start measuring the time to parse a @@ -120,38 +125,60 @@ create_assembly (Components::Deployment::AssemblyFactory_ptr *factory build_time.sec (), build_time.usec ())); } + ACE_Active_Map_Manager_Key key; + CIAO::Map_Key_Cookie::extract (ck.in (), key); + // Output Cookie value here. + FILE *ckh = ACE_OS::fopen (cookie_output, "w"); + if (ckh != NULL) + { + ACE_OS::fprintf (ckh, "%d %d", + key.slot_index (), + key.slot_generation ()); + ACE_OS::fclose (ckh); + } + else + ACE_ERROR ((LM_ERROR, "Unable to open cookie file: %s\n", cookie_output)); } void -teardown_assembly (Components::Deployment::AssemblyFactory_ptr *factory +teardown_assembly (Components::Deployment::AssemblyFactory_ptr factory ACE_ENV_ARG_DECL_WITH_DEFAULTS) { // Extract and restore Cookie value (ck) here. + ACE_UINT32 i, g; + FILE *ckh = ACE_OS::fopen (cookie_teardown, "r"); + if (ckh != NULL) + { + fscanf (ckh, "%d %d", &i, &g); + ACE_OS::fclose (ckh); + } + else + ACE_ERROR ((LM_ERROR, "Unable to open cookie file: %s\n", cookie_teardown)); + + CIAO::Map_Key_Cookie ck; + ACE_Active_Map_Manager_Key key (i, g); + ck.insert (key); // Look up the assembly from the factory. Components::Deployment::Assembly_var assembly = - factory->lookup (ck.in () + factory->lookup (&ck ACE_ENV_ARG_PARAMETER); ACE_CHECK; assembly->tear_down (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK; + ACE_CHECK; - factory->destroy (ck.in () + factory->destroy (&ck ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; + ACE_CHECK; } int main (int argc, char *argv[]) { - ACE_High_Res_Timer overall, make_assembly, build_assembly; - overall.start (); // Start measuring the overall time to - // deploy an application. - ACE_TRY_NEW_ENV { CORBA::ORB_var orb = @@ -161,7 +188,7 @@ main (int argc, char *argv[]) if (parse_args (argc, argv) != 0) return 1; - CIAO::Client_init (orb.in ()); + CIAO::Server_init (orb.in ()); CORBA::Object_var tmp = orb->string_to_object(ior ACE_ENV_ARG_PARAMETER); diff --git a/TAO/CIAO/tools/Daemon/CIAO_Daemon.cpp b/TAO/CIAO/tools/Daemon/CIAO_Daemon.cpp index 4b35736a974..6cac39afbe1 100644 --- a/TAO/CIAO/tools/Daemon/CIAO_Daemon.cpp +++ b/TAO/CIAO/tools/Daemon/CIAO_Daemon.cpp @@ -83,10 +83,11 @@ parse_args (int argc, char *argv[]) } // Perform some minimum test of the validity of the arguments here. - ACE_stat csstat; - if (ACE_OS::stat (comserv_path_, &csstat) != 0) - ACE_ERROR_RETURN ((LM_ERROR, - "Invalid pathname for ComponentServer\n"), -1); + // @@ This didn't work well because of win32 file extension name. +// ACE_stat csstat; +// if (ACE_OS::stat (comserv_path_, &csstat) != 0) +// ACE_DEBUG ((LM_ERROR, +// "Invalid pathname for ComponentServer\n"), -1); return 0; } -- cgit v1.2.1