diff options
author | sma <sma@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2007-11-29 17:00:00 +0000 |
---|---|---|
committer | sma <sma@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2007-11-29 17:00:00 +0000 |
commit | e065dbf49ca1ae1fde5f173d68c2da9fb69aa0e7 (patch) | |
tree | 050cb5c6ebdd5ef7965ef84fa41f7bce19f07ecc | |
parent | bdf2ae97303e674e1fef4e653cf452d36e273ee0 (diff) | |
download | ATCD-e065dbf49ca1ae1fde5f173d68c2da9fb69aa0e7.tar.gz |
ChangeLogTag: Thu Nov 29 16:58:00 UTC 2007 Simon Massey <sma@prismtech.com>
-rw-r--r-- | TAO/ChangeLog | 10 | ||||
-rw-r--r-- | TAO/tests/Bug_3155_Regression/Bug_3155_Regression.mpc | 14 | ||||
-rw-r--r-- | TAO/tests/Bug_3155_Regression/ReadMe.txt | 4 | ||||
-rwxr-xr-x | TAO/tests/Bug_3155_Regression/run_test.pl | 67 | ||||
-rw-r--r-- | TAO/tests/Bug_3155_Regression/test.idl | 20 | ||||
-rw-r--r-- | TAO/tests/Bug_3155_Regression/test_idl.cpp | 126 |
6 files changed, 241 insertions, 0 deletions
diff --git a/TAO/ChangeLog b/TAO/ChangeLog index cd987cdcd30..bbe3b25bf29 100644 --- a/TAO/ChangeLog +++ b/TAO/ChangeLog @@ -1,3 +1,13 @@ +Thu Nov 29 16:58:00 UTC 2007 Simon Massey <sma@prismtech.com> + + * tests/Bug_3155_Regression/Bug_3155_Regression.mpc: + * tests/Bug_3155_Regression/ReadMe.txt: + * tests/Bug_3155_Regression/run_test.pl: + * tests/Bug_3155_Regression/test.idl: + * tests/Bug_3155_Regression/test_idl.cpp: + + Create new regression test. + Thu Nov 29 14:58:54 UTC 2007 Johnny Willemsen <jwillemsen@remedy.nl> * tao/Transport.cpp: diff --git a/TAO/tests/Bug_3155_Regression/Bug_3155_Regression.mpc b/TAO/tests/Bug_3155_Regression/Bug_3155_Regression.mpc new file mode 100644 index 00000000000..30905c16208 --- /dev/null +++ b/TAO/tests/Bug_3155_Regression/Bug_3155_Regression.mpc @@ -0,0 +1,14 @@ +// -*- MPC -*- +// $Id$ + +project(*test_idl): taoexe, ifr_client { + exename = test_idl + includes += $(TAO_ROOT)/include + + Source_Files { + test_idl.cpp + } + + IDL_Files { + } +} diff --git a/TAO/tests/Bug_3155_Regression/ReadMe.txt b/TAO/tests/Bug_3155_Regression/ReadMe.txt new file mode 100644 index 00000000000..84876c5d797 --- /dev/null +++ b/TAO/tests/Bug_3155_Regression/ReadMe.txt @@ -0,0 +1,4 @@ +(tao573 Similar to tao567, but not with an abstract base valuetype) + +when the describe_ext_value() call is done, this produces +BAD_PARAM exception incorrectly. diff --git a/TAO/tests/Bug_3155_Regression/run_test.pl b/TAO/tests/Bug_3155_Regression/run_test.pl new file mode 100755 index 00000000000..44ea081a253 --- /dev/null +++ b/TAO/tests/Bug_3155_Regression/run_test.pl @@ -0,0 +1,67 @@ +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::Run_Test; + +$status = 0; +my $exec_extn=""; +if ($^O eq "MSWin32") { + $exec_extn=".exe"; +} +$ifr_service= "$ENV{ACE_ROOT}/bin/IFR_Service"; +if (! -e $ifr_service . $exec_extn ) { + $ifr_service= "$ENV{ACE_ROOT}/TAO/orbsvcs/IFR_Service/IFR_Service"; + if (! -e $ifr_service . $exec_extn ) { + $ifr_service = "$ENV{ACE_ROOT}/TAO/orbsvcs/IFR_Service/Release/IFR_Service"; + if (! -e $ifr_service . $exec_extn ) { + print STDERR "ERROR: IFR_Service not found.\n"; + exit 1; + } + } +} +$iorfile = PerlACE::LocalFile ("ifr.ior"); +unlink $iorfile; + +print STDERR "\n\n==== Running Forward Declared ValueType Definition test\n"; + +if (PerlACE::is_vxworks_test()) { + $SV = new PerlACE::ProcessVX ("$ifr_service", "-o $iorfile"); +} +else { + $SV = new PerlACE::Process ("$ifr_service", "-o $iorfile"); +} + +print STDERR "Starting IFR Service\n"; +$SV->Spawn (); +if (PerlACE::waitforfile_timed ($iorfile, + $PerlACE::wait_interval_for_process_creation) == -1) { + print STDERR "ERROR: cannot find file <$iorfile>\n"; + $SV->Kill (); $SV->TimedWait (1); + exit 1; +} + +$LOADER = new PerlACE::Process ("$ENV{ACE_ROOT}/bin/tao_ifr", + "-ORBInitRef InterfaceRepository=file://$iorfile test.idl"); +print STDERR "Loading test.idl into IFR service\n"; +$status = $LOADER->SpawnWaitKill (15); +if ($status != 0) { + print STDERR "ERROR: IFR Loading returned $status\n"; +} + +print STDERR "Running test_idl\n"; +$TEST = new PerlACE::Process ("test_idl", "-i file://$iorfile -s IDL:M1/VT:1.0"); +$status = $TEST->SpawnWaitKill (15); +if ($status != 0) { + print STDERR "ERROR: test_idl returned $status\n"; +} + +print STDERR "Stopping IFR\n"; +$SV->Kill(); $SV->TimedWait (1); +unlink $iorfile; + +exit $status; diff --git a/TAO/tests/Bug_3155_Regression/test.idl b/TAO/tests/Bug_3155_Regression/test.idl new file mode 100644 index 00000000000..ebbd7013179 --- /dev/null +++ b/TAO/tests/Bug_3155_Regression/test.idl @@ -0,0 +1,20 @@ +module C1 +{ + valuetype EB // NOT abstract + { + }; +}; + +module M1 +{ + valuetype VT; // Forward declare +}; + +module M1 +{ + valuetype VT : // Full definition + ::C1::EB + { + public long id; + }; +}; diff --git a/TAO/tests/Bug_3155_Regression/test_idl.cpp b/TAO/tests/Bug_3155_Regression/test_idl.cpp new file mode 100644 index 00000000000..ec8e6fc9483 --- /dev/null +++ b/TAO/tests/Bug_3155_Regression/test_idl.cpp @@ -0,0 +1,126 @@ +// $Id$ + +#include "ace/Get_Opt.h" +#include "tao/ORB.h" +#include <tao/IFR_Client/IFR_ComponentsC.h> + +namespace +{ + const char *ifr_ior_file = 0; + const char *idl_value = 0; +} + +int +parse_args (int argc, char *argv[]) +{ + ACE_Get_Opt get_opts (argc, argv, "i:s:"); + const unsigned char full_success = 0x03; + unsigned char success = 0; + + while (true) + { + int c = get_opts (); + if (success == full_success) + { + break; + } + + if (c == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "usage: %s" + " -i <ifr_ior>" + " -s <idl_valuetype>" + "\n", + argv [0]), + -1); + } + + switch (c) + { + case 'i': + ifr_ior_file = get_opts.opt_arg (); + success |= 0x01; + break; + case 's': + idl_value = get_opts.opt_arg (); + success |= 0x02; + break; + } + } + + // Indicates sucessful parsing of the command line + return 0; +} + +// ---------------------------------------------------------------------- + +int main (int argc, char** argv) +{ + // init orb + CORBA::ORB_var the_orb = + CORBA::ORB_init (argc, argv); + + if (parse_args (argc, argv) == -1) + { + return -1; + } + + // get IFR + CORBA::Object_var objref = + the_orb->string_to_object (ifr_ior_file); + if (objref.in () == 0) + { + ACE_ERROR_RETURN ((LM_ERROR, + "The received objref is nil\n"), + -1); + } + + CORBA::ComponentIR::Repository_var the_repo_ref; + try + { + the_repo_ref = CORBA::ComponentIR::Repository::_narrow (objref.in ()); + } + catch (CORBA::Exception &ex) + { + ex._tao_print_exception ("Can't narrow the IFR:"); + return 1; + } + + // search in repository + CORBA::Contained_var current_contained = + the_repo_ref->lookup_id (idl_value); + if (CORBA::is_nil(current_contained.in ())) + { + ACE_ERROR_RETURN ((LM_ERROR, + "Can't look up the valuetype\n"), + -1); + } + + // get value type definition + CORBA::ExtValueDef_var value_def = + CORBA::ExtValueDef::_narrow (current_contained.in ()); + CORBA::ExtValueDef::ExtFullValueDescription * value_descr; + try + { + value_descr = value_def->describe_ext_value (); + } + catch (CORBA::Exception &ex) + { + ex._tao_print_exception ("Can't describe_ext_value:"); + return 1; + } + + CORBA::ValueMemberSeq& the_value_members = + value_descr->members; + for (CORBA::ULong ct = 0; ct < the_value_members.length (); ++ct) + { + const CORBA::ValueMember& current_member = + the_value_members [ct]; + ACE_DEBUG ((LM_DEBUG, + "value type member '%s'\n", + current_member.name.in ())); + } + + return 0; +} |