diff options
Diffstat (limited to 'cpp')
-rwxr-xr-x | cpp/allTests.py | 4 | ||||
-rw-r--r-- | cpp/config/TestUtil.py | 16 | ||||
-rw-r--r-- | cpp/doc/Properties.sgml | 24 | ||||
-rw-r--r-- | cpp/include/Ice/Config.h | 2 | ||||
-rw-r--r-- | cpp/include/Slice/Parser.h | 81 | ||||
-rw-r--r-- | cpp/src/Ice/.depend | 2 | ||||
-rw-r--r-- | cpp/src/Ice/Instance.cpp | 11 | ||||
-rw-r--r-- | cpp/src/Ice/Network.cpp | 6 | ||||
-rw-r--r-- | cpp/src/IcePack/Server.cpp | 15 | ||||
-rw-r--r-- | cpp/test/Ice/exceptions/Server.cpp | 25 | ||||
-rwxr-xr-x | cpp/test/Ice/exceptions/run.py | 8 | ||||
-rw-r--r-- | cpp/test/Ice/faultTolerance/Server.cpp | 13 | ||||
-rw-r--r-- | cpp/test/Ice/faultTolerance/TestI.cpp | 4 | ||||
-rwxr-xr-x | cpp/test/Ice/faultTolerance/run.py | 18 | ||||
-rw-r--r-- | cpp/test/Ice/inheritance/Server.cpp | 25 | ||||
-rwxr-xr-x | cpp/test/Ice/inheritance/run.py | 8 | ||||
-rw-r--r-- | cpp/test/Ice/locationForward/Server.cpp | 13 | ||||
-rwxr-xr-x | cpp/test/Ice/locationForward/run.py | 24 | ||||
-rw-r--r-- | cpp/test/Ice/operations/Server.cpp | 25 | ||||
-rwxr-xr-x | cpp/test/Ice/operations/run.py | 8 | ||||
-rw-r--r-- | cpp/test/IcePack/simple/Server.cpp | 25 | ||||
-rwxr-xr-x | cpp/test/IcePack/simple/run.py | 14 | ||||
-rwxr-xr-x | cpp/test/Slice/errorDetection/run.py | 12 |
23 files changed, 131 insertions, 252 deletions
diff --git a/cpp/allTests.py b/cpp/allTests.py index df3b10e284f..98748034cd6 100755 --- a/cpp/allTests.py +++ b/cpp/allTests.py @@ -11,8 +11,8 @@ import os -for toplevel in ["", "..", os.path.join("..", ".."), os.path.join("..", "..", "..")]: - if os.path.exists(os.path.join(toplevel, "config", "TestUtil.py")): +for toplevel in [".", "..", "../..", "../../..", "../../../.."]: + if os.path.exists(os.path.normpath(toplevel + "/config/TestUtil.py")): break else: raise "can't find toplevel directory!" diff --git a/cpp/config/TestUtil.py b/cpp/config/TestUtil.py index 008d3b123ea..eb2d286c3c5 100644 --- a/cpp/config/TestUtil.py +++ b/cpp/config/TestUtil.py @@ -29,12 +29,12 @@ def killServers(): def clientServerTest(toplevel, name): - testdir = os.path.join(toplevel, "test", name) - server = os.path.join(testdir, "server") - client = os.path.join(testdir, "client") + testdir = os.path.normpath(toplevel + "/test/" + name) + server = os.path.normpath(testdir + "/server") + client = os.path.normpath(testdir + "/client") print "starting server...", - serverPipe = os.popen(os.path.join(testdir, "server --pid")) + serverPipe = os.popen(server + " --Ice.PrintProcessId") output = serverPipe.readline().strip() if not output: print "failed!" @@ -43,7 +43,7 @@ def clientServerTest(toplevel, name): print "ok" print "starting client...", - clientPipe = os.popen(os.path.join(testdir, "client")) + clientPipe = os.popen(client) output = clientPipe.readline() if not output: print "failed!" @@ -59,11 +59,11 @@ def clientServerTest(toplevel, name): def collocatedTest(toplevel, name): - testdir = os.path.join(toplevel, "test", name) - collocated = os.path.join(testdir, "collocated") + testdir = os.path.normpath(toplevel + "/test/" + name) + collocated = os.path.normpath(testdir + "/collocated") print "starting collocated...", - collocatedPipe = os.popen(os.path.join(testdir, "collocated")) + collocatedPipe = os.popen(collocated) output = collocatedPipe.read().strip() if not output: print "failed!" diff --git a/cpp/doc/Properties.sgml b/cpp/doc/Properties.sgml index df2521374ae..7b0f0752e40 100644 --- a/cpp/doc/Properties.sgml +++ b/cpp/doc/Properties.sgml @@ -168,3 +168,27 @@ The number of threads in the thread pool. Default is 10. </section> +<!-- ********************************************************************** --> +<section><title>Miscellaneous</title> +<!-- ********************************************************************** --> + +<section><title>Ice.PrintProcessId</title> + +<section><title>Synopsis</title> +<synopsis> +Ice.PrintProcessId=<replaceable>num</replaceable> +</synopsis> +</section> + +<section> +<title>Description</title> +<para> +If <replaceable>num</replaceable> is set to a value larger or equal to +1, the process ID is printed on standard output upon startup. +</para> +</section> + +</section> + +</section> + diff --git a/cpp/include/Ice/Config.h b/cpp/include/Ice/Config.h index 21e3f0d945c..513beb38581 100644 --- a/cpp/include/Ice/Config.h +++ b/cpp/include/Ice/Config.h @@ -16,8 +16,6 @@ # include <windows.h> # include <process.h> -inline int getpid() { return _getpid(); } - // '...' : forcing value to bool 'true' or 'false' (performance warning) # pragma warning( disable : 4800 ) // ... identifier was truncated to '255' characters in the debug information diff --git a/cpp/include/Slice/Parser.h b/cpp/include/Slice/Parser.h index d3cc35b2a47..4ba8e925554 100644 --- a/cpp/include/Slice/Parser.h +++ b/cpp/include/Slice/Parser.h @@ -8,8 +8,8 @@ // // ********************************************************************** -#ifndef PARSER_H -#define PARSER_H +#ifndef SLICE_PARSER_H +#define SLICE_PARSER_H #include <Ice/Shared.h> #include <Ice/Handle.h> @@ -137,18 +137,18 @@ class ICE_API ParserVisitor public: virtual ~ParserVisitor() { } - virtual void visitUnitStart(const UnitPtr&) { }; - virtual void visitUnitEnd(const UnitPtr&) { }; - virtual void visitModuleStart(const ModulePtr&) { }; - virtual void visitModuleEnd(const ModulePtr&) { }; - virtual void visitClassDecl(const ClassDeclPtr&) { }; - virtual void visitClassDefStart(const ClassDefPtr&) { }; - virtual void visitClassDefEnd(const ClassDefPtr&) { }; - virtual void visitOperation(const OperationPtr&) { }; - virtual void visitDataMember(const DataMemberPtr&) { }; - virtual void visitVector(const VectorPtr&) { }; - virtual void visitEnum(const EnumPtr&) { }; - virtual void visitNative(const NativePtr&) { }; + virtual void visitUnitStart(const UnitPtr&) { } + virtual void visitUnitEnd(const UnitPtr&) { } + virtual void visitModuleStart(const ModulePtr&) { } + virtual void visitModuleEnd(const ModulePtr&) { } + virtual void visitClassDecl(const ClassDeclPtr&) { } + virtual void visitClassDefStart(const ClassDefPtr&) { } + virtual void visitClassDefEnd(const ClassDefPtr&) { } + virtual void visitOperation(const OperationPtr&) { } + virtual void visitDataMember(const DataMemberPtr&) { } + virtual void visitVector(const VectorPtr&) { } + virtual void visitEnum(const EnumPtr&) { } + virtual void visitNative(const NativePtr&) { } }; // ---------------------------------------------------------------------- @@ -255,8 +255,7 @@ public: protected: - Contained(const ContainerPtr&, - const std::string&); + Contained(const ContainerPtr&, const std::string&); friend class ICE_API Container; ContainerPtr _container; @@ -278,8 +277,7 @@ public: virtual void destroy(); ModulePtr createModule(const std::string&); - ClassDefPtr createClassDef(const std::string&, bool, bool, - const ClassList&); + ClassDefPtr createClassDef(const std::string&, bool, bool, const ClassList&); ClassDeclPtr createClassDecl(const std::string&, bool, bool); VectorPtr createVector(const std::string&, const TypePtr&); EnumPtr createEnum(const std::string&, const StringList&); @@ -307,8 +305,7 @@ protected: Container(const UnitPtr&); - bool checkInterfaceAndLocal(const std::string&, bool, - bool, bool, bool, bool); + bool checkInterfaceAndLocal(const std::string&, bool, bool, bool, bool, bool); int _includeLevel; ContainedList _contents; @@ -327,8 +324,7 @@ public: protected: - Module(const ContainerPtr&, - const std::string&); + Module(const ContainerPtr&, const std::string&); friend class ICE_API Container; }; @@ -342,8 +338,7 @@ public: protected: - Constructed(const ContainerPtr&, - const std::string&); + Constructed(const ContainerPtr&, const std::string&); }; // ---------------------------------------------------------------------- @@ -362,10 +357,7 @@ public: protected: - ClassDecl(const ContainerPtr&, - const std::string&, - bool, - bool); + ClassDecl(const ContainerPtr&, const std::string&, bool, bool); friend class ICE_API Container; friend class ICE_API ClassDef; @@ -399,11 +391,7 @@ public: protected: - ClassDef(const ContainerPtr&, - const std::string&, - bool, - bool, - const ClassList&); + ClassDef(const ContainerPtr&, const std::string&, bool, bool, const ClassList&); friend class ICE_API Container; bool _local; @@ -446,13 +434,8 @@ public: protected: - Operation(const ContainerPtr&, - const std::string&, - const TypePtr&, - const TypeStringList&, - const TypeStringList&, - const TypeList&, - bool); + Operation(const ContainerPtr&, const std::string&, const TypePtr&, const TypeStringList&, const TypeStringList&, + const TypeList&, bool); friend class ICE_API ClassDef; TypePtr _returnType; @@ -476,9 +459,7 @@ public: protected: - DataMember(const ContainerPtr&, - const std::string&, - const TypePtr&); + DataMember(const ContainerPtr&, const std::string&, const TypePtr&); friend class ICE_API ClassDef; TypePtr _type; @@ -498,9 +479,7 @@ public: protected: - Vector(const ContainerPtr&, - const std::string&, - const TypePtr&); + Vector(const ContainerPtr&, const std::string&, const TypePtr&); friend class ICE_API Container; TypePtr _type; @@ -520,9 +499,7 @@ public: protected: - Enum(const ContainerPtr&, - const std::string&, - const StringList&); + Enum(const ContainerPtr&, const std::string&, const StringList&); friend class ICE_API Container; StringList _enumerators; @@ -540,8 +517,7 @@ public: protected: - Enumerator(const ContainerPtr&, - const std::string&); + Enumerator(const ContainerPtr&, const std::string&); friend class ICE_API Container; }; @@ -558,8 +534,7 @@ public: protected: - Native(const ContainerPtr&, - const std::string&); + Native(const ContainerPtr&, const std::string&); friend class Container; }; diff --git a/cpp/src/Ice/.depend b/cpp/src/Ice/.depend index 096a6223d1b..26e71165f09 100644 --- a/cpp/src/Ice/.depend +++ b/cpp/src/Ice/.depend @@ -9,7 +9,7 @@ Logger.o: Logger.cpp ../../include/Ice/Logger.h ../../include/Ice/ProxyF.h ../.. LoggerI.o: LoggerI.cpp ../Ice/LoggerI.h ../../include/Ice/Logger.h ../../include/Ice/ProxyF.h ../../include/Ice/ProxyHandle.h ../../include/Ice/Config.h ../../include/Ice/ObjectF.h ../../include/Ice/Handle.h ../../include/Ice/LocalObjectF.h ../../include/Ice/Native.h ../../include/Ice/LocalObject.h ../../include/Ice/Shared.h TraceLevels.o: TraceLevels.cpp ../Ice/TraceLevels.h ../Ice/TraceLevelsF.h ../../include/Ice/Handle.h ../../include/Ice/Config.h ../../include/Ice/PropertiesF.h ../../include/Ice/ProxyF.h ../../include/Ice/ProxyHandle.h ../../include/Ice/ObjectF.h ../../include/Ice/LocalObjectF.h ../../include/Ice/Native.h ../../include/Ice/LocalObject.h ../../include/Ice/Shared.h ../../include/Ice/Properties.h TraceUtil.o: TraceUtil.cpp ../Ice/TraceUtil.h ../../include/Ice/LoggerF.h ../../include/Ice/ProxyF.h ../../include/Ice/ProxyHandle.h ../../include/Ice/Config.h ../../include/Ice/ObjectF.h ../../include/Ice/Handle.h ../../include/Ice/LocalObjectF.h ../../include/Ice/Native.h ../../include/Ice/LocalObject.h ../../include/Ice/Shared.h ../Ice/TraceLevelsF.h ../Ice/Instance.h ../../include/Ice/InstanceF.h ../../include/Ice/CommunicatorF.h ../../include/Ice/PropertiesF.h ../../include/Ice/ProxyFactoryF.h ../Ice/ThreadPoolF.h ../../include/Ice/EmitterF.h ../Ice/ValueFactoryManagerF.h ../../include/Ice/ObjectAdapterFactoryF.h ../../include/Ice/PicklerF.h ../Ice/TraceLevels.h ../../include/Ice/Logger.h ../../include/Ice/Stream.h ../../include/Ice/Buffer.h -Instance.o: Instance.cpp ../Ice/Instance.h ../../include/Ice/InstanceF.h ../../include/Ice/Handle.h ../../include/Ice/Config.h ../../include/Ice/CommunicatorF.h ../../include/Ice/ProxyF.h ../../include/Ice/ProxyHandle.h ../../include/Ice/ObjectF.h ../../include/Ice/LocalObjectF.h ../../include/Ice/Native.h ../../include/Ice/LocalObject.h ../../include/Ice/Shared.h ../../include/Ice/PropertiesF.h ../../include/Ice/LoggerF.h ../Ice/TraceLevelsF.h ../../include/Ice/ProxyFactoryF.h ../Ice/ThreadPoolF.h ../../include/Ice/EmitterF.h ../Ice/ValueFactoryManagerF.h ../../include/Ice/ObjectAdapterFactoryF.h ../../include/Ice/PicklerF.h ../Ice/TraceLevels.h ../Ice/ProxyFactory.h ../../include/Ice/ReferenceF.h ../Ice/ThreadPool.h ../Ice/EventHandlerF.h ../Ice/Emitter.h ../Ice/TransceiverF.h ../Ice/ConnectorF.h ../Ice/EndpointF.h ../Ice/EventHandler.h ../../include/Ice/Stream.h ../../include/Ice/Buffer.h ../Ice/ValueFactoryManager.h ../../include/Ice/ValueFactoryF.h ../Ice/ObjectAdapterFactory.h ../../include/Ice/ObjectAdapterF.h ../../include/Ice/LocalException.h ../Ice/LoggerI.h ../../include/Ice/Logger.h ../Ice/PicklerI.h ../../include/Ice/Pickler.h +Instance.o: Instance.cpp ../Ice/Instance.h ../../include/Ice/InstanceF.h ../../include/Ice/Handle.h ../../include/Ice/Config.h ../../include/Ice/CommunicatorF.h ../../include/Ice/ProxyF.h ../../include/Ice/ProxyHandle.h ../../include/Ice/ObjectF.h ../../include/Ice/LocalObjectF.h ../../include/Ice/Native.h ../../include/Ice/LocalObject.h ../../include/Ice/Shared.h ../../include/Ice/PropertiesF.h ../../include/Ice/LoggerF.h ../Ice/TraceLevelsF.h ../../include/Ice/ProxyFactoryF.h ../Ice/ThreadPoolF.h ../../include/Ice/EmitterF.h ../Ice/ValueFactoryManagerF.h ../../include/Ice/ObjectAdapterFactoryF.h ../../include/Ice/PicklerF.h ../Ice/TraceLevels.h ../Ice/ProxyFactory.h ../../include/Ice/ReferenceF.h ../Ice/ThreadPool.h ../Ice/EventHandlerF.h ../Ice/Emitter.h ../Ice/TransceiverF.h ../Ice/ConnectorF.h ../Ice/EndpointF.h ../Ice/EventHandler.h ../../include/Ice/Stream.h ../../include/Ice/Buffer.h ../Ice/ValueFactoryManager.h ../../include/Ice/ValueFactoryF.h ../Ice/ObjectAdapterFactory.h ../../include/Ice/ObjectAdapterF.h ../../include/Ice/LocalException.h ../../include/Ice/Properties.h ../Ice/LoggerI.h ../../include/Ice/Logger.h ../Ice/PicklerI.h ../../include/Ice/Pickler.h Communicator.o: Communicator.cpp ../../include/Ice/Communicator.h ../../include/Ice/ProxyF.h ../../include/Ice/ProxyHandle.h ../../include/Ice/Config.h ../../include/Ice/ObjectF.h ../../include/Ice/Handle.h ../../include/Ice/LocalObjectF.h ../../include/Ice/Native.h ../../include/Ice/LocalObject.h ../../include/Ice/Shared.h ../../include/Ice/LoggerF.h ../../include/Ice/ObjectAdapterF.h ../../include/Ice/PicklerF.h ../../include/Ice/PropertiesF.h ../../include/Ice/ValueFactoryF.h ../../include/Ice/Stream.h ../../include/Ice/InstanceF.h ../../include/Ice/Buffer.h CommunicatorI.o: CommunicatorI.cpp ../Ice/CommunicatorI.h ../../include/Ice/InstanceF.h ../../include/Ice/Handle.h ../../include/Ice/Config.h ../../include/Ice/Communicator.h ../../include/Ice/ProxyF.h ../../include/Ice/ProxyHandle.h ../../include/Ice/ObjectF.h ../../include/Ice/LocalObjectF.h ../../include/Ice/Native.h ../../include/Ice/LocalObject.h ../../include/Ice/Shared.h ../../include/Ice/LoggerF.h ../../include/Ice/ObjectAdapterF.h ../../include/Ice/PicklerF.h ../../include/Ice/PropertiesF.h ../../include/Ice/ValueFactoryF.h ../Ice/PropertiesI.h ../../include/Ice/Properties.h ../Ice/Instance.h ../../include/Ice/CommunicatorF.h ../Ice/TraceLevelsF.h ../../include/Ice/ProxyFactoryF.h ../Ice/ThreadPoolF.h ../../include/Ice/EmitterF.h ../Ice/ValueFactoryManagerF.h ../../include/Ice/ObjectAdapterFactoryF.h ../Ice/ProxyFactory.h ../../include/Ice/ReferenceF.h ../Ice/ThreadPool.h ../Ice/EventHandlerF.h ../../include/Ice/ObjectAdapter.h ../Ice/ValueFactoryManager.h ../Ice/ObjectAdapterFactory.h ../../include/Ice/Logger.h ../../include/Ice/Initialize.h ../../include/Ice/LocalException.h ObjectAdapter.o: ObjectAdapter.cpp ../../include/Ice/ObjectAdapter.h ../../include/Ice/ProxyF.h ../../include/Ice/ProxyHandle.h ../../include/Ice/Config.h ../../include/Ice/ObjectF.h ../../include/Ice/Handle.h ../../include/Ice/LocalObjectF.h ../../include/Ice/Native.h ../../include/Ice/LocalObject.h ../../include/Ice/Shared.h ../../include/Ice/CommunicatorF.h ../../include/Ice/Stream.h ../../include/Ice/InstanceF.h ../../include/Ice/Buffer.h diff --git a/cpp/src/Ice/Instance.cpp b/cpp/src/Ice/Instance.cpp index 08002462d84..41ba778cadc 100644 --- a/cpp/src/Ice/Instance.cpp +++ b/cpp/src/Ice/Instance.cpp @@ -16,6 +16,7 @@ #include <Ice/ValueFactoryManager.h> #include <Ice/ObjectAdapterFactory.h> #include <Ice/LocalException.h> +#include <Ice/Properties.h> #include <Ice/LoggerI.h> #include <Ice/PicklerI.h> @@ -145,6 +146,16 @@ IceInternal::Instance::Instance(const CommunicatorPtr& communicator, const Prope if (++_globalStateCounter == 1) // Only on first call { + string value = properties->getProperty("Ice.PrintProcessId"); + if (atoi(value.c_str()) >= 1) + { +#ifdef WIN32 + cout << _getpid() << endl; +#else + cout << getpid() << endl; +#endif + } + #ifdef WIN32 WORD version = MAKEWORD(1, 1); WSADATA data; diff --git a/cpp/src/Ice/Network.cpp b/cpp/src/Ice/Network.cpp index 1c74ec036ad..34d88b86045 100644 --- a/cpp/src/Ice/Network.cpp +++ b/cpp/src/Ice/Network.cpp @@ -478,7 +478,7 @@ IceInternal::getAddress(const char* host, int port, struct sockaddr_in& addr) JTCSyncT<JTCMutex> sync(getHostByNameMutex); struct hostent* entry; - int retry = 5; // TODO: Should be configurable + int retry = 5; do { @@ -512,7 +512,7 @@ IceInternal::getLocalAddress(int port, struct sockaddr_in& addr) JTCSyncT<JTCMutex> sync(getHostByNameMutex); struct hostent* entry; - int retry = 5; // TODO: Should be configurable + int retry = 5; do { @@ -542,7 +542,7 @@ IceInternal::getLocalHost(bool numeric) JTCSyncT<JTCMutex> sync(getHostByNameMutex); struct hostent* entry; - int retry = 5; // TODO: Should be configurable + int retry = 5; do entry = gethostbyname(host); diff --git a/cpp/src/IcePack/Server.cpp b/cpp/src/IcePack/Server.cpp index 115e1628b1f..5387708f0bb 100644 --- a/cpp/src/IcePack/Server.cpp +++ b/cpp/src/IcePack/Server.cpp @@ -25,12 +25,11 @@ usage(const char* n) "-h, --help Show this message.\n" "-v, --version Display the Ice version.\n" "--nowarn Don't print any security warnings.\n" - "--pid Print the process id on standard output upon startup.\n" ; } int -run(int argc, char* argv[], CommunicatorPtr communicator, bool pid, bool nowarn) +run(int argc, char* argv[], CommunicatorPtr communicator, bool nowarn) { PropertiesPtr properties = communicator->getProperties(); @@ -61,11 +60,6 @@ run(int argc, char* argv[], CommunicatorPtr communicator, bool pid, bool nowarn) forwardAdapter->setObjectLocator(forward); forwardAdapter->activate(); - if (pid) - { - cout << getpid() << endl; - } - communicator->waitForShutdown(); return EXIT_SUCCESS; } @@ -76,7 +70,6 @@ main(int argc, char* argv[]) PropertiesPtr properties = getDefaultProperties(argc, argv); bool nowarn = false; - bool pid = false; for (int i = 1; i < argc; ++i) { if (strcmp(argv[i], "-h") == 0 || strcmp(argv[i], "--help") == 0) @@ -93,10 +86,6 @@ main(int argc, char* argv[]) { nowarn = true; } - else if(strcmp(argv[i], "--pid") == 0) - { - pid = true; - } else { cerr << argv[0] << ": unknown option `" << argv[i] << "'" << endl; @@ -111,7 +100,7 @@ main(int argc, char* argv[]) try { communicator = initializeWithProperties(properties); - status = run(argc, argv, communicator, pid, nowarn); + status = run(argc, argv, communicator, nowarn); } catch(const LocalException& ex) { diff --git a/cpp/test/Ice/exceptions/Server.cpp b/cpp/test/Ice/exceptions/Server.cpp index 8b17fadd310..3789d6fa6b2 100644 --- a/cpp/test/Ice/exceptions/Server.cpp +++ b/cpp/test/Ice/exceptions/Server.cpp @@ -13,39 +13,14 @@ using namespace std; -void -usage(const char* n) -{ - cerr << "Usage: " << n << " [--pid]\n"; -} - int run(int argc, char* argv[], Ice::CommunicatorPtr communicator) { - bool pid = false; - for (int i = 1; i < argc; ++i) - { - if(strcmp(argv[i], "--pid") == 0) - { - pid = true; - } - else - { - cerr << argv[0] << ": unknown option `" << argv[i] << "'" << endl; - usage(argv[0]); - return EXIT_FAILURE; - } - } - string endpts("tcp -p 12345 -t 2000"); Ice::ObjectAdapterPtr adapter = communicator->createObjectAdapterWithEndpoints("TestAdapter", endpts); Ice::ObjectPtr object = new ThrowerI(adapter); adapter->add(object, "thrower"); adapter->activate(); - if (pid) - { - cout << getpid() << endl; - } communicator->waitForShutdown(); return EXIT_SUCCESS; } diff --git a/cpp/test/Ice/exceptions/run.py b/cpp/test/Ice/exceptions/run.py index c6390222383..2873635c052 100755 --- a/cpp/test/Ice/exceptions/run.py +++ b/cpp/test/Ice/exceptions/run.py @@ -11,16 +11,16 @@ import os, sys -for toplevel in ["", "..", os.path.join("..", ".."), os.path.join("..", "..", "..")]: - if os.path.exists(os.path.join(toplevel, "config", "TestUtil.py")): +for toplevel in [".", "..", "../..", "../../..", "../../../.."]: + if os.path.exists(os.path.normpath(toplevel + "/config/TestUtil.py")): break else: raise "can't find toplevel directory!" -sys.path.append(os.path.join(toplevel, "config")) +sys.path.append(os.path.normpath(toplevel + "/config")) import TestUtil -name = os.path.join("Ice", "exceptions") +name = "Ice/exceptions" TestUtil.clientServerTest(toplevel, name) TestUtil.collocatedTest(toplevel, name) sys.exit(1) diff --git a/cpp/test/Ice/faultTolerance/Server.cpp b/cpp/test/Ice/faultTolerance/Server.cpp index 71eb516e31e..61795f3b5b8 100644 --- a/cpp/test/Ice/faultTolerance/Server.cpp +++ b/cpp/test/Ice/faultTolerance/Server.cpp @@ -17,21 +17,16 @@ using namespace std; void usage(const char* n) { - cerr << "Usage: " << n << " [--pid] port\n"; + cerr << "Usage: " << n << " port\n"; } int run(int argc, char* argv[], Ice::CommunicatorPtr communicator) { int port = 0; - bool pid = false; for (int i = 1; i < argc; ++i) { - if(strcmp(argv[i], "--pid") == 0) - { - pid = true; - } - else if (argv[i][0] == '-') + if (argv[i][0] == '-') { cerr << argv[0] << ": unknown option `" << argv[i] << "'" << endl; usage(argv[0]); @@ -61,10 +56,6 @@ run(int argc, char* argv[], Ice::CommunicatorPtr communicator) Ice::ObjectPtr object = new TestI(adapter); adapter->add(object, "test"); adapter->activate(); - if (pid) - { - cout << getpid() << endl; - } communicator->waitForShutdown(); return EXIT_SUCCESS; } diff --git a/cpp/test/Ice/faultTolerance/TestI.cpp b/cpp/test/Ice/faultTolerance/TestI.cpp index 74a5e5d37a1..ead6826629a 100644 --- a/cpp/test/Ice/faultTolerance/TestI.cpp +++ b/cpp/test/Ice/faultTolerance/TestI.cpp @@ -37,5 +37,9 @@ TestI::nonmutatingAbort() Ice::Int TestI::pid() { +#ifdef WIN32 + return _getpid(); +#else return getpid(); +#endif } diff --git a/cpp/test/Ice/faultTolerance/run.py b/cpp/test/Ice/faultTolerance/run.py index 13f5b0a432b..884b1360fdf 100755 --- a/cpp/test/Ice/faultTolerance/run.py +++ b/cpp/test/Ice/faultTolerance/run.py @@ -11,20 +11,18 @@ import os, sys -for toplevel in ["", "..", os.path.join("..", ".."), os.path.join("..", "..", "..")]: - if os.path.exists(os.path.join(toplevel, "config", "TestUtil.py")): +for toplevel in [".", "..", "../..", "../../..", "../../../.."]: + if os.path.exists(os.path.normpath(toplevel + "/config/TestUtil.py")): break else: raise "can't find toplevel directory!" -sys.path.append(os.path.join(toplevel, "config")) +sys.path.append(os.path.normpath(toplevel + "/config")) import TestUtil -name = os.path.join("Ice", "faultTolerance") - -testdir = os.path.join(toplevel, "test", name) -server = os.path.join(testdir, "server") -client = os.path.join(testdir, "client") +testdir = os.path.normpath(toplevel + "/test/Ice/faultTolerance") +server = os.path.normpath(testdir + "/server") +client = os.path.normpath(testdir + "/client") num = 8 base = 12340 @@ -32,7 +30,7 @@ base = 12340 serverPipes = { } for i in range(0, num): print "starting server #%d..." % (i + 1), - serverPipes[i] = os.popen(os.path.join(testdir, "server --pid %d" % (base + i))) + serverPipes[i] = os.popen(server + " --Ice.PrintProcessId %d" % (base + i)) output = serverPipes[i].readline().strip() if not output: print "failed!" @@ -44,7 +42,7 @@ print "starting client...", ports = "" for i in range(0, num): ports = "%s %d" % (ports, base + i) -clientPipe = os.popen(os.path.join(testdir, "client" + ports)) +clientPipe = os.popen(client + " " + ports) output = clientPipe.readline() if not output: print "failed!" diff --git a/cpp/test/Ice/inheritance/Server.cpp b/cpp/test/Ice/inheritance/Server.cpp index af907c9e1e9..9468768ebfd 100644 --- a/cpp/test/Ice/inheritance/Server.cpp +++ b/cpp/test/Ice/inheritance/Server.cpp @@ -13,39 +13,14 @@ using namespace std; -void -usage(const char* n) -{ - cerr << "Usage: " << n << " [--pid]\n"; -} - int run(int argc, char* argv[], Ice::CommunicatorPtr communicator) { - bool pid = false; - for (int i = 1; i < argc; ++i) - { - if(strcmp(argv[i], "--pid") == 0) - { - pid = true; - } - else - { - cerr << argv[0] << ": unknown option `" << argv[i] << "'" << endl; - usage(argv[0]); - return EXIT_FAILURE; - } - } - string endpts("tcp -p 12345 -t 2000"); Ice::ObjectAdapterPtr adapter = communicator->createObjectAdapterWithEndpoints("TestAdapter", endpts); Ice::ObjectPtr object = new InitialI(adapter); adapter->add(object, "initial"); adapter->activate(); - if (pid) - { - cout << getpid() << endl; - } communicator->waitForShutdown(); return EXIT_SUCCESS; } diff --git a/cpp/test/Ice/inheritance/run.py b/cpp/test/Ice/inheritance/run.py index 11efe6c5045..f687cef2beb 100755 --- a/cpp/test/Ice/inheritance/run.py +++ b/cpp/test/Ice/inheritance/run.py @@ -11,16 +11,16 @@ import os, sys -for toplevel in ["", "..", os.path.join("..", ".."), os.path.join("..", "..", "..")]: - if os.path.exists(os.path.join(toplevel, "config", "TestUtil.py")): +for toplevel in [".", "..", "../..", "../../..", "../../../.."]: + if os.path.exists(os.path.normpath(toplevel + "/config/TestUtil.py")): break else: raise "can't find toplevel directory!" -sys.path.append(os.path.join(toplevel, "config")) +sys.path.append(os.path.normpath(toplevel + "/config")) import TestUtil -name = os.path.join("Ice", "inheritance") +name = "Ice/inheritance" TestUtil.clientServerTest(toplevel, name) TestUtil.collocatedTest(toplevel, name) sys.exit(1) diff --git a/cpp/test/Ice/locationForward/Server.cpp b/cpp/test/Ice/locationForward/Server.cpp index 9e2878bbbd0..2157d7c9556 100644 --- a/cpp/test/Ice/locationForward/Server.cpp +++ b/cpp/test/Ice/locationForward/Server.cpp @@ -17,22 +17,17 @@ using namespace std; void usage(const char* n) { - cerr << "Usage: " << n << " [--pid] [--fwd reference] port\n"; + cerr << "Usage: " << n << " [--fwd reference] port\n"; } int run(int argc, char* argv[], Ice::CommunicatorPtr communicator) { int port = 0; - bool pid = false; Ice::ObjectPrx fwd; for (int i = 1; i < argc; ++i) { - if(strcmp(argv[i], "--pid") == 0) - { - pid = true; - } - else if (strcmp(argv[i], "--fwd") == 0) + if (strcmp(argv[i], "--fwd") == 0) { if (i + 1 >= argc) { @@ -73,10 +68,6 @@ run(int argc, char* argv[], Ice::CommunicatorPtr communicator) Ice::ObjectPtr object = new TestI(adapter, fwd); adapter->add(object, "test"); adapter->activate(); - if (pid) - { - cout << getpid() << endl; - } communicator->waitForShutdown(); return EXIT_SUCCESS; } diff --git a/cpp/test/Ice/locationForward/run.py b/cpp/test/Ice/locationForward/run.py index f09af503ef4..3685b9f7c31 100755 --- a/cpp/test/Ice/locationForward/run.py +++ b/cpp/test/Ice/locationForward/run.py @@ -11,20 +11,18 @@ import os, sys -for toplevel in ["", "..", os.path.join("..", ".."), os.path.join("..", "..", "..")]: - if os.path.exists(os.path.join(toplevel, "config", "TestUtil.py")): +for toplevel in [".", "..", "../..", "../../..", "../../../.."]: + if os.path.exists(os.path.normpath(toplevel + "/config/TestUtil.py")): break else: raise "can't find toplevel directory!" -sys.path.append(os.path.join(toplevel, "config")) +sys.path.append(os.path.normpath(toplevel + "/config")) import TestUtil -name = os.path.join("Ice", "locationForward") - -testdir = os.path.join(toplevel, "test", name) -server = os.path.join(testdir, "server") -client = os.path.join(testdir, "client") +testdir = os.path.normpath(toplevel + "/test/Ice/locationForward") +server = os.path.normpath(testdir + "/server") +client = os.path.normpath(testdir + "/client") num = 5 base = 12340 @@ -33,10 +31,10 @@ serverPipes = { } for i in range(0, num): print "starting server #%d..." % (i + 1), if i + 1 < num: - s = "server --pid --fwd \"test:tcp -t 2000 -p %d\" %d" % ((base + i + 1), (base + i)) + s = "--Ice.PrintProcessId --fwd \"test:tcp -t 2000 -p %d\" %d" % ((base + i + 1), (base + i)) else: - s = "server --pid %d" % (base + i) - serverPipes[i] = os.popen(os.path.join(testdir, s)) + s = "--Ice.PrintProcessId %d" % (base + i) + serverPipes[i] = os.popen(server + " " + s) output = serverPipes[i].readline().strip() if not output: print "failed!" @@ -45,8 +43,8 @@ for i in range(0, num): print "ok" print "starting client...", -s = "client %d %d" % (base, (base + num - 1)) -clientPipe = os.popen(os.path.join(testdir, s)) +s = "%d %d" % (base, (base + num - 1)) +clientPipe = os.popen(client + " " + s) output = clientPipe.readline() if not output: print "failed!" diff --git a/cpp/test/Ice/operations/Server.cpp b/cpp/test/Ice/operations/Server.cpp index 634b675aa72..009addc9d65 100644 --- a/cpp/test/Ice/operations/Server.cpp +++ b/cpp/test/Ice/operations/Server.cpp @@ -13,39 +13,14 @@ using namespace std; -void -usage(const char* n) -{ - cerr << "Usage: " << n << " [--pid]\n"; -} - int run(int argc, char* argv[], Ice::CommunicatorPtr communicator) { - bool pid = false; - for (int i = 1; i < argc; ++i) - { - if(strcmp(argv[i], "--pid") == 0) - { - pid = true; - } - else - { - cerr << argv[0] << ": unknown option `" << argv[i] << "'" << endl; - usage(argv[0]); - return EXIT_FAILURE; - } - } - string endpts("tcp -p 12345 -t 2000"); Ice::ObjectAdapterPtr adapter = communicator->createObjectAdapterWithEndpoints("TestAdapter", endpts); Ice::ObjectPtr object = new MyDerivedClassI(adapter); adapter->add(object, "test"); adapter->activate(); - if (pid) - { - cout << getpid() << endl; - } communicator->waitForShutdown(); return EXIT_SUCCESS; } diff --git a/cpp/test/Ice/operations/run.py b/cpp/test/Ice/operations/run.py index 166c21d0430..4117811f191 100755 --- a/cpp/test/Ice/operations/run.py +++ b/cpp/test/Ice/operations/run.py @@ -11,16 +11,16 @@ import os, sys -for toplevel in ["", "..", os.path.join("..", ".."), os.path.join("..", "..", "..")]: - if os.path.exists(os.path.join(toplevel, "config", "TestUtil.py")): +for toplevel in [".", "..", "../..", "../../..", "../../../.."]: + if os.path.exists(os.path.normpath(toplevel + "/config/TestUtil.py")): break else: raise "can't find toplevel directory!" -sys.path.append(os.path.join(toplevel, "config")) +sys.path.append(os.path.normpath(toplevel + "/config")) import TestUtil -name = os.path.join("Ice", "operations") +name = "Ice/operations" TestUtil.clientServerTest(toplevel, name) TestUtil.collocatedTest(toplevel, name) sys.exit(1) diff --git a/cpp/test/IcePack/simple/Server.cpp b/cpp/test/IcePack/simple/Server.cpp index 1099747e251..075d4a084f4 100644 --- a/cpp/test/IcePack/simple/Server.cpp +++ b/cpp/test/IcePack/simple/Server.cpp @@ -13,39 +13,14 @@ using namespace std; -void -usage(const char* n) -{ - cerr << "Usage: " << n << " [--pid]\n"; -} - int run(int argc, char* argv[], Ice::CommunicatorPtr communicator) { - bool pid = false; - for (int i = 1; i < argc; ++i) - { - if(strcmp(argv[i], "--pid") == 0) - { - pid = true; - } - else - { - cerr << argv[0] << ": unknown option `" << argv[i] << "'" << endl; - usage(argv[0]); - return EXIT_FAILURE; - } - } - string endpts("tcp -p 12345 -t 2000"); Ice::ObjectAdapterPtr adapter = communicator->createObjectAdapterWithEndpoints("TestAdapter", endpts); Ice::ObjectPtr object = new TestI(adapter); adapter->add(object, "test"); adapter->activate(); - if (pid) - { - cout << getpid() << endl; - } communicator->waitForShutdown(); return EXIT_SUCCESS; } diff --git a/cpp/test/IcePack/simple/run.py b/cpp/test/IcePack/simple/run.py index f4276492f29..01973ddd333 100755 --- a/cpp/test/IcePack/simple/run.py +++ b/cpp/test/IcePack/simple/run.py @@ -11,20 +11,20 @@ import os, sys -for toplevel in ["", "..", os.path.join("..", ".."), os.path.join("..", "..", "..")]: - if os.path.exists(os.path.join(toplevel, "config", "TestUtil.py")): +for toplevel in [".", "..", "../..", "../../..", "../../../.."]: + if os.path.exists(os.path.normpath(toplevel + "/config/TestUtil.py")): break else: raise "can't find toplevel directory!" -sys.path.append(os.path.join(toplevel, "config")) +sys.path.append(os.path.normpath(toplevel + "/config")) import TestUtil -icePack = os.path.join(toplevel, "bin", "icepack") -icePackAdmin = os.path.join(toplevel, "bin", "icepackadmin") +icePack = os.path.normpath(toplevel + "/bin/icepack") +icePackAdmin = os.path.normpath(toplevel + "/bin/icepackadmin") print "starting icepack...", -icePackPipe = os.popen(icePack + ' --nowarn --pid' + \ +icePackPipe = os.popen(icePack + ' --Ice.PrintProcessId --nowarn' + \ ' "--Ice.Adapter.Forward.Endpoints=tcp -p 12346 -t 2000"' + \ ' "--Ice.Adapter.Admin.Endpoints=tcp -p 12347 -t 2000"') output = icePackPipe.readline().strip() @@ -41,7 +41,7 @@ icePackAdminPipe = os.popen(icePackAdmin + \ icePackAdminPipe.close() print "ok" -name = os.path.join("IcePack", "simple") +name = "IcePack/simple" TestUtil.clientServerTest(toplevel, name) TestUtil.collocatedTest(toplevel, name) diff --git a/cpp/test/Slice/errorDetection/run.py b/cpp/test/Slice/errorDetection/run.py index 895e5cf397a..713818fa60d 100755 --- a/cpp/test/Slice/errorDetection/run.py +++ b/cpp/test/Slice/errorDetection/run.py @@ -11,14 +11,14 @@ import os, sys, re -for toplevel in ["", "..", os.path.join("..", ".."), os.path.join("..", "..", "..")]: - if os.path.exists(os.path.join(toplevel, "config", "TestUtil.py")): +for toplevel in [".", "..", "../..", "../../..", "../../../.."]: + if os.path.exists(os.path.normpath(toplevel + "/config/TestUtil.py")): break else: raise "can't find toplevel directory!" -directory = os.path.join(toplevel, "test", "Slice", "errorDetection") -slice2cpp = os.path.join(toplevel, "bin", "slice2cpp") +directory = os.path.normpath(toplevel + "/test/Slice/errorDetection") +slice2cpp = os.path.normpath(toplevel + "/bin/slice2cpp") regex1 = re.compile(r".ice$", re.IGNORECASE) files = [] @@ -30,9 +30,9 @@ for file in files: print file + "...", - stdin, stdout, stderr = os.popen3(slice2cpp + " " + os.path.join(directory, file)) + stdin, stdout, stderr = os.popen3(slice2cpp + " " + os.path.normpath(directory + "/" + file)) lines1 = stderr.readlines() - lines2 = open(os.path.join(directory, regex1.sub(".err", file)), "r").readlines() + lines2 = open(os.path.normpath(directory + "/" + regex1.sub(".err", file)), "r").readlines() if len(lines1) != len(lines2): print "failed!" |