summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorirfan <irfan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2001-08-26 07:15:04 +0000
committerirfan <irfan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2001-08-26 07:15:04 +0000
commit2ab9e5017178750e4b59f0d0693311baab85dd30 (patch)
tree541f53c22a548033c3c7227135ceab3104b6d12b
parenteeb95d3062ea649e7bd5591b3118d06b2edca025 (diff)
downloadATCD-2ab9e5017178750e4b59f0d0693311baab85dd30.tar.gz
New RTCORBA test.
-rw-r--r--TAO/tests/RTCORBA/Destroy_Thread_Pool/Destroy_Thread_Pool.cpp156
-rw-r--r--TAO/tests/RTCORBA/Destroy_Thread_Pool/Destroy_Thread_Pool.dsp103
-rw-r--r--TAO/tests/RTCORBA/Destroy_Thread_Pool/Destroy_Thread_Pool.dsw29
-rw-r--r--TAO/tests/RTCORBA/Destroy_Thread_Pool/Makefile53
-rw-r--r--TAO/tests/RTCORBA/Destroy_Thread_Pool/Makefile.bor26
-rw-r--r--TAO/tests/RTCORBA/Destroy_Thread_Pool/README7
-rwxr-xr-xTAO/tests/RTCORBA/Destroy_Thread_Pool/run_test.pl22
-rw-r--r--TAO/tests/RTCORBA/Makefile1
-rw-r--r--TAO/tests/RTCORBA/Makefile.bor1
-rw-r--r--TAO/tests/RTCORBA/RTCORBA_tests.dsw12
10 files changed, 410 insertions, 0 deletions
diff --git a/TAO/tests/RTCORBA/Destroy_Thread_Pool/Destroy_Thread_Pool.cpp b/TAO/tests/RTCORBA/Destroy_Thread_Pool/Destroy_Thread_Pool.cpp
new file mode 100644
index 00000000000..1d1974b1340
--- /dev/null
+++ b/TAO/tests/RTCORBA/Destroy_Thread_Pool/Destroy_Thread_Pool.cpp
@@ -0,0 +1,156 @@
+// $Id$
+
+#include "ace/Get_Opt.h"
+#include "tao/corba.h"
+#include "tao/RTCORBA/RTCORBA.h"
+
+ACE_RCSID(Destroy_Thread_Pools, Destroy_Thread_Pools, "$Id$")
+
+static CORBA::ULong stacksize = 0;
+static CORBA::ULong static_threads = 1;
+static CORBA::ULong dynamic_threads = 0;
+static RTCORBA::Priority default_priority =
+ RTCORBA::Priority (ACE_DEFAULT_THREAD_PRIORITY);
+static CORBA::Boolean allow_request_buffering = 0;
+static CORBA::Boolean allow_borrowing = 0;
+static CORBA::ULong max_buffered_requests = 0;
+static CORBA::ULong max_request_buffer_size = 0;
+static int iterations = 5;
+
+int
+parse_args (int argc, char *argv[])
+{
+ ACE_Get_Opt get_opts (argc, argv, "i:");
+ int c;
+
+ while ((c = get_opts ()) != -1)
+ switch (c)
+ {
+ case 'i':
+ iterations = ACE_OS::atoi (get_opts.optarg);
+ break;
+
+ case '?':
+ default:
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "usage: %s "
+ "-i <iterations> "
+ "\n",
+ argv [0]),
+ -1);
+ }
+
+ // Indicates sucessful parsing of the command line
+ return 0;
+}
+
+RTCORBA::ThreadpoolId
+create_threadpool (RTCORBA::RTORB_ptr rt_orb,
+ CORBA_Environment &ACE_TRY_ENV)
+{
+ RTCORBA::ThreadpoolId id =
+ rt_orb->create_threadpool (stacksize,
+ static_threads,
+ dynamic_threads,
+ default_priority,
+ allow_request_buffering,
+ max_buffered_requests,
+ max_request_buffer_size,
+ ACE_TRY_ENV);
+ ACE_CHECK;
+
+ return id;
+}
+
+RTCORBA::ThreadpoolId
+create_threadpool_with_lanes (RTCORBA::RTORB_ptr rt_orb,
+ CORBA_Environment &ACE_TRY_ENV)
+{
+ RTCORBA::ThreadpoolLanes lanes (2);
+ lanes.length (2);
+
+ lanes[0].lane_priority = default_priority;
+ lanes[0].static_threads = static_threads;
+ lanes[0].dynamic_threads = dynamic_threads;
+
+ lanes[1].lane_priority = default_priority;
+ lanes[1].static_threads = static_threads;
+ lanes[1].dynamic_threads = dynamic_threads;
+
+ RTCORBA::ThreadpoolId id =
+ rt_orb->create_threadpool_with_lanes (stacksize,
+ lanes,
+ allow_borrowing,
+ allow_request_buffering,
+ max_buffered_requests,
+ max_request_buffer_size,
+ ACE_TRY_ENV);
+ ACE_CHECK;
+
+ return id;
+}
+
+int
+main (int argc, char *argv[])
+{
+ ACE_TRY_NEW_ENV
+ {
+ CORBA::ORB_var orb =
+ CORBA::ORB_init (argc,
+ argv,
+ "",
+ ACE_TRY_ENV);
+ ACE_TRY_CHECK;
+
+ CORBA::Object_var object =
+ orb->resolve_initial_references ("RTORB",
+ ACE_TRY_ENV);
+ ACE_TRY_CHECK;
+
+ RTCORBA::RTORB_var rt_orb =
+ RTCORBA::RTORB::_narrow (object.in (),
+ ACE_TRY_ENV);
+ ACE_TRY_CHECK;
+
+ int result =
+ parse_args (argc, argv);
+ if (result != 0)
+ return result;
+
+ int i = 0;
+ for (i = 0;
+ i < iterations;
+ ++i)
+ {
+ RTCORBA::ThreadpoolId id =
+ create_threadpool (rt_orb.in (),
+ ACE_TRY_ENV);
+ ACE_TRY_CHECK;
+
+ //rt_orb->destroy_threadpool (id,
+ //ACE_TRY_ENV);
+ ACE_TRY_CHECK;
+
+ id =
+ create_threadpool_with_lanes (rt_orb.in (),
+ ACE_TRY_ENV);
+ ACE_TRY_CHECK;
+
+ //rt_orb->destroy_threadpool (id,
+ //ACE_TRY_ENV);
+ ACE_TRY_CHECK;
+ }
+
+ orb->destroy (ACE_TRY_ENV);
+ ACE_TRY_CHECK;
+ }
+ ACE_CATCHANY
+ {
+ ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION,
+ "Exception caught:");
+ return 1;
+ }
+ ACE_ENDTRY;
+
+ return 0;
+}
diff --git a/TAO/tests/RTCORBA/Destroy_Thread_Pool/Destroy_Thread_Pool.dsp b/TAO/tests/RTCORBA/Destroy_Thread_Pool/Destroy_Thread_Pool.dsp
new file mode 100644
index 00000000000..f18b3888e38
--- /dev/null
+++ b/TAO/tests/RTCORBA/Destroy_Thread_Pool/Destroy_Thread_Pool.dsp
@@ -0,0 +1,103 @@
+# Microsoft Developer Studio Project File - Name="Destroy_Thread_Pool" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Console Application" 0x0103
+
+CFG=Destroy_Thread_Pool - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE
+!MESSAGE NMAKE /f "Destroy_Thread_Pool.mak".
+!MESSAGE
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE
+!MESSAGE NMAKE /f "Destroy_Thread_Pool.mak" CFG="Destroy_Thread_Pool - Win32 Debug"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "Destroy_Thread_Pool - Win32 Release" (based on "Win32 (x86) Console Application")
+!MESSAGE "Destroy_Thread_Pool - Win32 Debug" (based on "Win32 (x86) Console Application")
+!MESSAGE
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+RSC=rc.exe
+
+!IF "$(CFG)" == "Destroy_Thread_Pool - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "Release"
+# PROP Intermediate_Dir "Release"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\..\\" /I "..\..\..\\" /I "..\..\..\..\\" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /FD /c
+# SUBTRACT CPP /YX
+# ADD BASE RSC /l 0x409 /d "NDEBUG"
+# ADD RSC /l 0x409 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
+# ADD LINK32 ace.lib TAO.lib TAO_RTCORBA.lib /nologo /subsystem:console /machine:I386 /libpath:"..\..\..\..\ace" /libpath:"..\..\..\tao" /libpath:"..\..\..\tao\RTCORBA"
+
+!ELSEIF "$(CFG)" == "Destroy_Thread_Pool - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir ""
+# PROP Intermediate_Dir "Debug"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /I "..\..\..\..\\" /I "..\..\..\\" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /FD /c
+# SUBTRACT CPP /YX
+# ADD BASE RSC /l 0x409 /d "_DEBUG"
+# ADD RSC /l 0x409 /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 aced.lib TAOd.lib TAO_RTCORBAd.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"..\..\..\..\ace" /libpath:"..\..\..\tao" /libpath:"..\..\..\tao\RTCORBA"
+
+!ENDIF
+
+# Begin Target
+
+# Name "Destroy_Thread_Pool - Win32 Release"
+# Name "Destroy_Thread_Pool - Win32 Debug"
+# Begin Group "Source Files"
+
+# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+# Begin Source File
+
+SOURCE=.\Destroy_Thread_Pool.cpp
+# End Source File
+
+# PROP Default_Filter "h;hpp;hxx;hm;inl"
+
+# End Group
+# Begin Group "Inline Files"
+
+# PROP Default_Filter "i"
+# End Group
+# End Target
+# End Project
diff --git a/TAO/tests/RTCORBA/Destroy_Thread_Pool/Destroy_Thread_Pool.dsw b/TAO/tests/RTCORBA/Destroy_Thread_Pool/Destroy_Thread_Pool.dsw
new file mode 100644
index 00000000000..acc0daffe59
--- /dev/null
+++ b/TAO/tests/RTCORBA/Destroy_Thread_Pool/Destroy_Thread_Pool.dsw
@@ -0,0 +1,29 @@
+Microsoft Developer Studio Workspace File, Format Version 6.00
+# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
+
+###############################################################################
+
+Project: "Destroy_Thread_Pool"=.\Destroy_Thread_Pool.dsp - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
+Global:
+
+Package=<5>
+{{{
+}}}
+
+Package=<3>
+{{{
+}}}
+
+###############################################################################
+
diff --git a/TAO/tests/RTCORBA/Destroy_Thread_Pool/Makefile b/TAO/tests/RTCORBA/Destroy_Thread_Pool/Makefile
new file mode 100644
index 00000000000..0c0e8f20280
--- /dev/null
+++ b/TAO/tests/RTCORBA/Destroy_Thread_Pool/Makefile
@@ -0,0 +1,53 @@
+#----------------------------------------------------------------------------
+#
+# $Id$
+#
+#----------------------------------------------------------------------------
+
+#----------------------------------------------------------------------------
+# Local macros
+#----------------------------------------------------------------------------
+
+ifndef TAO_ROOT
+ TAO_ROOT = $(ACE_ROOT)/TAO
+endif # ! TAO_ROOT
+
+BIN_UNCHECKED = Destroy_Thread_Pool
+
+SRC = $(addsuffix .cpp, $(BIN))
+
+DESTROY_THREAD_POOL_OBJS = $(SRC:.cpp=.o)
+
+BUILD = $(BIN)
+VBIN = $(BIN:%=%$(VAR))
+
+#----------------------------------------------------------------------------
+# Include macros and targets
+#----------------------------------------------------------------------------
+
+include $(ACE_ROOT)/include/makeinclude/wrapper_macros.GNU
+include $(ACE_ROOT)/include/makeinclude/macros.GNU
+include $(TAO_ROOT)/rules.tao.GNU
+
+ifeq ($(rt_corba),1)
+BIN=$(BIN_UNCHECKED)
+endif # rt_corba
+
+include $(ACE_ROOT)/include/makeinclude/rules.common.GNU
+include $(ACE_ROOT)/include/makeinclude/rules.nonested.GNU
+include $(ACE_ROOT)/include/makeinclude/rules.local.GNU
+include $(TAO_ROOT)/taoconfig.mk
+
+#----------------------------------------------------------------------------
+# Local targets
+#----------------------------------------------------------------------------
+
+.PRECIOUS: $(foreach ext, $(IDL_EXT), test$(ext))
+
+Destroy_Thread_Pool: $(addprefix $(VDIR),$(DESTROY_THREAD_POOL_OBJS))
+ $(LINK.cc) $(LDFLAGS) -o $@ $^ $(RT_TAO_CLNT_LIBS) $(POSTLINK)
+
+# DO NOT DELETE THIS LINE -- g++dep uses it.
+# DO NOT PUT ANYTHING AFTER THIS LINE, IT WILL GO AWAY.
+
+# IF YOU PUT ANYTHING HERE IT WILL GO AWAY
diff --git a/TAO/tests/RTCORBA/Destroy_Thread_Pool/Makefile.bor b/TAO/tests/RTCORBA/Destroy_Thread_Pool/Makefile.bor
new file mode 100644
index 00000000000..a4d20c2a288
--- /dev/null
+++ b/TAO/tests/RTCORBA/Destroy_Thread_Pool/Makefile.bor
@@ -0,0 +1,26 @@
+#
+# Makefile for building Destroy_Thread_Pool
+#
+
+NAME = Destroy_Thread_Pool
+
+
+OBJFILES = \
+ $(OBJDIR)\Destroy_Thread_Pool.obj
+
+CFLAGS = \
+ $(ACE_CFLAGS) \
+ $(TAO_CFLAGS) \
+ $(TAO_RTCORBA_CFLAGS)
+
+LIBFILES = \
+ $(ACE_LIB) \
+ $(TAO_LIB) \
+ $(TAO_RTCORBA_LIB)
+
+CPPDIR = .
+
+IDLDIR = .
+
+!include <$(ACE_ROOT)\include\makeinclude\build_exe.bor>
+!include <$(ACE_ROOT)\include\makeinclude\recurse.bor>
diff --git a/TAO/tests/RTCORBA/Destroy_Thread_Pool/README b/TAO/tests/RTCORBA/Destroy_Thread_Pool/README
new file mode 100644
index 00000000000..c756cead921
--- /dev/null
+++ b/TAO/tests/RTCORBA/Destroy_Thread_Pool/README
@@ -0,0 +1,7 @@
+$Id$
+
+Description:
+This is a simple test for creating and destroying thread pools (with
+and without lanes).
+
+See run_test.pl to see how to run this test. \ No newline at end of file
diff --git a/TAO/tests/RTCORBA/Destroy_Thread_Pool/run_test.pl b/TAO/tests/RTCORBA/Destroy_Thread_Pool/run_test.pl
new file mode 100755
index 00000000000..d04d0035c73
--- /dev/null
+++ b/TAO/tests/RTCORBA/Destroy_Thread_Pool/run_test.pl
@@ -0,0 +1,22 @@
+eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}'
+ & eval 'exec perl -S $0 $argv:q'
+ if 0;
+
+# $Id$
+# -*- perl -*-
+
+use lib '../../../../bin';
+use PerlACE::Run_Test;
+
+print STDERR "\n********** RTCORBA Destroy_Thread_Pool Unit Test **********\n\n";
+
+$T = new PerlACE::Process ("Destroy_Thread_Pool");
+
+$test = $T->SpawnWaitKill (60);
+
+if ($test != 0) {
+ print STDERR "ERROR: test returned $test\n";
+ exit 1;
+}
+
+exit 0;
diff --git a/TAO/tests/RTCORBA/Makefile b/TAO/tests/RTCORBA/Makefile
index 9eaf8713bfe..b882fa87ab4 100644
--- a/TAO/tests/RTCORBA/Makefile
+++ b/TAO/tests/RTCORBA/Makefile
@@ -13,6 +13,7 @@
DIRS = Banded_Connections \
Client_Propagated \
Client_Protocol \
+ Destroy_Thread_Pool \
Explicit_Binding \
Server_Declared \
Server_Protocol \
diff --git a/TAO/tests/RTCORBA/Makefile.bor b/TAO/tests/RTCORBA/Makefile.bor
index ad6a2339780..8346e8ec5a6 100644
--- a/TAO/tests/RTCORBA/Makefile.bor
+++ b/TAO/tests/RTCORBA/Makefile.bor
@@ -6,6 +6,7 @@ DIRS = \
Banded_Connections \
Client_Propagated \
Client_Protocol \
+ Destroy_Thread_Pool \
Explicit_Binding \
Server_Declared \
Server_Protocol \
diff --git a/TAO/tests/RTCORBA/RTCORBA_tests.dsw b/TAO/tests/RTCORBA/RTCORBA_tests.dsw
index b434f8578cb..39e58be4d54 100644
--- a/TAO/tests/RTCORBA/RTCORBA_tests.dsw
+++ b/TAO/tests/RTCORBA/RTCORBA_tests.dsw
@@ -171,6 +171,18 @@ Package=<4>
###############################################################################
+Project: "Destroy_Thread_Pool"=.\Destroy_Thread_Pool\Destroy_Thread_Pool.dsp - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
Project: "Policy_Combinations Client"=.\Policy_Combinations\client.dsp - Package Owner=<4>
Package=<5>