diff options
author | mjb2 <mjb2@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1998-09-28 03:46:02 +0000 |
---|---|---|
committer | mjb2 <mjb2@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1998-09-28 03:46:02 +0000 |
commit | f0c78e7475791fff6d59e6507e32db2e51eda5e8 (patch) | |
tree | 4d042340bb6929c164e8fdece4ca448795ecd3f8 /TAO | |
parent | b86a7a46ef6e089b4ef9cbeffb83434eb02f7e52 (diff) | |
download | ATCD-f0c78e7475791fff6d59e6507e32db2e51eda5e8.tar.gz |
See Sun Sep 27 22:37:11 1998 Matthew J Braun <mjb2@cec.wustl.edu>
Diffstat (limited to 'TAO')
-rw-r--r-- | TAO/ChangeLog-98c | 21 | ||||
-rw-r--r-- | TAO/examples/POA/DSI/client.cpp | 2 | ||||
-rw-r--r-- | TAO/examples/POA/DSI/server.cpp | 2 | ||||
-rw-r--r-- | TAO/examples/POA/Default_Servant/client.cpp | 2 | ||||
-rw-r--r-- | TAO/examples/POA/Default_Servant/server.cpp | 2 | ||||
-rw-r--r-- | TAO/tests/Multiple_Inheritance/Makefile | 2 | ||||
-rw-r--r-- | TAO/tests/Multiple_Inheritance/client.cpp | 45 | ||||
-rwxr-xr-x | TAO/tests/Multiple_Inheritance/run_test.pl | 21 | ||||
-rw-r--r-- | TAO/tests/Multiple_Inheritance/server.cpp | 61 | ||||
-rwxr-xr-x | TAO/tests/OctetSeq/run_test.pl | 12 |
10 files changed, 155 insertions, 15 deletions
diff --git a/TAO/ChangeLog-98c b/TAO/ChangeLog-98c index 20693647059..6af3d289724 100644 --- a/TAO/ChangeLog-98c +++ b/TAO/ChangeLog-98c @@ -1,3 +1,24 @@ +Sun Sep 27 22:37:11 1998 Matthew J Braun <mjb2@cec.wustl.edu> + + * examples/POA/Default_Servant/server.cpp + * examples/POA/Default_Servant/client.cpp + * examples/POA/DSI/server.cpp + * examples/POA/DSI/client.cpp + Fixed a small misuse of strdup + + * tests/OctetSeq/run_test.pl: Small script to run OctetSeq test + + * tests/Multiple_Inheritance/run_test.pl: Script to run client and + server + + * tests/Multiple_Inheritance/server.cpp + * tests/Multiple_Inheritance/client.cpp + Added command line parsing and ability to output the IOR to a + file (server) and read from a file (client) + + * tests/Multiple_Inheritance/Makefile: Fixed realclean to remove + server and client binaries + Sun Sep 27 21:05:40 1998 David L. Levine <levine@cs.wustl.edu> * tao/Object_Table.i (create_object_id): added diff --git a/TAO/examples/POA/DSI/client.cpp b/TAO/examples/POA/DSI/client.cpp index 88472c14903..efe66f8b382 100644 --- a/TAO/examples/POA/DSI/client.cpp +++ b/TAO/examples/POA/DSI/client.cpp @@ -33,7 +33,7 @@ parse_args (int argc, char **argv) switch (c) { case 'k': - iorfile = ACE_OS::strdup (get_opts.optarg); + iorfile = get_opts.optarg; break; case 'd': TAO_debug_level++; diff --git a/TAO/examples/POA/DSI/server.cpp b/TAO/examples/POA/DSI/server.cpp index 3d1d3536b1a..3f2b349f180 100644 --- a/TAO/examples/POA/DSI/server.cpp +++ b/TAO/examples/POA/DSI/server.cpp @@ -31,7 +31,7 @@ parse_args (int argc, char **argv) switch (c) { case 'o': - ior_output_file = ACE_OS::strdup (get_opts.optarg); + ior_output_file = get_opts.optarg; break; case 'd': TAO_debug_level++; diff --git a/TAO/examples/POA/Default_Servant/client.cpp b/TAO/examples/POA/Default_Servant/client.cpp index 54d90f9acdc..9131e4e6dd4 100644 --- a/TAO/examples/POA/Default_Servant/client.cpp +++ b/TAO/examples/POA/Default_Servant/client.cpp @@ -40,7 +40,7 @@ parse_args (int argc, char **argv) TAO_debug_level++; break; case 'k': - iorfile = ACE_OS::strdup (get_opts.optarg); + iorfile = get_opts.optarg; break; case 'f': filename = get_opts.optarg; diff --git a/TAO/examples/POA/Default_Servant/server.cpp b/TAO/examples/POA/Default_Servant/server.cpp index 856fe6a9d50..545f22b4e23 100644 --- a/TAO/examples/POA/Default_Servant/server.cpp +++ b/TAO/examples/POA/Default_Servant/server.cpp @@ -33,7 +33,7 @@ parse_args (int argc, char **argv) switch (c) { case 'o': - ior_output_file = ACE_OS::strdup (get_opts.optarg); + ior_output_file = get_opts.optarg; break; case 'd': TAO_debug_level++; diff --git a/TAO/tests/Multiple_Inheritance/Makefile b/TAO/tests/Multiple_Inheritance/Makefile index 8917952c0af..6b91ff2106d 100644 --- a/TAO/tests/Multiple_Inheritance/Makefile +++ b/TAO/tests/Multiple_Inheritance/Makefile @@ -50,7 +50,7 @@ client: $(addprefix $(VDIR),$(FILE_CLT_OBJS)) $(LINK.cc) $(LDFLAGS) -o $@ $^ $(VLDLIBS) $(POSTLINK) realclean: clean - -/bin/rm -rf Multiple_InheritanceC.* Multiple_InheritanceS.* Multiple_InheritanceS_T.* + -/bin/rm -rf Multiple_InheritanceC.* Multiple_InheritanceS.* Multiple_InheritanceS_T.* client server # DO NOT DELETE THIS LINE -- g++dep uses it. # DO NOT PUT ANYTHING AFTER THIS LINE, IT WILL GO AWAY. diff --git a/TAO/tests/Multiple_Inheritance/client.cpp b/TAO/tests/Multiple_Inheritance/client.cpp index 947202db0af..0cc7d52c14b 100644 --- a/TAO/tests/Multiple_Inheritance/client.cpp +++ b/TAO/tests/Multiple_Inheritance/client.cpp @@ -17,16 +17,18 @@ #include "ace/streams.h" #include "ace/Get_Opt.h" +#include "ace/Read_Buffer.h" #include "Multiple_InheritanceC.h" ACE_RCSID(Multiple_Inheritance, client, "$Id$") static char *ior = 0; +static char *ior_input_file = 0; static int parse_args (int argc, char **argv) { - ACE_Get_Opt get_opts (argc, argv, "k:"); + ACE_Get_Opt get_opts (argc, argv, "dk:i:"); int c; while ((c = get_opts ()) != -1) @@ -35,21 +37,33 @@ parse_args (int argc, char **argv) case 'k': ior = get_opts.optarg; break; + case 'i': + ior_input_file = get_opts.optarg; + break; case '?': default: ACE_ERROR_RETURN ((LM_ERROR, - "usage: %s" + "\nusage: %s" + "-d" + "-i <ior_input_file>" "-k IOR" "\n", argv [0]), -1); } - if (ior == 0) + if (ior == 0 && ior_input_file == 0) ACE_ERROR_RETURN ((LM_ERROR, - "Please specify the IOR for the servant"), -1); + "\nPlease specify the IOR or IOR input file" + " for the servant"), + -1); + if (ior != 0 && ior_input_file != 0) + ACE_ERROR_RETURN ((LM_ERROR, + "\nPlease specify only an IOR or only an IOR" + " input file but not both"), + -1); - // Indicates successful parsing of command line. + // Indicates successful parsing of the command line. return 0; } @@ -69,6 +83,27 @@ main (int argc, char **argv) return -1; } + // If ior_input_file exists, Read the file, and get the IOR + // else, it must have been specified on the command line + if (ior_input_file != 0) + { + ACE_HANDLE input_file = ACE_OS::open (ior_input_file, 0); + if (input_file == ACE_INVALID_HANDLE) + ACE_ERROR_RETURN ((LM_DEBUG, + "Cannot open input file for reading IOR: %s\n", + ior_input_file), + -1); + ACE_Read_Buffer ior_buffer (input_file); + char *data = ior_buffer.read (); + if (data == 0) + ACE_ERROR_RETURN ((LM_ERROR, + "Unable to read ior\n"), + -1); + ior = ACE_OS::strdup (data); + ior_buffer.alloc ()-> free (data); + ACE_OS::close (input_file); + } + // Get the object reference with the IOR CORBA::Object_var object = orb->string_to_object (ior, env); if (env.exception () != 0) diff --git a/TAO/tests/Multiple_Inheritance/run_test.pl b/TAO/tests/Multiple_Inheritance/run_test.pl new file mode 100755 index 00000000000..51b78e537fc --- /dev/null +++ b/TAO/tests/Multiple_Inheritance/run_test.pl @@ -0,0 +1,21 @@ +#$Id$ +# -*- perl -*- +eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' + & eval 'exec perl -S $0 $argv:q' + if 0; + +unshift @INC, '../../../bin'; +require ACEutils; + +$iorfile = "server.ior"; +$SV = Process::Create ("server$Process::EXE_EXT", " -o $iorfile"); + +ACE::waitforfile ($iorfile); + +$status = system ("client$Process::EXE_EXT -i $iorfile"); + +$SV->Kill (); $SV->Wait (); + +unlink $iorfile; + +exit $status; diff --git a/TAO/tests/Multiple_Inheritance/server.cpp b/TAO/tests/Multiple_Inheritance/server.cpp index 34bf0548cd4..3e08bf3d3b8 100644 --- a/TAO/tests/Multiple_Inheritance/server.cpp +++ b/TAO/tests/Multiple_Inheritance/server.cpp @@ -5,8 +5,40 @@ ACE_RCSID(Multiple_Inheritance, server, "$Id$") +static char *ior_output_file = 0; + +int +parse_args (int argc, char **argv) +{ + ACE_Get_Opt get_opts (argc, argv, "do:"); + int c; + + while ((c = get_opts ()) != -1) + switch (c) + { + case 'd': + TAO_debug_level++; + break; + case 'o': + ior_output_file = ACE_OS::strdup (get_opts.optarg); + break; + case '?': + default: + ACE_ERROR_RETURN ((LM_ERROR, + "usage: %s" + "-d " + "-o <iorfile>" + "\n", + argv [0]), + -1); + } + // Indicates sucessful parsing of the command line + return 0; +} + + int -main (int argc, char *argv[]) +main (int argc, char **argv) { Multiple_Inheritance_i servant; TAO_ORB_Manager orb_manager; @@ -20,13 +52,32 @@ main (int argc, char *argv[]) TAO_TRY_ENV); TAO_CHECK_ENV; - CORBA::String_var ior = orb_manager.activate_under_child_poa ("my_object", - &servant, - TAO_TRY_ENV); + if (parse_args (argc, argv) != 0) + return -1; + + CORBA::String_var ior = + orb_manager.activate_under_child_poa ("my_object", + &servant, + TAO_TRY_ENV); TAO_CHECK_ENV; - ACE_DEBUG ((LM_DEBUG, "%s\n\n", ior.in ())); + if (TAO_debug_level > 0) + ACE_DEBUG ((LM_DEBUG, "%s\n", + ior.in ())); + // If the ior_output_file exists, output the ior to it + if (ior_output_file != 0) + { + FILE *output_file= ACE_OS::fopen (ior_output_file, "w"); + if (output_file == 0) + ACE_ERROR_RETURN ((LM_DEBUG, + "Cannot open output file for writing IOR: %s", + ior_output_file), + -1); + ACE_OS::fprintf (output_file, "%s", ior.in ()); + ACE_OS::fclose (output_file); + } + orb_manager.run (TAO_TRY_ENV); TAO_CHECK_ENV; } diff --git a/TAO/tests/OctetSeq/run_test.pl b/TAO/tests/OctetSeq/run_test.pl new file mode 100755 index 00000000000..0151f3fc7c7 --- /dev/null +++ b/TAO/tests/OctetSeq/run_test.pl @@ -0,0 +1,12 @@ +#$Id$ +# -*- perl -*- +eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' + & eval 'exec perl -S $0 $argv:q' + if 0; + +unshift @INC, '../../../bin'; +require ACEutils; + +$status = system ("OctetSeq$Process::EXE_EXT -n 16 -l 32 -h 512 -s 4"); + +exit $status; |