diff options
Diffstat (limited to 'TAO/tests')
-rw-r--r-- | TAO/tests/InterOp-Naming/INS_test_client.cpp | 23 | ||||
-rw-r--r-- | TAO/tests/InterOp-Naming/Server_i.cpp | 75 | ||||
-rw-r--r-- | TAO/tests/InterOp-Naming/Server_i.h | 13 | ||||
-rwxr-xr-x | TAO/tests/InterOp-Naming/run_test.pl | 101 | ||||
-rwxr-xr-x | TAO/tests/MT_Client/run_test.pl | 8 | ||||
-rwxr-xr-x | TAO/tests/Multiple_Inheritance/run_test.pl | 6 |
6 files changed, 156 insertions, 70 deletions
diff --git a/TAO/tests/InterOp-Naming/INS_test_client.cpp b/TAO/tests/InterOp-Naming/INS_test_client.cpp index 154bf690f08..a6435ce40a6 100644 --- a/TAO/tests/InterOp-Naming/INS_test_client.cpp +++ b/TAO/tests/InterOp-Naming/INS_test_client.cpp @@ -19,7 +19,7 @@ main (int argc, char *argv[]) 0, ACE_TRY_ENV); ACE_TRY_CHECK; - + if (argc < 2) { ACE_DEBUG ((LM_DEBUG, @@ -37,18 +37,19 @@ main (int argc, char *argv[]) if (ACE_OS::strcmp (argv[1], "NameService") == 0) { - + CosNaming::NamingContext_var naming_context = CosNaming::NamingContext::_narrow (objref.in (), ACE_TRY_ENV); ACE_TRY_CHECK; - + ACE_DEBUG ((LM_DEBUG, "Resolved IOR for %s : %s\n", argv[1], orb_->object_to_string (naming_context.in ()))); - // Sanity check to see if the reference to Naming Context is alright. + // Sanity check to see if the reference to Naming + // Context is alright. CosNaming::Name my_name; my_name.length (1); my_name[0].id = CORBA::string_dup ("ObjName"); @@ -64,7 +65,7 @@ main (int argc, char *argv[]) } else { - + INS_var server = INS::_narrow (objref.in (), ACE_TRY_ENV); ACE_TRY_CHECK; @@ -73,13 +74,13 @@ main (int argc, char *argv[]) "Resolved IOR for %s : %s\n", argv[1], orb_->object_to_string (server.in ()))); - + ACE_DEBUG ((LM_DEBUG, "\nResult of Remote Call : %s\n", server->test_ins (ACE_TRY_ENV))); - + } - + } } ACE_CATCHANY @@ -89,10 +90,6 @@ main (int argc, char *argv[]) ACE_ENDTRY; ACE_CHECK_RETURN (-1); - + return 0; } - - - - diff --git a/TAO/tests/InterOp-Naming/Server_i.cpp b/TAO/tests/InterOp-Naming/Server_i.cpp index a69c01f6d69..6dae4db4702 100644 --- a/TAO/tests/InterOp-Naming/Server_i.cpp +++ b/TAO/tests/InterOp-Naming/Server_i.cpp @@ -6,7 +6,6 @@ Server_i::Server_i (void) : ior_output_file_ (0), - naming_ (0), ins_ (0) { // no-op. @@ -40,12 +39,10 @@ Server_i::parse_args (void) get_opts.optarg), -1); break; - case 'n': //Use naming service - this->naming_ = 1; - break; case 'i': // For Testing the InterOperable Naming Service. - this->ins_ = CORBA::string_dup (get_opts.optarg); - break; + this->ins_ = CORBA::string_dup (get_opts.optarg); + break; + case '?': // display help for use of the server. default: ACE_ERROR_RETURN ((LM_ERROR, @@ -63,30 +60,30 @@ Server_i::parse_args (void) } // Add the ObjectID:IOR mapping to the IOR table of -// the ORB. +// the ORB. int Server_i::add_IOR_to_table (CORBA::String_var ior) { - + CORBA::Object_ptr object = this->orb_manager_.orb ()->string_to_object (ior.in ()); - + // Add a KEY:IOR mapping to the ORB table. ACE_CString ins (this->ins_); - + if (TAO_debug_level > 0) ACE_DEBUG ((LM_DEBUG, - "Adding (KEY:IOR) %s:%s\n", - ins.c_str (), - ior.in ())); - + "Adding (KEY:IOR) %s:%s\n", + ins.c_str (), + ior.in ())); + if (this->orb_manager_.orb ()->_tao_add_to_IOR_table (ins, - object) != 0) + object) != 0) ACE_ERROR_RETURN ((LM_ERROR, - "Simple_Util : Unable to add IOR to table\n"), - -1); - + "Simple_Util : Unable to add IOR to table\n"), + -1); + return 0; } @@ -106,22 +103,22 @@ Server_i::init (int argc, "%p\n", "init_child_poa"), -1); - + ACE_CHECK_RETURN (-1); - + this->argc_ = argc; this->argv_ = argv; - + int retval = this->parse_args (); - + if (retval != 0) return retval; - + CORBA::ORB_var orb = this->orb_manager_.orb (); // Stash our ORB pointer for later reference. this->servant_.orb (orb.in ()); - + ACE_TRY { CORBA::String_var str = @@ -135,18 +132,18 @@ Server_i::init (int argc, str.in ())); if (this->ins_) - if (this->add_IOR_to_table (str) != 0) - ACE_ERROR_RETURN ((LM_ERROR, - "test_for_ins (): failed\n"), - -1); - + if (this->add_IOR_to_table (str) != 0) + ACE_ERROR_RETURN ((LM_ERROR, + "test_for_ins (): failed\n"), + -1); + if (this->ior_output_file_) - { - ACE_OS::fprintf (this->ior_output_file_, - "%s", - str.in ()); - ACE_OS::fclose (this->ior_output_file_); - } + { + ACE_OS::fprintf (this->ior_output_file_, + "%s", + str.in ()); + ACE_OS::fclose (this->ior_output_file_); + } } ACE_CATCHANY @@ -167,12 +164,6 @@ Server_i::run (CORBA::Environment &env) ACE_ERROR_RETURN ((LM_ERROR, "Server_i::run"), -1); - + return 0; } - - - - - - diff --git a/TAO/tests/InterOp-Naming/Server_i.h b/TAO/tests/InterOp-Naming/Server_i.h index 2b76a424a74..cc606977c39 100644 --- a/TAO/tests/InterOp-Naming/Server_i.h +++ b/TAO/tests/InterOp-Naming/Server_i.h @@ -12,7 +12,7 @@ // The class is the driver for the INS test server. // // = AUTHOR -// Vishal Kachroo <vishal@cs.wustl.edu> +// Vishal Kachroo <vishal@cs.wustl.edu> // // ============================================================================ @@ -37,17 +37,17 @@ public: ~Server_i (void); // Destructor. - int init (int argc, - char *argv[], + int init (int argc, + char *argv[], CORBA::Environment &env); // Initialize the Server state - parsing arguments and waiting. int add_IOR_to_table (CORBA::String_var ior); // Add an IOR to the ORB-IOR table. - + int run (CORBA::Environment &env); // Run the orb. - + protected: INS_i servant_; @@ -66,9 +66,6 @@ protected: FILE *ior_output_file_; // File where the IOR of the server object is stored. - int naming_; - // Flag to indicate whether naming service could be used - char * ins_; // Used test the INS. diff --git a/TAO/tests/InterOp-Naming/run_test.pl b/TAO/tests/InterOp-Naming/run_test.pl new file mode 100755 index 00000000000..eb8b65c2c77 --- /dev/null +++ b/TAO/tests/InterOp-Naming/run_test.pl @@ -0,0 +1,101 @@ +eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' + & eval 'exec perl -S $0 $argv:q' + if 0; + +# $Id$ +# -*- perl -*- + +unshift @INC, '../../../bin'; +require Process; +require ACEutils; + +$file="test.ior"; + +$port = ACE::uniqueid () + 10000; + +print STDERR "\n\n==== InitRef test\n"; + +unlink $file; + +$SV = Process::Create ($EXEPREFIX."INS_test_server".$EXE_EXT, + "-ORBendpoint iiop://localhost:$port " + . " -i object_name -o $file"); + +if (ACE::waitforfile_timed ($file, 3) == -1) { + print STDERR "ERROR: cannot find file <$file>\n"; + $SV->Kill (); $SV->TimedWait (1); + exit 1; +} + +$CL = Process::Create ($EXEPREFIX."INS_test_client".$EXE_EXT, + " random_service " + ."-ORBInitRef random_service=" + ."iioploc://localhost:$port/object_name"); + +$client = $CL->TimedWait (60); +if ($client == -1) { + print STDERR "ERROR: client timedout\n"; + $CL->Kill (); $CL->TimedWait (1); + $SV->Kill (); $SV->TimedWait (1); + unlink $file; + exit 1; +} + +print STDERR "\n\n==== Multi endpoint tests\n"; + +print STDERR "Grace period, waiting for the system to stabilize...."; +sleep 5; + +$port1 = $port + 1; +$port2 = $port + 2; + +$CL = Process::Create ($EXEPREFIX."INS_test_client".$EXE_EXT, + " random_service " + . "-ORBInitRef random_service=" + ."iioploc://" + ."localhost:$port1," + ."localhost:$port2," + ."localhost:$port" + ."/object_name"); + +$client = $CL->TimedWait (60); +if ($client == -1) { + print STDERR "ERROR: client timedout\n"; + $CL->Kill (); $CL->TimedWait (1); + $SV->Kill (); $SV->TimedWait (1); + unlink $file; + exit 1; +} + +print STDERR "\n\n==== DefaultInitRef test\n"; + +print STDERR "Grace period, waiting for the system to stabilize...."; +sleep 5; + +$CL = Process::Create ($EXEPREFIX."INS_test_client".$EXE_EXT, + " object_name " + . "-ORBDefaultInitRef" + ."iioploc://" + ."localhost:$port1," + ."localhost:$port2," + ."localhost:$port/"); + +$client = $CL->TimedWait (60); +if ($client == -1) { + print STDERR "ERROR: client timedout\n"; + $CL->Kill (); $CL->TimedWait (1); + $SV->Kill (); $SV->TimedWait (1); + unlink $file; + exit 1; +} + +$SV->Terminate (); $server = $SV->TimedWait (5); +if ($server == -1) { + print STDERR "ERROR: server timedout\n"; + $SV->Kill (); $SV->TimedWait (1); + unlink $file; + exit 1; +} + +unlink $file; +exit 0; diff --git a/TAO/tests/MT_Client/run_test.pl b/TAO/tests/MT_Client/run_test.pl index 0ef900d07f4..013b5072717 100755 --- a/TAO/tests/MT_Client/run_test.pl +++ b/TAO/tests/MT_Client/run_test.pl @@ -36,10 +36,10 @@ if (ACE::waitforfile_timed ($iorfile, 5) == -1) { } $CL = Process::Create ($EXEPREFIX."$client_process$EXE_EXT ", - " -ORBsvcconf $client_conf " - . "-ORBdebuglevel $debug_level" - . " -k file://$iorfile " - . " -n $threads -i 1000"); + " -ORBsvcconf $client_conf " + . "-ORBdebuglevel $debug_level" + . " -k file://$iorfile " + . " -n $threads -i 1000"); $client = $CL->TimedWait (60); if ($client == -1) { diff --git a/TAO/tests/Multiple_Inheritance/run_test.pl b/TAO/tests/Multiple_Inheritance/run_test.pl index c8e6ca8b4aa..d85b757c175 100755 --- a/TAO/tests/Multiple_Inheritance/run_test.pl +++ b/TAO/tests/Multiple_Inheritance/run_test.pl @@ -10,7 +10,7 @@ require ACEutils; $iorfile = "server.ior"; $SV = Process::Create ($EXEPREFIX."server$EXE_EXT", - " -f $iorfile"); + " -f $iorfile"); if (ACE::waitforfile_timed ($iorfile, 5) == -1) { print STDERR "ERROR: cannot find file <$iorfile>\n"; @@ -19,7 +19,7 @@ if (ACE::waitforfile_timed ($iorfile, 5) == -1) { } $CL = Process::Create ($EXEPREFIX."client$EXE_EXT", - " -f $iorfile"); + " -f $iorfile"); $client = $CL->TimedWait (60); if ($client == -1) { @@ -35,7 +35,7 @@ if ($server == -1) { unlink $iorfile; -if ($server != 0 || $client != 0) { +if ($server == -1 || $client != 0) { exit 1; } |