diff options
Diffstat (limited to 'modules/CIAO/bin')
-rw-r--r-- | modules/CIAO/bin/PerlCIAO/TestUtils.base | 3 | ||||
-rw-r--r-- | modules/CIAO/bin/PerlCIAO/TestUtils.pm | 323 | ||||
-rw-r--r-- | modules/CIAO/bin/PerlCIAO/TestUtils_Base.pm | 78 | ||||
-rwxr-xr-x | modules/CIAO/bin/PerlCIAO/generate_container.pl | 126 | ||||
-rw-r--r-- | modules/CIAO/bin/PerlCIAO/perlciao.mpc | 10 | ||||
-rw-r--r-- | modules/CIAO/bin/ciao_tests.lst | 36 | ||||
-rwxr-xr-x | modules/CIAO/bin/generate_component_mpc.pl | 306 | ||||
-rwxr-xr-x | modules/CIAO/bin/update_package.py | 118 | ||||
-rwxr-xr-x | modules/CIAO/bin/valgrind_nodedaemon.py | 87 |
9 files changed, 1087 insertions, 0 deletions
diff --git a/modules/CIAO/bin/PerlCIAO/TestUtils.base b/modules/CIAO/bin/PerlCIAO/TestUtils.base new file mode 100644 index 00000000000..7e68a521d2f --- /dev/null +++ b/modules/CIAO/bin/PerlCIAO/TestUtils.base @@ -0,0 +1,3 @@ +processes +files +wd diff --git a/modules/CIAO/bin/PerlCIAO/TestUtils.pm b/modules/CIAO/bin/PerlCIAO/TestUtils.pm new file mode 100644 index 00000000000..6cb4ca22fe7 --- /dev/null +++ b/modules/CIAO/bin/PerlCIAO/TestUtils.pm @@ -0,0 +1,323 @@ + +#------------------------------------------------------------------------ +# class: TestUtils +# Author: Stoyan Paunov +# +# Description: This is a class to help us write better and more manage- +# able test utilities. Usually when creating a test in +# CIAO it has to do with deploying a number of managers +# and failure to deploy any process means failure of the +# test. This test utility class takes care of the error +# handling and clean-up and side of testing and allows +# the test writer to concentrate on the core logic. +# These are the main advantages of the TestUtils class: +# --> Semi-Automatic error handling +# --> Automatic process shutdown and clean-up +# --> Semi-Automatic file (IOR) deletion +# --> Location independent tests +# --> Clean and concise code base +# --> Manageable test utility suites +#------------------------------------------------------------------------ + +# class TestUtils +sub new; +sub DESTROY; +sub cleanup; +sub goto_dir; +sub spawn; +sub terminate; +sub required_file; +sub required_files; +sub mark_file; +sub mark_files; +sub remove_file; +sub remove_files; +sub cleanup_files; +sub cleanup_processes; + +package TestUtils; +use PerlCIAO::TestUtils_Base; +use strict; +our @ISA = qw(TestUtils_Base); # inherits from TestUtils_Base + +use lib "$ENV{'ACE_ROOT'}/bin"; +use PerlACE::Run_Test; +use Cwd; + +#------------------------------------------------------------------------ +# Constructor +#------------------------------------------------------------------------ +sub new { + my $class = shift; + + #call the constructor of the parent class, TestUtils_Base. + my $self = $class->SUPER::new(); + + $self->{_wd} = getcwd; + + bless $self, $class; + return $self; +} + +#------------------------------------------------------------------------ +# Destructor: performs clean-up +#------------------------------------------------------------------------ + +sub DESTROY { + my $self = shift; + + #$self->cleanup (); check the CLEAN-UP description for explanation +} + +#------------------------------------------------------------------------ +# Cleanup: This fuction kills the spawned processes and deletes the +# marked files. Optionally, once the cleanup is done it will +# cause the program to exit, iff an exit code is specified. +# +# +# NOTE: You need to call the cleanup () although it is called +# in the destructor because this class is a wrapper around +# PerlACE::Run_Test which also keep some internal state +# and tries to do some clean-up. However its destructor +# is called before this one, and this results in some +# errors. +#------------------------------------------------------------------------ + +sub cleanup { + my $self = shift; + my $exit_code = shift; + + print "Performing clean-up ...\n"; + + $self->cleanup_files (); + $self->cleanup_processes (); + + print "Cleanup = DONE\n"; + + chdir $self->wd (); + + if (defined ($exit_code)) { + exit ($exit_code); + } +} + +#------------------------------------------------------------------------ +# Goto_dir: This function allows you to change the current working +# directory. Note that the class returns to the original +# working directory upon exit. +#------------------------------------------------------------------------ + +#TODO: might want to push the dir to some stack +sub goto_dir { + my $self = shift; + my $dir = shift; + + if (! (chdir $dir)) { + print STDERR "Failed to change directory to: $dir"; + $self->cleanup (); + } + +} + +#------------------------------------------------------------------------ +# Spawn: This function is used to spawn a process. It takes a descriptive +# name under which it stores the process, the command line and the +# arguments needed by the command. Optionally, you could specify +# a timeout based on which the process would be spawned and if +# it has not terminated after timeout seconds it will be killed. +# If a failure occurs the function will perform clean-up and +# terminate the program. +#------------------------------------------------------------------------ + +sub spawn { + my $self = shift; + my $name = shift; + my $cmd = shift; + my $args = shift; + my $timeout = shift; + + if (!defined ($self->processes ())) { + $self->{_processes} = {}; + } + + my $process = new PerlACE::Process ($cmd, $args); + + if (defined ($timeout)) { + if ((my $ret = $process->SpawnWaitKill ($timeout)) == -1) { + print STDERR "ERROR: Process $name returned $ret.\n"; + $self->cleanup (1); + } + } + else { + if ($process->Spawn () == -1) { + $process->Kill (); + #just in case, lets add it to the process list + $self->processes->{$name} = $process; + print STDERR "ERROR: Failure to spawn $name.\n"; + $self->cleanup (1); + } + } + + $self->processes->{$name} = $process; + return $process; +} + +#------------------------------------------------------------------------ +# Terminate: This function takes in the descriptive process name passed +# to Spawn, looks up the process corresponding to it and +# kills it. +#------------------------------------------------------------------------ + +sub terminate { + my $self = shift; + my $pname = shift; + + $self->processes ()->{$pname}->Kill (); + $self->processes ()->{$pname}->TimedWait (1); + + print STDERR "$pname teminated!\n"; +} + +#------------------------------------------------------------------------ +# Required_file: This function checks if a required file is present in +# the current working directory. If the file is missing +# it performs cleanup and causes the program to exit. +#------------------------------------------------------------------------ + +sub required_file { + my $self = shift; + my $file = shift; + + if (PerlACE::waitforfile_timed + ($file, $PerlACE::wait_interval_for_process_creation) == -1) { + + print STDERR + "ERROR: Required file $file could not be found.\n"; + + $self->cleanup (1); + } + return 1; +} + +#------------------------------------------------------------------------ +# Required_filez: This function does the same as required_file above +# except that it works on a reference (REF) to a list +# of required files. +#------------------------------------------------------------------------ + +sub required_files { + my $self = shift; + my $files = shift; + my $pname = shift; + + foreach my $file (@{$files}) { + + if (PerlACE::waitforfile_timed + ($file, $PerlACE::wait_interval_for_process_creation) == -1) { + + print STDERR + "ERROR: Required file $file could not be found.\n"; + + $self->cleanup (1); + } + } + return 1; +} + +#------------------------------------------------------------------------ +# Mark_file: This function marks a file from the current working +# directory for deletion. Once the file is marked it will be +# deleted upon program termination. If the file cannot be +# found, it is ignored. +#------------------------------------------------------------------------ + +sub mark_file { + my $self = shift; + my $file = shift; + + if (!defined $self->files ()) { + $self->{_files} = []; + } + + push @{$self->files ()}, $file; +} + +#------------------------------------------------------------------------ +# Mark_filez: This function does the same as mark_file above except +# that it works on a reference (REF) to an array/list of +# required files. +#------------------------------------------------------------------------ + +sub mark_files { + my $self = shift; + my $files = shift; + + if (!defined $self->files ()) { + $self->{_files} = []; + } + + foreach my $file (@{$files}) { + push @{$self->files ()}, $file; + } +} + +#------------------------------------------------------------------------ +# Remove_file: This fuction removes a file from the current working +# directory. If the file is not there, it is ignored. +#------------------------------------------------------------------------ + +sub remove_file { + my $self = shift; + my $file = shift; + + my $path = PerlACE::LocalFile ($file); + unlink $path; +} + +#------------------------------------------------------------------------ +# Remove_filez: This fuction removes a list of file from the current +# working directory. It takes a REF of a list of files +# and ignores files which are not found. +#------------------------------------------------------------------------ + +sub remove_files { + my $self = shift; + my $files = shift; + + foreach my $file (@{$files}) { + my $path = PerlACE::LocalFile ($file); + unlink $path; + } +} + +#------------------------------------------------------------------------ +# Cleanup_files: clean us the files :) +#------------------------------------------------------------------------ + +sub cleanup_files { + my $self = shift; + + if (defined ($self->files ())) { + foreach my $file (@{$self->files ()}) { + $self->remove_file ($file); + } + } +} + +#------------------------------------------------------------------------ +# Cleanup_processes: clean us the processes :) +#------------------------------------------------------------------------ + +sub cleanup_processes { + my $self = shift; + + if (defined ($self->processes ())) { + foreach my $pname ( keys %{$self->processes ()}) { + $self->terminate ($pname); + delete ($self->processes ()->{$pname}); + } + } +} + +#return value of the class +1;
\ No newline at end of file diff --git a/modules/CIAO/bin/PerlCIAO/TestUtils_Base.pm b/modules/CIAO/bin/PerlCIAO/TestUtils_Base.pm new file mode 100644 index 00000000000..be0726946c9 --- /dev/null +++ b/modules/CIAO/bin/PerlCIAO/TestUtils_Base.pm @@ -0,0 +1,78 @@ +#File generated by C:\ACE_wrappers_devel\ACE_wrappers\TAO\CIAO\bin\PerlCIAO\generate_container.pl. +#Input file: TestUtils.base. +#Code generator author: Stoyan Paunov +# + +#class TestUtils_Base +package TestUtils_Base; +use strict; + +#Class constructor :) +sub new { + my ($class) = @_; + + #Create a reference to an anonymous hash + my $self = { + _processes => undef, + _files => undef, + _wd => undef + }; + + #Bless the hash. + bless $self, $class; + return $self; +} + +#accessor/mutator method for processes +sub processes { + my ( $self, $processes ) = @_; + + $self->{_processes} = $processes + if defined ($processes); + + return $self->{_processes}; +} + +#accessor/mutator method for files +sub files { + my ( $self, $files ) = @_; + + $self->{_files} = $files + if defined ($files); + + return $self->{_files}; +} + +#accessor/mutator method for wd +sub wd { + my ( $self, $wd ) = @_; + + $self->{_wd} = $wd + if defined ($wd); + + return $self->{_wd}; +} + +#print method for the class +sub print { + my ($self) = @_; + + my $f; + + $f = defined ($self->{_processes}) + ? $self->{_processes} : "not defined"; + printf ("processes: %s\n", $f); + + $f = defined ($self->{_files}) + ? $self->{_files} : "not defined"; + printf ("files: %s\n", $f); + + $f = defined ($self->{_wd}) + ? $self->{_wd} : "not defined"; + printf ("wd: %s\n", $f); + +} + +#class return value +1; + diff --git a/modules/CIAO/bin/PerlCIAO/generate_container.pl b/modules/CIAO/bin/PerlCIAO/generate_container.pl new file mode 100755 index 00000000000..c56c03ea300 --- /dev/null +++ b/modules/CIAO/bin/PerlCIAO/generate_container.pl @@ -0,0 +1,126 @@ +#!/usr/bin/perl +# +# $Id$ +# +# The above line is for compatibility /w Linux. Windows uses the .pl extension. +# Author: Stoyan Paunov +# Purpose: Generate a container class with mutator/accessor methods +# The idea is to use this class as a base class in the +# inheritance hierarchy. This way we can evolve the base +# container independently from the rest of the code! +# + +use strict; + +die "Usage: $0 <module name> <field description file>\n" + if not defined $ARGV[0]; + +die "Usage: $0 <module name> <field description file>\n" + if not defined $ARGV[1]; + +my $module_name = $ARGV[0]; +my $fields = $ARGV[1]; + +open (FIELDS, $fields) or die "Failed opening $fields\n"; + +my @fields = <FIELDS>; +close FIELDS; + +my $field; + +print "\#File generated by $0.\n"; +print "\#Input file: $fields.\n"; +print "\#Code generator author: Stoyan Paunov\n\#\n\n"; + +print "\#class $module_name\n"; +print "package $module_name;\n"; +print "use strict;\n\n"; +print "\#Class constructor :)\n"; +print "sub new {\n"; +print " my (\$class) = \@_;\n\n"; +print " \#Create a reference to an anonymous hash\n"; +print " my \$self = {\n"; + +my $count = 0; +my $end = $#fields; + +#generate initialization code +foreach $field (@fields) +{ + if ($field =~ /^$/ ) # empty line + { + next; + } + + chomp ($field); + + if ($count == $end) + { + printf (" _\%-14s => undef\n", $field); + next; + } + printf (" _\%-14s => undef,\n", $field); + + + $count++ +} + +print " };\n\n"; +print " \#Bless the hash.\n"; +print " bless \$self, \$class;\n"; +print " return \$self;\n"; +print "}\n\n"; + +#Code to generate the accessor and mutator + +foreach $field (@fields) +{ + if ($field =~ /^$/ ) # empty line + { + next; + } + + chomp ($field); + + print "\#accessor/mutator method for $field\n"; + print "sub $field {\n"; + print " my ( \$self, \$$field ) = \@_;\n\n"; + print " \$self->{_$field} = \$$field\n"; + print " if defined (\$$field);\n\n"; + print " return \$self->{_$field};\n"; + print "}\n\n"; + +} + + +print "\#print method for the class\n"; +print "sub print {\n"; +print " my (\$self) = \@_;\n\n"; + +print " my \$f;\n\n"; + +#Code to generate a print method which dumps the object state +foreach $field (@fields) +{ + if ($field =~ /^$/ ) # empty line + { + next; + } + + chomp ($field); + print " \$f = defined (\$self->{_$field}) \n"; + print " ? \$self->{_$field} : \"not defined\";\n"; + print " printf (\"$field: %s\\n\", \$f);\n\n"; + +} + + + +print "}\n\n"; + +print "\#class return value \n1;\n\n"; + + + + + diff --git a/modules/CIAO/bin/PerlCIAO/perlciao.mpc b/modules/CIAO/bin/PerlCIAO/perlciao.mpc new file mode 100644 index 00000000000..681f977300f --- /dev/null +++ b/modules/CIAO/bin/PerlCIAO/perlciao.mpc @@ -0,0 +1,10 @@ + +// $Id$ + +project(PerlCIAO) : script { + Script_Files { + TestUtils.pm + TestUtils_Base.pm + } + custom_only=1 +} diff --git a/modules/CIAO/bin/ciao_tests.lst b/modules/CIAO/bin/ciao_tests.lst new file mode 100644 index 00000000000..ab7b0e39567 --- /dev/null +++ b/modules/CIAO/bin/ciao_tests.lst @@ -0,0 +1,36 @@ +# $Id$ +# +# This is the list of run_test.pl's that need to be run by +# auto_run_tests.pl. +# Each line has its own test, and a test can be followed by a +# list of configurations it does _not_ run on. +# +# Example: TAO\examples\foo\run_test.pl: !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO !ST +# +TAO/CIAO/examples/Hello/descriptors/run_test.pl: !STATIC !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO !NOXERCES !ACE_FOR_TAO !ST !LabVIEW_RT !WinCE !FUZZ +TAO/CIAO/examples/BasicSP/descriptors/run_test.pl: !STATIC !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO !NOXERCES !ACE_FOR_TAO !ST !LabVIEW_RT !WinCE !FUZZ +TAO/CIAO/examples/Null_Component/descriptors/run_test.pl: !STATIC !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO !NOXERCES !ACE_FOR_TAO !ST !LabVIEW_RT !WinCE !FUZZ +TAO/CIAO/examples/Hello/descriptors/run_test_without_ns.pl: !STATIC !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO !NOXERCES !ACE_FOR_TAO !ST !LabVIEW_RT !WinCE !FUZZ +#TAO/CIAO/examples/Hello/descriptors_RTCCM/rt_run_test.pl: !STATIC !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO !NOXERCES !ACE_FOR_TAO RT_CAPABLE !ST !LabVIEW_RT !WinCE !FUZZ +TAO/CIAO/tests/IDL3/Events/Any/run_test.pl: !STATIC !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO !ACE_FOR_TAO !ST !LabVIEW_RT !WinCE !FUZZ +#TAO/CIAO/DevGuideExamples/Messenger/descriptors/run_test.pl: !LabVIEW_RT !WinCE !FUZZ !STATIC !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO !ACE_FOR_TAO !ST !NOXERCES +TAO/CIAO/tests/IDL3_to_XMI/Bug_3607_Regression/run_test.pl: !STATIC !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO !NOXERCES !ACE_FOR_TAO !ST !LabVIEW_RT !WinCE +TAO/CIAO/tests/IDL3_to_XMI/XMI_For_Array/run_test.pl: !STATIC !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO !NOXERCES !ACE_FOR_TAO !ST !LabVIEW_RT !WinCE +TAO/CIAO/tests/IDL3_to_XMI/XMI_For_Included_File/run_test.pl: !STATIC !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO !NOXERCES !ACE_FOR_TAO !ST !LabVIEW_RT !WinCE +TAO/CIAO/tests/IDL3_to_XMI/XMI_For_Module_Reopen/run_test.pl: !STATIC !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO !NOXERCES !ACE_FOR_TAO !ST !LabVIEW_RT !WinCE +TAO/CIAO/tests/IDL3_to_XMI/XMI_For_Native/run_test.pl: !STATIC !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO !NOXERCES !ACE_FOR_TAO !ST !LabVIEW_RT !WinCE +TAO/CIAO/tests/IDL3_to_XMI/XMI_For_Sequence/run_test.pl: !STATIC !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO !NOXERCES !ACE_FOR_TAO !ST !LabVIEW_RT !WinCE +TAO/CIAO/tests/IDL3_to_XMI/IDL2XMI_Test/run_test.pl: !FIXED_BUGS_ONLY !STATIC !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO !NOXERCES !ACE_FOR_TAO !ST !LabVIEW_RT !WinCE +TAO/CIAO/DAnCE/tests/CIAO/NodeManager-Deployments/run_test.pl: !STATIC !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO !NOXERCES !ACE_FOR_TAO !ST !LabVIEW_RT !WinCE !FUZZ !FIXED_BUGS_ONLY +TAO/CIAO/DAnCE/tests/CIAO/ExecutionManager-Deployments/run_test.pl: !STATIC !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO !NOXERCES !ACE_FOR_TAO !ST !LabVIEW_RT !WinCE !FUZZ +TAO/CIAO/tests/CIAO_ComponentServer/Activator/run_test.pl: !STATIC !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO !NOXERCES !ACE_FOR_TAO !ST +TAO/CIAO/tests/CIAO_ComponentServer/Basic/run_test.pl: !STATIC !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO !NOXERCES !ACE_FOR_TAO !ST +TAO/CIAO/tests/CIAO_ComponentServer/SimpleComponent/run_test.pl: !STATIC !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO !NOXERCES !ACE_FOR_TAO !ST +TAO/CIAO/connectors/dds4ccm/examples/Hello/descriptors/run_test.pl: !STATIC !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO !NOXERCES !ACE_FOR_TAO !ST !LabVIEW_RT !WinCE !FUZZ NDDS +TAO/CIAO/connectors/dds4ccm/examples/Hello/descriptors/run_sender.pl: !STATIC !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO !NOXERCES !ACE_FOR_TAO !ST !LabVIEW_RT !WinCE !FUZZ NDDS +TAO/CIAO/connectors/dds4ccm/examples/Hello/descriptors/run_receiver.pl: !STATIC !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO !NOXERCES !ACE_FOR_TAO !ST !LabVIEW_RT !WinCE !FUZZ NDDS +TAO/CIAO/connectors/dds4ccm/examples/Hello/descriptors/run_5_to_1.pl: !STATIC !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO !NOXERCES !ACE_FOR_TAO !ST !LabVIEW_RT !WinCE !FUZZ NDDS +TAO/CIAO/connectors/dds4ccm/examples/Hello/descriptors/run_1_to_5.pl: !STATIC !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO !NOXERCES !ACE_FOR_TAO !ST !LabVIEW_RT !WinCE !FUZZ NDDS +TAO/CIAO/connectors/dds4ccm/examples/Hello/descriptors/run_5_to_5.pl: !STATIC !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO !NOXERCES !ACE_FOR_TAO !ST !LabVIEW_RT !WinCE !FUZZ NDDS +TAO/CIAO/connectors/ami4ccm/examples/Hello/descriptors/run_test.pl: !STATIC !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO !NOXERCES !ACE_FOR_TAO !ST !LabVIEW_RT !WinCE !FUZZ +TAO/CIAO/connectors/dds4ccm/examples/Quoter/descriptors/run_test.pl: !STATIC !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO !NOXERCES !ACE_FOR_TAO !ST !LabVIEW_RT !WinCE !FUZZ NDDS diff --git a/modules/CIAO/bin/generate_component_mpc.pl b/modules/CIAO/bin/generate_component_mpc.pl new file mode 100755 index 00000000000..815157211b7 --- /dev/null +++ b/modules/CIAO/bin/generate_component_mpc.pl @@ -0,0 +1,306 @@ +eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' + & eval 'exec perl -S $0 $argv:q' + if 0; + +# $Id$ +# Create a MPC file content for a single component implementation. + +use Getopt::Std; + +############################################################################## +# Grab the options + +$flags = join (" ", @ARGV); + +if (!getopts ('np:l:c:u:b:ho:') || $opt_h) { + print "generate_component_mpc.pl [-h] component_name\n"; + print "\n"; + print " -h print help message explaining various options\n"; + print " -p Dependent component name\n"; + print " -l Dependent component path (libpaths)\n"; + print " -o Component output path (libout)\n"; + print " -n Suppress component make/project\n"; + 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 "\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"; + exit (1); +} + +if ($#ARGV < 0) { + print STDERR "No component_name specified, use -h for help\n"; + exit (1); +} + +$com_name = shift @ARGV; +$UCOM_NAME = uc $com_name; + +############################################################################## +# Prologue + +if (defined $opt_b) { + $base_projs = ", $opt_b "; +} else { + $base_projs = " "; +} + +if (defined $opt_n) { + $svr_suffix = "_skel"; +} +else { + $svr_suffix = "_svnt"; +} + +$USVR_SUFFIX = uc $svr_suffix; + +if (defined $opt_p) { + $stub_depend = "$opt_p".'_stub'; + $lib_depend = "$opt_p".'_skel '."$opt_p".'_stub'; + + $svr_plibs ='\ + '."$opt_p".'_skel \ + '."$opt_p".'_stub'; +} +else { + $svr_plibs = ""; +} + +$unique_prefix = ""; + +if (defined $opt_u) { + $unique_prefix = "$opt_u" . "_"; +} +elsif (defined $opt_p) { + $unique_prefix = "$opt_p" . "_"; +} + +if (defined $opt_p) { + $svr_p_after = "$opt_p".'_skel'; +} + +if (defined $opt_l) { + $lib_paths = "libpaths += $opt_l"; +} + +if (defined $opt_o) { + $lib_out = "libout = $opt_o"; +} + +if (defined $opt_c) { + $client_def = +'project ('."$unique_prefix"."$opt_c".') : ccm_stub, valuetype ' . "$base_projs" . ' { + exename = '."$opt_c".' + after += '."$unique_prefix"."$com_name".'_stub + libs += '."$com_name".'_stub '."$stub_depend"." + $lib_paths"." + $lib_out".' + IDL_Files { + } + + Source_Files { + '."$opt_c".'.cpp + } + + Header_Files { + } + + Inline_Files { + } +} +'; +} + +if (! defined $opt_n) { + $lem_gen = +' +project('."$unique_prefix"."$com_name".'_lem_gen) : ciaoidldefaults ' . "$base_projs" . ' { + after += '."$unique_prefix"."$com_name".'_idl_gen + custom_only = 1 + idlflags += -Wb,stub_export_macro='."$UCOM_NAME".'_LEM_STUB_Export \ + -Wb,stub_export_include='."$com_name".'_lem_stub_export.h \ + -SS -Gxhst + + IDL_Files {'." + $com_name".'E.idl + } +} +'.' +project('."$unique_prefix"."$com_name".'_lem_stub) : ccm_svnt ' . "$base_projs" . ' { + after += '."$unique_prefix"."$com_name".'_lem_gen '."$unique_prefix"."$com_name".'_stub '."$stub_depend".' + libs += '."$stub_depend".' '."$com_name".'_stub'." + $lib_paths"." + $lib_out".' + sharedname = '."$com_name".'_lem_stub + dynamicflags = '."$UCOM_NAME".'_LEM_STUB_BUILD_DLL + + IDL_Files { + } + + Source_Files { + '."$com_name".'EC.cpp + } + + Header_Files { + '."$com_name".'EC.h + '."$com_name".'_lem_stub_export.h + } + + Inline_Files { + '."$com_name".'EC.inl + } +} +'; + + $component_def = +' +project('."$unique_prefix"."$com_name".'_exec) : ciao_executor ' . "$base_projs" . ' { + after += '."$unique_prefix"."$com_name".'_lem_stub '."$unique_prefix"."$com_name".'_stub + sharedname = '."$com_name".'_exec + libs += '."$com_name".'_stub '."$com_name".'_lem_stub '."$stub_depend + $lib_paths"." + $lib_out".' + dynamicflags = '."$UCOM_NAME".'_EXEC_BUILD_DLL + + IDL_Files { + } + + Source_Files {'." + $com_name".'_exec.cpp + } + + Header_Files {'." + $com_name".'_exec.h'." + $com_name".'_exec_export.h + } + + Inline_Files { + } +} +'; +} + +$cli_idlflags = + 'idlflags += -Wb,stub_export_macro='."$UCOM_NAME".'_STUB_Export \ + -Wb,stub_export_include='."$com_name".'_stub_export.h \ + -Wb,skel_export_macro='."$UCOM_NAME"."$USVR_SUFFIX".'_Export \ + -Wb,skel_export_include='."$com_name"."$svr_suffix".'_export.h \ + -Wb,exec_export_macro='."$UCOM_NAME".'_EXEC_Export \ + -Wb,exec_export_include='."$com_name".'_exec_export.h' +; + +$cli_base = "ccm_stub"; +$svr_base = "ciao_servant"; +$svr_after = ""; + +$svr_libs = "$com_name".'_stub '. "$com_name".'_lem_stub '; + +if (defined $opt_n) { + $svr_after = "$unique_prefix"."$com_name".'_stub'; + + $svr_libs = "$com_name".'_stub +'; + + $svr_src = +' + '."$com_name".'S.cpp +'; + + $svr_hdr = +' + '."$com_name".'S.h + '."$com_name".'_skel_export.h +'; + + $svr_base = "ciao_executor"; +} +else { + + $svr_idl = "$com_name".'E.idl'; + + $svr_src = +' + '."$com_name".'S.cpp + '."$com_name".'_svnt.cpp +'; + + $svr_hdr = +' + '."$com_name".'S.h + '."$com_name".'_svnt.h + '."$com_name".'_svnt_export.h +'; +} + +$mpc_template = '// $Id$ +// This file is generated with "'."generate_component_mpc.pl $flags".'" + +project('."$unique_prefix"."$com_name".'_idl_gen) : componentidldefaults ' . "$base_projs" . ' { + custom_only = 1 + '."$cli_idlflags".' + + IDL_Files { + '."$com_name".'.idl + } +} +'."$lem_gen".' +project('."$unique_prefix"."$com_name".'_stub) : '."$cli_base ". "$base_projs" . ' { + after += '."$unique_prefix"."$com_name".'_idl_gen '."$stub_depend".' + libs += '."$stub_depend"." + $lib_paths"." + $lib_out".' + sharedname = '."$com_name".'_stub + dynamicflags = '."$UCOM_NAME".'_STUB_BUILD_DLL + + IDL_Files { + } + + Source_Files { + '."$com_name".'C.cpp + } + + Header_Files { + '."$com_name".'C.h + '."$com_name".'_stub_export.h + } + + Inline_Files { + '."$com_name".'C.inl + } +} +'."$component_def".' + +project('."$unique_prefix"."$com_name"."$svr_suffix".') : '."$svr_base ". "$base_projs" . ' { + after += '."$svr_p_after "."$svr_after".' '."$unique_prefix"."$com_name".'_lem_stub'.' + sharedname = '."$com_name"."$svr_suffix".' + libs += '."$svr_libs $svr_plibs + $lib_paths"." + $lib_out".' + dynamicflags = '."$UCOM_NAME"."$USVR_SUFFIX".'_BUILD_DLL + '.' + IDL_Files { + } + + Source_Files {'."$svr_src".' } + + Header_Files {'."$svr_hdr".' } + + Inline_Files { + '."$com_name".'S.inl + } +} + +'."$client_def +"; + +############################################################################## +# Static Stuff + +############################################################################## +# Print the stuff out + + +# MPC files +open (MPCFILE, ">", "$com_name".".mpc"); +print MPCFILE $mpc_template; diff --git a/modules/CIAO/bin/update_package.py b/modules/CIAO/bin/update_package.py new file mode 100755 index 00000000000..5719b0c7627 --- /dev/null +++ b/modules/CIAO/bin/update_package.py @@ -0,0 +1,118 @@ +#!/usr/bin/env python +""" This script facilitates the update of binaries in a given DAnCE package. + Note that it DOES NOT modify meta-data, only blindly replacing existing + binaries that match by name EXACTLY""" + +#Globals +verbose = False +take_action = True + +def parse_args (): + from optparse import OptionParser + + parser = OptionParser ("usage: %prog [options] package_to_update") + + parser.add_option ("-I", "--include-dir", dest="include_dir", action="store", + help="Specify a path to search for new implementations/descriptors", + default="./impl/") + parser.add_option ("-o", "--output-dir", dest="out_dir", action="store", + help="Specify the directory to write updated packages", + default="./new_packages/") + parser.add_option ("-f", "--out-file", dest="out_file", action="store", + help="Specify the name of the file to output. Default is same name", + default=None) + parser.add_option ("-v", "--verbose", action="store_true", default=False, + dest="verbose", help="Print verbose debugging output") + parser.add_option ("-n", "--no-action", action="store_false") + (opts, args) = parser.parse_args () + + if len(args) != 1: + parser.error ("Must specify exactly one package to update") + + if opts.out_file is None: + opts.out_file = os.path.basename (args[0]) + + return (opts, args) + +def vprint (string): + if verbose: + print string + +"""Caches all files in include paths""" +def cache_files (dirs): + files = dict () + vprint ("Building file list") + for item in dirs: + for root, dirs, files in os.walk (item, topDown=True): + for item in files: + fullpath = os.join (root, item) + if item not in files: + vprint ("Adding " + item + " as " + fullpath) + files[item] = fullpath + else: + vprint ("Skipping " + fullpath + " because " + item + " has been found earlier") + + return files + +""" Update a package from infile, a ZipFile object to outfile, a ZipFile object, + using files in the dictionary files""" +def update_package (infile, outfile, files): + orig_list = infile.namelist () + + for item in filelist: + vprint ("Considering " + item + " from source package") + + if item[-1] == '/': + vprint ("\tSkipping because its a directory") + else: + bn_item = os.path.basename (item) + + if bn_item in files.keys (): + vprint ("\tFound replacement: " + files[bn_item]) + vprint ("\tPerforming replacement....") + + if take_action: + ofile.write (files[bn_item], item) + else: + print "\tAction: Replace " + item + " with " + item + continue # next item + + if take_action: + ofile.writestr (item, zfile.read (item)) + else: + print "\tAction: Migrate " + item + " unchanged" + +def main (): + opts, args = parse_args () + + from zipfile import ZipFile + + ## Construct output file + of_name = os.path.join (opts.out_path, opts.out_file) + vprint ("Chose " + of_name + " as output file") + + #make sure out_path exists + if os.path.exists (os.path.basename (of_name)): + vprint ("Destination path does not exist, creating....") + if take_action: + os.mkdir (os.path.basename (of_name)) + else: + print "Action: create path " + os.path.basename (of_name) + + # Create zipfile objects + infile = ZipFile (args[0], 'a') + outfile = None + + if take_action: + outfile = ZipFile (of_name, 'w') + + # cache include directories + files = cache_files (opts.include_dirs) + + # Perform update + update_package (infile, outfile, files) + + print "Package successfully updated" + +if __name__ == "__main__": + main (opts, args) diff --git a/modules/CIAO/bin/valgrind_nodedaemon.py b/modules/CIAO/bin/valgrind_nodedaemon.py new file mode 100755 index 00000000000..a0845864370 --- /dev/null +++ b/modules/CIAO/bin/valgrind_nodedaemon.py @@ -0,0 +1,87 @@ +#!/usr/bin/python +# $Id$ +# +# Runs a NodeManager (optionally) under valgrind with the NodeApplication (optionally) under valgrind. + +from optparse import OptionParser +from os import system +from os import environ + +def parse_args (): + + parser = OptionParser (usage="usage: valgrind_nodemanager [options] <port_number>") + + parser.add_option ("-v", "--verbose", dest="verbose", action="store_true", + help="Output the command that is to be executed.", + default=False) + parser.add_option ("-l","--log", dest="log_file", action="store", + help="Log all output to a given file.", + default="") + parser.add_option ("-t", "--tool", dest="valgrind_tool", action="store", + help="Specify the valgrind tool to run", + default="memcheck") + parser.add_option ("--nm", dest="node_manager", action="store_true", + help="Run valgrind on the NodeManager", + default=False) + parser.add_option ("--na", dest="node_application", action="store_true", + help="Run valgrind on the NodeApplication", + default=False) + parser.add_option ("--valgrind_args", dest="valgrind_args", action="store", + help="Additional arguments to pass to valgrind", + default="") + parser.add_option ("-g", dest="gen_supp", action="store_true", + help="Generate suppression lines", + default=False) + parser.add_option ("-s", dest="supp_file", action="store", + help="Suppression file for Valgrind to use", + default="") + parser.add_option ("--lc", dest="leak_check", action="store_true", + help="Perform a full leak check", + default=False) + + return parser.parse_args () + +import os + +def main (): + (option, args) = parse_args () + + ciao_root = environ['CIAO_ROOT'] + + # Build the valgrind command + valgrind_command = "valgrind --tool=" + option.valgrind_tool + ' ' +\ + option.valgrind_args + ' ' + + if option.gen_supp: + valgrind_command += "--gen-suppressions=all " + + if option.supp_file != "": + valgrind_command += "--suppressions=\"" + options.supp_file + '" ' + + if option.leak_check: + valgrind_command += "--leak-check=full " + + # Build the actual command + command = "" + + if option.node_manager: + command += valgrind_command + + command += ciao_root + "/DAnCE/NodeManager/NodeManager " +\ + "-ORBEndpoint iiop://localhost:" + args[0] + ' ' + + if option.node_application: + command += "-d 60 -s\"" + valgrind_command + else: + command += " -s \"" + + command += ciao_root + "/DAnCE/NodeApplication/NodeApplication" + '"' + + print command + + system (command) + +if __name__ == "__main__": + main () + + |