diff options
author | Jose <jose@zeroc.com> | 2019-07-18 23:51:08 +0200 |
---|---|---|
committer | Jose <jose@zeroc.com> | 2019-07-18 23:51:08 +0200 |
commit | fc886b010c01cccb8cca3ac4d92f1ebd7fc72295 (patch) | |
tree | 51cf00a4a955efecc9c94527aeafcb25ffbe57b9 /cpp | |
parent | Simplify OutputStream creation (diff) | |
parent | Fixed non-thread safe AMD dispatch, fixes #448 (#449) (diff) | |
download | ice-fc886b010c01cccb8cca3ac4d92f1ebd7fc72295.tar.bz2 ice-fc886b010c01cccb8cca3ac4d92f1ebd7fc72295.tar.xz ice-fc886b010c01cccb8cca3ac4d92f1ebd7fc72295.zip |
Merge remote-tracking branch 'origin/3.7' into swift
Diffstat (limited to 'cpp')
35 files changed, 596 insertions, 267 deletions
diff --git a/cpp/config/Make.rules b/cpp/config/Make.rules index af56ad643cd..8eab4fd7c07 100644 --- a/cpp/config/Make.rules +++ b/cpp/config/Make.rules @@ -98,6 +98,7 @@ endif # directory. # cpp11_cppflags = -DICE_CPP11_MAPPING -std=c++11 +cpp11_ldflags = $(cpp11_cppflags) cpp11_targetname = $(if $(or $(filter-out $($1_target),program),$(filter $(bindir)%,$($4_targetdir))),++11) cpp11_targetdir = $(if $(filter %/build,$5),cpp11) diff --git a/cpp/include/IceUtil/Config.h b/cpp/include/IceUtil/Config.h index 124d0d41080..f12da0ece4a 100644 --- a/cpp/include/IceUtil/Config.h +++ b/cpp/include/IceUtil/Config.h @@ -21,12 +21,14 @@ #endif #if (defined(__BYTE_ORDER) && defined(__LITTLE_ENDIAN) && (__BYTE_ORDER == __LITTLE_ENDIAN)) || \ - (defined(_BYTE_ORDER) && defined(_LITTLE_ENDIAN) && (_BYTE_ORDER == _LITTLE_ENDIAN)) + (defined(_BYTE_ORDER) && defined(_LITTLE_ENDIAN) && (_BYTE_ORDER == _LITTLE_ENDIAN)) || \ + (defined(__BYTE_ORDER__) && defined(__ORDER_LITTLE_ENDIAN__) && (__BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__)) # define ICE_LITTLE_ENDIAN #elif (defined(__BYTE_ORDER) && defined(__BIG_ENDIAN) && (__BYTE_ORDER == __BIG_ENDIAN)) || \ - (defined(_BYTE_ORDER) && defined(_BIG_ENDIAN) && (_BYTE_ORDER == _BIG_ENDIAN)) + (defined(_BYTE_ORDER) && defined(_BIG_ENDIAN) && (_BYTE_ORDER == _BIG_ENDIAN)) || \ + (defined(__BYTE_ORDER__) && defined(__ORDER_BIG_ENDIAN__) && (__BYTE_ORDER__ == __ORDER_BIG_ENDIAN__)) # define ICE_BIG_ENDIAN @@ -171,7 +173,7 @@ // With Visual Studio, we can import/export member functions without importing/ // exporting the whole class # define ICE_MEMBER_IMPORT_EXPORT -#elif defined(__GNUC__) || defined(__clang__) +#elif (defined(__GNUC__) || defined(__clang__)) && !defined(__ibmxl__) # define ICE_DECLSPEC_EXPORT __attribute__((visibility ("default"))) # define ICE_DECLSPEC_IMPORT __attribute__((visibility ("default"))) #elif defined(__SUNPRO_CC) diff --git a/cpp/src/Ice/DispatchInterceptor.cpp b/cpp/src/Ice/DispatchInterceptor.cpp index 10457e990e9..78e79311631 100644 --- a/cpp/src/Ice/DispatchInterceptor.cpp +++ b/cpp/src/Ice/DispatchInterceptor.cpp @@ -21,4 +21,17 @@ Ice::DispatchInterceptor::_iceDispatch(IceInternal::Incoming& in, const Current& { return false; } + catch(const std::exception&) + { + // + // If the input parameters weren't read, make sure we skip them here. It's needed to read the + // encoding version used by the client to eventually marshal the user exception. It's also needed + // if we dispatch a batch oneway request to read the next batch request. + // + if(in.getCurrent().encoding.major == 0 && in.getCurrent().encoding.minor == 0) + { + in.skipReadParams(); + } + throw; + } } diff --git a/cpp/src/Ice/Incoming.cpp b/cpp/src/Ice/Incoming.cpp index 1fce4e5f107..b7cc91488d2 100644 --- a/cpp/src/Ice/Incoming.cpp +++ b/cpp/src/Ice/Incoming.cpp @@ -59,6 +59,8 @@ IceInternal::IncomingBase::IncomingBase(Instance* instance, ResponseHandler* res _current.con = connection; #endif _current.requestId = requestId; + _current.encoding.major = 0; + _current.encoding.minor = 0; } IceInternal::IncomingBase::IncomingBase(IncomingBase& other) : diff --git a/cpp/src/Ice/Object.cpp b/cpp/src/Ice/Object.cpp index effce176db2..78235ce4d62 100644 --- a/cpp/src/Ice/Object.cpp +++ b/cpp/src/Ice/Object.cpp @@ -155,7 +155,14 @@ Ice::Object::_iceD_ice_ids(Incoming& inS, const Current& current) inS.readEmptyParams(); vector<string> ret = ice_ids(current); OutputStream* ostr = inS.startWriteParams(); - ostr->write(&ret[0], &ret[0] + ret.size(), false); + if(ret.empty()) + { + ostr->write(ret); + } + else + { + ostr->write(&ret[0], &ret[0] + ret.size(), false); + } inS.endWriteParams(); return true; } diff --git a/cpp/src/IceGrid/Activator.cpp b/cpp/src/IceGrid/Activator.cpp index a9a4508e910..9a9fb38af2b 100644 --- a/cpp/src/IceGrid/Activator.cpp +++ b/cpp/src/IceGrid/Activator.cpp @@ -641,25 +641,47 @@ Activator::activate(const string& name, } vector<gid_t> groups; +#ifdef _AIX + char* grouplist = getgrset(pw->pw_name); + if(grouplist == 0) + { + throw SyscallException(__FILE__, __LINE__, getSystemErrno()); + } + vector<string> grps; + if(IceUtilInternal::splitString(grouplist, ",", grps)) + { + for(vector<string>::const_iterator p = grps.begin(); p != grps.end(); ++p) + { + gid_t group; + istringstream is(*p); + if(is >> group) + { + groups.push_back(group); + } + } + } + free(grouplist); +#else groups.resize(20); int ngroups = static_cast<int>(groups.size()); -#if defined(__APPLE__) +# if defined(__APPLE__) if(getgrouplist(pw->pw_name, static_cast<int>(gid), reinterpret_cast<int*>(&groups[0]), &ngroups) < 0) -#else +# else if(getgrouplist(pw->pw_name, gid, &groups[0], &ngroups) < 0) -#endif +# endif { groups.resize(static_cast<size_t>(ngroups)); -#if defined(__APPLE__) +# if defined(__APPLE__) getgrouplist(pw->pw_name, static_cast<int>(gid), reinterpret_cast<int*>(&groups[0]), &ngroups); -#else +# else getgrouplist(pw->pw_name, gid, &groups[0], &ngroups); -#endif +# endif } else { groups.resize(static_cast<size_t>(ngroups)); } +#endif if(groups.size() > NGROUPS_MAX) { diff --git a/cpp/src/IceGrid/IceGridNode.cpp b/cpp/src/IceGrid/IceGridNode.cpp index f80cf673236..9a96452a520 100644 --- a/cpp/src/IceGrid/IceGridNode.cpp +++ b/cpp/src/IceGrid/IceGridNode.cpp @@ -32,7 +32,12 @@ using namespace Ice; using namespace IceInternal; using namespace IceGrid; +// Work-around for anonymous namspace bug in xlclang++ +#ifdef __ibmxl__ +namespace IceGridNodeNamespace +#else namespace +#endif { class ProcessI : public Process @@ -110,6 +115,10 @@ setNoIndexingAttribute(const string& path) } +#ifdef __ibmxl__ +using namespace IceGridNodeNamespace; +#endif + CollocatedRegistry::CollocatedRegistry(const CommunicatorPtr& com, const ActivatorPtr& activator, bool nowarn, diff --git a/cpp/src/IceGrid/PlatformInfo.cpp b/cpp/src/IceGrid/PlatformInfo.cpp index 9b265a80eda..5b953d0ebb1 100644 --- a/cpp/src/IceGrid/PlatformInfo.cpp +++ b/cpp/src/IceGrid/PlatformInfo.cpp @@ -192,7 +192,7 @@ PlatformInfo::PlatformInfo(const string& prefix, _last15Total = 0; #elif defined(_AIX) struct nlist nl; - nl.n_name = "avenrun"; + nl.n_name = const_cast<char*>("avenrun"); nl.n_value = 0; if(knlist(&nl, 1, sizeof(nl)) == 0) { @@ -510,7 +510,7 @@ PlatformInfo::getLoadInfo() { long long avenrun[3]; struct nlist nl; - nl.n_name = "avenrun"; + nl.n_name = const_cast<char*>("avenrun"); nl.n_value = 0; if(knlist(&nl, 1, sizeof(nl)) == 0) { diff --git a/cpp/src/IceSSL/OpenSSLTransceiverI.cpp b/cpp/src/IceSSL/OpenSSLTransceiverI.cpp index 8acfe25a67e..d33bb6aaf52 100644 --- a/cpp/src/IceSSL/OpenSSLTransceiverI.cpp +++ b/cpp/src/IceSSL/OpenSSLTransceiverI.cpp @@ -553,6 +553,21 @@ OpenSSL::TransceiverI::read(IceInternal::Buffer& buf) int ret = SSL_read(_ssl, reinterpret_cast<void*>(&*buf.i), packetSize); if(ret <= 0) { +#if defined(_AIX) + // + // WORKAROUND: OpenSSL SSL_read on AIX sometime ends up reporting a error + // with SSL_get_error but there's no error in the error queue. This occurs + // when SSL_read needs more data. So we just return SocketOperationRead in + // this case. + // + if(SSL_get_error(_ssl, ret) == SSL_ERROR_SSL && ERR_peek_error() == 0) + { + if(SSL_want_read(_ssl)) + { + return IceInternal::SocketOperationRead; + } + } +#endif switch(SSL_get_error(_ssl, ret)) { case SSL_ERROR_NONE: diff --git a/cpp/src/IceStorm/Subscriber.cpp b/cpp/src/IceStorm/Subscriber.cpp index 0fb46848c3d..9df599eec3c 100644 --- a/cpp/src/IceStorm/Subscriber.cpp +++ b/cpp/src/IceStorm/Subscriber.cpp @@ -196,12 +196,16 @@ SubscriberBatch::SubscriberBatch( _obj(obj), _interval(instance->flushInterval()) { - assert(retryCount == 0); } void SubscriberBatch::flush() { + if(_state != SubscriberStateOnline || _events.empty()) + { + return; + } + if(_outstanding == 0) { ++_outstanding; @@ -309,7 +313,6 @@ SubscriberOneway::SubscriberOneway( Subscriber(instance, rec, proxy, retryCount, 5), _obj(obj) { - assert(retryCount == 0); } void @@ -605,18 +608,10 @@ Subscriber::create( } else if(newObj->ice_isOneway() || newObj->ice_isDatagram()) { - if(retryCount > 0) - { - throw BadQoS("non-zero retryCount QoS requires a twoway proxy"); - } subscriber = new SubscriberOneway(instance, rec, proxy, retryCount, newObj); } else if(newObj->ice_isBatchOneway() || newObj->ice_isBatchDatagram()) { - if(retryCount > 0) - { - throw BadQoS("non-zero retryCount QoS requires a twoway proxy"); - } subscriber = new SubscriberBatch(instance, rec, proxy, retryCount, newObj); } else //if(newObj->ice_isTwoway()) diff --git a/cpp/src/IceUtil/UtilException.cpp b/cpp/src/IceUtil/UtilException.cpp index f42b86f89a6..266942bb3de 100644 --- a/cpp/src/IceUtil/UtilException.cpp +++ b/cpp/src/IceUtil/UtilException.cpp @@ -43,7 +43,7 @@ # endif # endif -# if !defined(__sun) && !defined(__FreeBSD__) && !defined(__MINGW32__) && !defined(ICE_STATIC_LIBS) +# if !defined(_AIX) && !defined(__sun) && !defined(__FreeBSD__) && !defined(__MINGW32__) && !defined(ICE_STATIC_LIBS) # include <execinfo.h> # include <cxxabi.h> # include <stdint.h> diff --git a/cpp/src/IceXML/msbuild/icexml.vcxproj b/cpp/src/IceXML/msbuild/icexml.vcxproj index 0b04894330c..899c917c403 100644 --- a/cpp/src/IceXML/msbuild/icexml.vcxproj +++ b/cpp/src/IceXML/msbuild/icexml.vcxproj @@ -96,19 +96,19 @@ </ItemGroup> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> <ImportGroup Label="ExtensionTargets"> - <Import Project="..\..\..\msbuild\packages\expat.v120.2.2.6\build\native\expat.v120.targets" Condition="Exists('..\..\..\msbuild\packages\expat.v120.2.2.6\build\native\expat.v120.targets')" /> - <Import Project="..\..\..\msbuild\packages\expat.v140.2.2.6\build\native\expat.v140.targets" Condition="Exists('..\..\..\msbuild\packages\expat.v140.2.2.6\build\native\expat.v140.targets')" /> - <Import Project="..\..\..\msbuild\packages\expat.v141.2.2.6\build\native\expat.v141.targets" Condition="Exists('..\..\..\msbuild\packages\expat.v141.2.2.6\build\native\expat.v141.targets')" /> - <Import Project="..\..\..\msbuild\packages\expat.v142.2.2.6\build\native\expat.v142.targets" Condition="Exists('..\..\..\msbuild\packages\expat.v142.2.2.6\build\native\expat.v142.targets')" /> + <Import Project="..\..\..\msbuild\packages\expat.v120.2.2.7\build\native\expat.v120.targets" Condition="Exists('..\..\..\msbuild\packages\expat.v120.2.2.7\build\native\expat.v120.targets')" /> + <Import Project="..\..\..\msbuild\packages\expat.v140.2.2.7\build\native\expat.v140.targets" Condition="Exists('..\..\..\msbuild\packages\expat.v140.2.2.7\build\native\expat.v140.targets')" /> + <Import Project="..\..\..\msbuild\packages\expat.v141.2.2.7\build\native\expat.v141.targets" Condition="Exists('..\..\..\msbuild\packages\expat.v141.2.2.7\build\native\expat.v141.targets')" /> + <Import Project="..\..\..\msbuild\packages\expat.v142.2.2.7\build\native\expat.v142.targets" Condition="Exists('..\..\..\msbuild\packages\expat.v142.2.2.7\build\native\expat.v142.targets')" /> </ImportGroup> <Import Project="$(MSBuildThisFileDirectory)..\..\..\msbuild\ice.sign.targets" /> <Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild"> <PropertyGroup> <ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText> </PropertyGroup> - <Error Condition="!Exists('..\..\..\msbuild\packages\expat.v120.2.2.6\build\native\expat.v120.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\msbuild\packages\expat.v120.2.2.6\build\native\expat.v120.targets'))" /> - <Error Condition="!Exists('..\..\..\msbuild\packages\expat.v140.2.2.6\build\native\expat.v140.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\msbuild\packages\expat.v140.2.2.6\build\native\expat.v140.targets'))" /> - <Error Condition="!Exists('..\..\..\msbuild\packages\expat.v141.2.2.6\build\native\expat.v141.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\msbuild\packages\expat.v141.2.2.6\build\native\expat.v141.targets'))" /> - <Error Condition="!Exists('..\..\..\msbuild\packages\expat.v142.2.2.6\build\native\expat.v142.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\msbuild\packages\expat.v142.2.2.6\build\native\expat.v142.targets'))" /> + <Error Condition="!Exists('..\..\..\msbuild\packages\expat.v120.2.2.7\build\native\expat.v120.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\msbuild\packages\expat.v120.2.2.7\build\native\expat.v120.targets'))" /> + <Error Condition="!Exists('..\..\..\msbuild\packages\expat.v140.2.2.7\build\native\expat.v140.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\msbuild\packages\expat.v140.2.2.7\build\native\expat.v140.targets'))" /> + <Error Condition="!Exists('..\..\..\msbuild\packages\expat.v141.2.2.7\build\native\expat.v141.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\msbuild\packages\expat.v141.2.2.7\build\native\expat.v141.targets'))" /> + <Error Condition="!Exists('..\..\..\msbuild\packages\expat.v142.2.2.7\build\native\expat.v142.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\msbuild\packages\expat.v142.2.2.7\build\native\expat.v142.targets'))" /> </Target> </Project>
\ No newline at end of file diff --git a/cpp/src/IceXML/msbuild/packages.config b/cpp/src/IceXML/msbuild/packages.config index 2243cad2c74..1b1bbf027c3 100644 --- a/cpp/src/IceXML/msbuild/packages.config +++ b/cpp/src/IceXML/msbuild/packages.config @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="utf-8"?> <packages> - <package id="expat.v120" version="2.2.6" targetFramework="native" /> - <package id="expat.v140" version="2.2.6" targetFramework="native" /> - <package id="expat.v141" version="2.2.6" targetFramework="native" /> - <package id="expat.v142" version="2.2.6" targetFramework="native" /> + <package id="expat.v120" version="2.2.7" targetFramework="native" /> + <package id="expat.v140" version="2.2.7" targetFramework="native" /> + <package id="expat.v141" version="2.2.7" targetFramework="native" /> + <package id="expat.v142" version="2.2.7" targetFramework="native" /> </packages>
\ No newline at end of file diff --git a/cpp/src/slice2cs/Gen.cpp b/cpp/src/slice2cs/Gen.cpp index 221b3121fc7..dcb2e3c5006 100644 --- a/cpp/src/slice2cs/Gen.cpp +++ b/cpp/src/slice2cs/Gen.cpp @@ -3386,6 +3386,7 @@ Slice::Gen::TypesVisitor::visitDataMember(const DataMemberPtr& p) bool isProperty = false; bool isValue = false; bool isProtected = false; + bool isPrivate = false; const bool isOptional = p->optional(); ContainedPtr cont = ContainedPtr::dynamicCast(p->container()); assert(cont); @@ -3398,7 +3399,7 @@ Slice::Gen::TypesVisitor::visitDataMember(const DataMemberPtr& p) if(st) { isLocal = st->isLocal(); - isValue = isValueType(StructPtr::dynamicCast(cont)); + isValue = isValueType(st); if(!isValue) { baseTypes = DotNet::ICloneable; @@ -3407,6 +3408,22 @@ Slice::Gen::TypesVisitor::visitDataMember(const DataMemberPtr& p) { isProperty = true; } + // + // C# structs are implicit sealed and cannot use `protected' modifier, + // we must use either public or private. For Slice structs using the + // class mapping we can still use protected modifier. + // + if(cont->hasMetaData("protected") || p->hasMetaData("protected")) + { + if(isValue) + { + isPrivate = true; + } + else + { + isProtected = true; + } + } } else if(ex) { @@ -3433,6 +3450,7 @@ Slice::Gen::TypesVisitor::visitDataMember(const DataMemberPtr& p) string type = typeToString(p->type(), ns, isOptional, isLocal, p->getMetaData()); string propertyName = fixId(p->name(), baseTypes, isClass); string dataMemberName; + if(isProperty) { dataMemberName = "_" + p->name(); @@ -3446,17 +3464,22 @@ Slice::Gen::TypesVisitor::visitDataMember(const DataMemberPtr& p) { _out << nl << "private"; } - else if(isProtected) - { - emitAttributes(p); - emitGeneratedCodeAttribute(); - _out << nl << "protected"; - } else { emitAttributes(p); emitGeneratedCodeAttribute(); - _out << nl << "public"; + if(isPrivate) + { + _out << nl << "private"; + } + else if(isProtected) + { + _out << nl << "protected"; + } + else + { + _out << nl << "public"; + } } if(isOptional && isValue) @@ -3472,7 +3495,19 @@ Slice::Gen::TypesVisitor::visitDataMember(const DataMemberPtr& p) { emitAttributes(p); emitGeneratedCodeAttribute(); - _out << nl << (isProtected ? "protected" : "public"); + if(isPrivate) + { + _out << nl << "private"; + } + else if(isProtected) + { + _out << nl << "protected"; + } + else + { + _out << nl << "public"; + } + if(!isValue) { _out << " virtual"; diff --git a/cpp/test/Ice/acm/AllTests.cpp b/cpp/test/Ice/acm/AllTests.cpp index f9ca74170f4..d9e81d9370d 100644 --- a/cpp/test/Ice/acm/AllTests.cpp +++ b/cpp/test/Ice/acm/AllTests.cpp @@ -166,7 +166,7 @@ public: } #ifdef ICE_CPP11_MAPPING - void join(thread& t) + void join(std::thread& t) #else void join() #endif @@ -735,11 +735,11 @@ allTests(Test::TestHelper* helper) } #ifdef ICE_CPP11_MAPPING - vector<pair<thread, TestCasePtr>> threads; + vector<pair<std::thread, TestCasePtr>> threads; for(auto p = tests.begin(); p != tests.end(); ++p) { TestCasePtr testCase = *p; - thread t([testCase]() + std::thread t([testCase]() { testCase->run(); }); diff --git a/cpp/test/Ice/impl/Makefile.mk b/cpp/test/Ice/impl/Makefile.mk index e0b294005f9..d3843d4906d 100644 --- a/cpp/test/Ice/impl/Makefile.mk +++ b/cpp/test/Ice/impl/Makefile.mk @@ -36,4 +36,8 @@ endef $(test)_component_with_config_extensions = make-impl-with-config +ifeq ($(xlc_compiler),yes) + $(test)_cppflags += -qsuppress="1540-0895" +endif + tests += $(test) diff --git a/cpp/test/Ice/interceptor/AMDInterceptorI.cpp b/cpp/test/Ice/interceptor/AMDInterceptorI.cpp index 33cfb5e0b38..158cf2736fa 100644 --- a/cpp/test/Ice/interceptor/AMDInterceptorI.cpp +++ b/cpp/test/Ice/interceptor/AMDInterceptorI.cpp @@ -4,7 +4,7 @@ #include <IceUtil/DisableWarnings.h> #include <AMDInterceptorI.h> -#include <Test.h> +#include <MyObjectI.h> #include <TestHelper.h> using namespace std; @@ -56,6 +56,24 @@ AMDInterceptorI::dispatch(Ice::Request& request) #endif Ice::Current& current = const_cast<Ice::Current&>(request.getCurrent()); + + Ice::Context::const_iterator p = current.ctx.find("raiseBeforeDispatch"); + if(p != current.ctx.end()) + { + if(p->second == "user") + { + throw Test::InvalidInputException(); + } + else if(p->second == "notExist") + { + throw Ice::ObjectNotExistException(__FILE__, __LINE__); + } + else if(p->second == "system") + { + throw MySystemException(__FILE__, __LINE__); + } + } + _lastOperation = current.operation; if(_lastOperation == "amdAddWithRetry") @@ -85,6 +103,15 @@ AMDInterceptorI::dispatch(Ice::Request& request) current.ctx["retry"] = "no"; } + else if(current.ctx.find("retry") != current.ctx.end() && current.ctx["retry"] == "yes") + { + // + // Retry the dispatch to ensure that abandoning the result of the dispatch + // works fine and is thread-safe + // + _servant->ice_dispatch(request); + _servant->ice_dispatch(request); + } #ifdef ICE_CPP11_MAPPING _lastStatus = _servant->ice_dispatch(request, []() { return true; }, [this](exception_ptr ex) { @@ -105,6 +132,24 @@ AMDInterceptorI::dispatch(Ice::Request& request) #else _lastStatus = _servant->ice_dispatch(request, _defaultCb); #endif + + p = current.ctx.find("raiseAfterDispatch"); + if(p != current.ctx.end()) + { + if(p->second == "user") + { + throw Test::InvalidInputException(); + } + else if(p->second == "notExist") + { + throw Ice::ObjectNotExistException(__FILE__, __LINE__); + } + else if(p->second == "system") + { + throw MySystemException(__FILE__, __LINE__); + } + } + return _lastStatus; } diff --git a/cpp/test/Ice/interceptor/Client.cpp b/cpp/test/Ice/interceptor/Client.cpp index fd7c8314d26..02317c19d2c 100644 --- a/cpp/test/Ice/interceptor/Client.cpp +++ b/cpp/test/Ice/interceptor/Client.cpp @@ -35,6 +35,7 @@ private: void runTest(const Test::MyObjectPrxPtr&, const InterceptorIPtr&); void runAmdTest(const Test::MyObjectPrxPtr&, const AMDInterceptorIPtr&); + void testInterceptorExceptions(const Test::MyObjectPrxPtr&); }; void @@ -169,6 +170,10 @@ Client::runTest(const Test::MyObjectPrxPtr& prx, const InterceptorIPtr& intercep test(interceptor->getLastOperation() == "amdAdd"); test(!interceptor->getLastStatus()); cout << "ok" << endl; + + cout << "testing exceptions raised by the interceptor... " << flush; + testInterceptorExceptions(prx); + cout << "ok" << endl; } void @@ -184,6 +189,16 @@ Client::runAmdTest(const Test::MyObjectPrxPtr& prx, const AMDInterceptorIPtr& in test(prx->amdAddWithRetry(33, 12) == 45); test(interceptor->getLastOperation() == "amdAddWithRetry"); test(!interceptor->getLastStatus()); + { + Ice::Context ctx; + ctx["retry"] = "yes"; + for(int i = 0; i < 10; ++i) + { + test(prx->amdAdd(33, 12, ctx) == 45); + test(interceptor->getLastOperation() == "amdAdd"); + test(!interceptor->getLastStatus()); + } + } cout << "ok" << endl; cout << "testing user exception... " << flush; try @@ -234,6 +249,59 @@ Client::runAmdTest(const Test::MyObjectPrxPtr& prx, const AMDInterceptorIPtr& in test(!interceptor->getLastStatus()); test(dynamic_cast<MySystemException*>(interceptor->getException()) != 0); cout << "ok" << endl; + + cout << "testing exceptions raised by the interceptor... " << flush; + testInterceptorExceptions(prx); + cout << "ok" << endl; +} + +void +Client::testInterceptorExceptions(const Test::MyObjectPrxPtr& prx) +{ + vector<pair<string, string> > exceptions; + exceptions.push_back(make_pair("raiseBeforeDispatch", "user")); + exceptions.push_back(make_pair("raiseBeforeDispatch", "notExist")); + exceptions.push_back(make_pair("raiseBeforeDispatch", "system")); + exceptions.push_back(make_pair("raiseAfterDispatch", "user")); + exceptions.push_back(make_pair("raiseAfterDispatch", "notExist")); + exceptions.push_back(make_pair("raiseAfterDispatch", "system")); + for(vector<pair<string, string> >::const_iterator p = exceptions.begin(); p != exceptions.end(); ++p) + { + Ice::Context ctx; + ctx[p->first] = p->second; + try + { + prx->ice_ping(ctx); + test(false); + } + catch(const Ice::UnknownUserException&) + { + test(p->second == "user"); + } + catch(const Ice::ObjectNotExistException&) + { + test(p->second == "notExist"); + } + catch(const Ice::UnknownException&) + { + test(p->second == "system"); // non-collocated + } + catch(const MySystemException&) + { + test(p->second == "system"); // collocated + } + { + Ice::ObjectPrxPtr batch = prx->ice_batchOneway(); + batch->ice_ping(ctx); + batch->ice_ping(); + batch->ice_flushBatchRequests(); + + // Force the last batch request to be dispatched by the server thread using invocation timeouts + // This is required to preven threading issue with the test interceptor implementation which + // isn't thread safe + prx->ice_invocationTimeout(10000)->ice_ping(); + } + } } DEFINE_TEST(Client) diff --git a/cpp/test/Ice/interceptor/InterceptorI.cpp b/cpp/test/Ice/interceptor/InterceptorI.cpp index 04b60f7a8f6..171aaf0c25a 100644 --- a/cpp/test/Ice/interceptor/InterceptorI.cpp +++ b/cpp/test/Ice/interceptor/InterceptorI.cpp @@ -3,7 +3,7 @@ // #include <InterceptorI.h> -#include <Test.h> +#include <MyObjectI.h> #include <TestHelper.h> using namespace std; @@ -18,6 +18,24 @@ bool InterceptorI::dispatch(Ice::Request& request) { Ice::Current& current = const_cast<Ice::Current&>(request.getCurrent()); + + Ice::Context::const_iterator p = current.ctx.find("raiseBeforeDispatch"); + if(p != current.ctx.end()) + { + if(p->second == "user") + { + throw Test::InvalidInputException(); + } + else if(p->second == "notExist") + { + throw Ice::ObjectNotExistException(__FILE__, __LINE__); + } + else if(p->second == "system") + { + throw MySystemException(__FILE__, __LINE__); + } + } + _lastOperation = current.operation; if(_lastOperation == "addWithRetry") @@ -39,7 +57,26 @@ InterceptorI::dispatch(Ice::Request& request) current.ctx["retry"] = "no"; } + _lastStatus = _servant->ice_dispatch(request); + + p = current.ctx.find("raiseAfterDispatch"); + if(p != current.ctx.end()) + { + if(p->second == "user") + { + throw Test::InvalidInputException(); + } + else if(p->second == "notExist") + { + throw Ice::ObjectNotExistException(__FILE__, __LINE__); + } + else if(p->second == "system") + { + throw MySystemException(__FILE__, __LINE__); + } + } + return _lastStatus; } diff --git a/cpp/test/Ice/interceptor/MyObjectI.cpp b/cpp/test/Ice/interceptor/MyObjectI.cpp index b21c01c7a9b..f3164ac4426 100644 --- a/cpp/test/Ice/interceptor/MyObjectI.cpp +++ b/cpp/test/Ice/interceptor/MyObjectI.cpp @@ -83,13 +83,22 @@ MyObjectI::amdAddAsync(int x, int y, function<void(int)> response, function<void(exception_ptr)>, - const Ice::Current&) + const Ice::Current& current) { - thread t( - [x, y, response]() + Ice::Context::const_iterator p = current.ctx.find("retry"); + bool retry = p != current.ctx.end(); + std::thread t( + [x, y, response, retry]() { this_thread::sleep_for(chrono::milliseconds(10)); - response(x + y); + try + { + response(x + y); + } + catch(const Ice::ResponseSentException&) + { + test(retry); + } }); t.detach(); } @@ -101,7 +110,7 @@ MyObjectI::amdAddWithRetryAsync(int x, function<void(exception_ptr)> error, const Ice::Current& current) { - thread t( + std::thread t( [x, y, response]() { try @@ -137,7 +146,7 @@ MyObjectI::amdBadAddAsync(int, function<void(exception_ptr)> error, const Ice::Current&) { - thread t( + std::thread t( [error]() { this_thread::sleep_for(chrono::milliseconds(10)); @@ -160,7 +169,7 @@ MyObjectI::amdNotExistAddAsync(int, function<void(exception_ptr)> error, const Ice::Current&) { - thread t( + std::thread t( [error]() { this_thread::sleep_for(chrono::milliseconds(10)); @@ -183,7 +192,7 @@ MyObjectI::amdBadSystemAddAsync(int, function<void(exception_ptr)> error, const Ice::Current&) { - thread t( + std::thread t( [error]() { this_thread::sleep_for(chrono::milliseconds(10)); @@ -200,31 +209,42 @@ MyObjectI::amdBadSystemAddAsync(int, } #else void -MyObjectI::amdAdd_async(const Test::AMD_MyObject_amdAddPtr& cb, int x, int y, const Ice::Current&) +MyObjectI::amdAdd_async(const Test::AMD_MyObject_amdAddPtr& cb, int x, int y, const Ice::Current& current) { class ThreadI : public Thread { public: - ThreadI(const Test::AMD_MyObject_amdAddPtr& cb, int x, int y) : + ThreadI(const Test::AMD_MyObject_amdAddPtr& cb, int x, int y, bool retry) : _cb(cb), _x(x), - _y(y) + _y(y), + _retry(retry) { } void run() { ThreadControl::sleep(Time::milliSeconds(10)); - _cb->ice_response(_x + _y); + try + { + _cb->ice_response(_x + _y); + } + catch(const Ice::ResponseSentException&) + { + test(_retry); + } } private: Test::AMD_MyObject_amdAddPtr _cb; int _x; int _y; + bool _retry; }; - ThreadPtr thread = new ThreadI(cb, x, y); + Ice::Context::const_iterator p = current.ctx.find("retry"); + bool retry = p != current.ctx.end(); + ThreadPtr thread = new ThreadI(cb, x, y, retry); thread->start().detach(); } diff --git a/cpp/test/Ice/metrics/AllTests.cpp b/cpp/test/Ice/metrics/AllTests.cpp index 3e3e40cf19e..1beef435bb5 100644 --- a/cpp/test/Ice/metrics/AllTests.cpp +++ b/cpp/test/Ice/metrics/AllTests.cpp @@ -965,7 +965,7 @@ allTests(Test::TestHelper* helper, const CommunicatorObserverIPtr& obsv) cout << "testing invocation metrics... " << flush; props["IceMX.Metrics.View.Map.Invocation.GroupBy"] = "operation"; - props["IceMX.Metrics.View.Map.Invocation.Map.Remote.GroupBy"] = "localPort"; + props["IceMX.Metrics.View.Map.Invocation.Map.Remote.GroupBy"] = "id"; props["IceMX.Metrics.View.Map.Invocation.Map.Collocated.GroupBy"] = "parent"; updateProps(clientProps, serverProps, update.get(), props, "Invocation"); test(serverMetrics->getMetricsView("View", timestamp)["Invocation"].empty()); @@ -1323,13 +1323,9 @@ allTests(Test::TestHelper* helper, const CommunicatorObserverIPtr& obsv) if(!collocated) { im1 = ICE_DYNAMIC_CAST(IceMX::InvocationMetrics, map["fail"]); - test(im1->current <= 1 && im1->total == 3 && im1->failures == 3 && im1->retry == 3 && im1->remotes.size() == 6); - test(im1->remotes[0]->current == 0 && im1->remotes[0]->total == 1 && im1->remotes[0]->failures == 1); - test(im1->remotes[1]->current == 0 && im1->remotes[1]->total == 1 && im1->remotes[1]->failures == 1); - test(im1->remotes[2]->current == 0 && im1->remotes[2]->total == 1 && im1->remotes[2]->failures == 1); - test(im1->remotes[3]->current == 0 && im1->remotes[3]->total == 1 && im1->remotes[3]->failures == 1); - test(im1->remotes[4]->current == 0 && im1->remotes[4]->total == 1 && im1->remotes[4]->failures == 1); - test(im1->remotes[5]->current == 0 && im1->remotes[5]->total == 1 && im1->remotes[5]->failures == 1); + test(im1->current <= 1 && im1->total == 3 && im1->failures == 3 && im1->retry == 3 && im1->remotes.size() == 1); + rim1 = ICE_DYNAMIC_CAST(IceMX::ChildInvocationMetrics, im1->remotes[0]); + test(rim1->current == 0 && rim1->total == 6 && rim1->failures == 6); checkFailure(clientMetrics, "Invocation", im1->id, "::Ice::ConnectionLostException", 3); } diff --git a/cpp/test/Ice/operations/BatchOnewaysAMI.cpp b/cpp/test/Ice/operations/BatchOnewaysAMI.cpp index 9684545a6ac..59de2c74fc3 100644 --- a/cpp/test/Ice/operations/BatchOnewaysAMI.cpp +++ b/cpp/test/Ice/operations/BatchOnewaysAMI.cpp @@ -8,7 +8,12 @@ using namespace std; +// Work-around for anonymous namspace bug in xlclang++ +#ifdef __ibmxl__ +namespace BatchOnewaysAMINamespace +#else namespace +#endif { class Callback : public IceUtil::Monitor<IceUtil::Mutex>, public IceUtil::Shared @@ -85,6 +90,10 @@ public: }; } +#ifdef __ibmxl__ +using namespace BatchOnewaysAMINamespace; +#endif + void batchOnewaysAMI(const Test::MyClassPrxPtr& p) { diff --git a/cpp/test/Ice/operations/OnewaysAMI.cpp b/cpp/test/Ice/operations/OnewaysAMI.cpp index bd3fc9241f7..2b73c141ee4 100644 --- a/cpp/test/Ice/operations/OnewaysAMI.cpp +++ b/cpp/test/Ice/operations/OnewaysAMI.cpp @@ -8,7 +8,12 @@ using namespace std; +// Work-around for anonymous namspace bug in xlclang++ +#ifdef __ibmxl__ +namespace OnewaysAMINamespace +#else namespace +#endif { class CallbackBase @@ -75,6 +80,10 @@ ICE_DEFINE_PTR(CallbackPtr, Callback); } +#ifdef __ibmxl__ +using namespace OnewaysAMINamespace; +#endif + void onewaysAMI(const Ice::CommunicatorPtr&, const Test::MyClassPrxPtr& proxy) { diff --git a/cpp/test/Ice/operations/TwowaysAMI.cpp b/cpp/test/Ice/operations/TwowaysAMI.cpp index e71852c300a..985a49034f5 100644 --- a/cpp/test/Ice/operations/TwowaysAMI.cpp +++ b/cpp/test/Ice/operations/TwowaysAMI.cpp @@ -22,7 +22,7 @@ #endif using namespace std; -using namespace Test; + namespace { @@ -157,8 +157,8 @@ public: void opMyEnum(Test::MyEnum r, Test::MyEnum e) { - test(e == ICE_ENUM(Test::MyEnum, enum2)); - test(r == ICE_ENUM(Test::MyEnum, enum3)); + test(e == Test::ICE_ENUM(MyEnum, enum2)); + test(r == Test::ICE_ENUM(MyEnum, enum3)); called(); } @@ -190,9 +190,9 @@ public: void opStruct(const Test::Structure& rso, const Test::Structure& so) { test(rso.p == 0); - test(rso.e == ICE_ENUM(Test::MyEnum, enum2)); + test(rso.e == Test::ICE_ENUM(MyEnum, enum2)); test(rso.s.s == "def"); - test(so.e == ICE_ENUM(Test::MyEnum, enum3)); + test(so.e == Test::ICE_ENUM(MyEnum, enum3)); test(so.s.s == "a new string"); // @@ -497,18 +497,18 @@ public: void opStringMyEnumD(const Test::StringMyEnumD& ro, const Test::StringMyEnumD& _do) { Test::StringMyEnumD di1; - di1["abc"] = ICE_ENUM(Test::MyEnum, enum1); - di1[""] = ICE_ENUM(Test::MyEnum, enum2); + di1["abc"] = Test::ICE_ENUM(MyEnum, enum1); + di1[""] = Test::ICE_ENUM(MyEnum, enum2); test(_do == di1); test(ro.size() == 4); test(ro.find("abc") != ro.end()); - test(ro.find("abc")->second == ICE_ENUM(Test::MyEnum, enum1)); + test(ro.find("abc")->second == Test::ICE_ENUM(MyEnum, enum1)); test(ro.find("qwerty") != ro.end()); - test(ro.find("qwerty")->second == ICE_ENUM(Test::MyEnum, enum3)); + test(ro.find("qwerty")->second == Test::ICE_ENUM(MyEnum, enum3)); test(ro.find("") != ro.end()); - test(ro.find("")->second == ICE_ENUM(Test::MyEnum, enum2)); + test(ro.find("")->second == Test::ICE_ENUM(MyEnum, enum2)); test(ro.find("Hello!!") != ro.end()); - test(ro.find("Hello!!")->second == ICE_ENUM(Test::MyEnum, enum2)); + test(ro.find("Hello!!")->second == Test::ICE_ENUM(MyEnum, enum2)); called(); } @@ -517,20 +517,20 @@ public: Test::MyStruct ms11 = { 1, 1 }; Test::MyStruct ms12 = { 1, 2 }; Test::MyStructMyEnumD di1; - di1[ms11] = ICE_ENUM(Test::MyEnum, enum1); - di1[ms12] = ICE_ENUM(Test::MyEnum, enum2); + di1[ms11] = Test::ICE_ENUM(MyEnum, enum1); + di1[ms12] = Test::ICE_ENUM(MyEnum, enum2); test(_do == di1); Test::MyStruct ms22 = { 2, 2 }; Test::MyStruct ms23 = { 2, 3 }; test(ro.size() == 4); test(ro.find(ms11) != ro.end()); - test(ro.find(ms11)->second == ICE_ENUM(Test::MyEnum, enum1)); + test(ro.find(ms11)->second == Test::ICE_ENUM(MyEnum, enum1)); test(ro.find(ms12) != ro.end()); - test(ro.find(ms12)->second == ICE_ENUM(Test::MyEnum, enum2)); + test(ro.find(ms12)->second == Test::ICE_ENUM(MyEnum, enum2)); test(ro.find(ms22) != ro.end()); - test(ro.find(ms22)->second == ICE_ENUM(Test::MyEnum, enum3)); + test(ro.find(ms22)->second == Test::ICE_ENUM(MyEnum, enum3)); test(ro.find(ms23) != ro.end()); - test(ro.find(ms23)->second == ICE_ENUM(Test::MyEnum, enum2)); + test(ro.find(ms23)->second == Test::ICE_ENUM(MyEnum, enum2)); called(); } @@ -675,32 +675,32 @@ public: test(ro.size() == 2); test(ro[0].size() == 3); test(ro[0].find("abc") != ro[0].end()); - test(ro[0].find("abc")->second == ICE_ENUM(Test::MyEnum, enum1)); + test(ro[0].find("abc")->second == Test::ICE_ENUM(MyEnum, enum1)); test(ro[0].find("qwerty") != ro[0].end()); - test(ro[0].find("qwerty")->second == ICE_ENUM(Test::MyEnum, enum3)); + test(ro[0].find("qwerty")->second == Test::ICE_ENUM(MyEnum, enum3)); test(ro[0].find("Hello!!") != ro[0].end()); - test(ro[0].find("Hello!!")->second == ICE_ENUM(Test::MyEnum, enum2)); + test(ro[0].find("Hello!!")->second == Test::ICE_ENUM(MyEnum, enum2)); test(ro[1].size() == 2); test(ro[1].find("abc") != ro[1].end()); - test(ro[1].find("abc")->second == ICE_ENUM(Test::MyEnum, enum1)); + test(ro[1].find("abc")->second == Test::ICE_ENUM(MyEnum, enum1)); test(ro[1].find("") != ro[1].end()); - test(ro[1].find("")->second == ICE_ENUM(Test::MyEnum, enum2)); + test(ro[1].find("")->second == Test::ICE_ENUM(MyEnum, enum2)); test(_do.size() == 3); test(_do[0].size() == 1); test(_do[0].find("Goodbye") != _do[0].end()); - test(_do[0].find("Goodbye")->second == ICE_ENUM(Test::MyEnum, enum1)); + test(_do[0].find("Goodbye")->second == Test::ICE_ENUM(MyEnum, enum1)); test(_do[1].size() == 2); test(_do[1].find("abc") != _do[1].end()); - test(_do[1].find("abc")->second == ICE_ENUM(Test::MyEnum, enum1)); + test(_do[1].find("abc")->second == Test::ICE_ENUM(MyEnum, enum1)); test(_do[1].find("") != _do[1].end()); - test(_do[1].find("")->second == ICE_ENUM(Test::MyEnum, enum2)); + test(_do[1].find("")->second == Test::ICE_ENUM(MyEnum, enum2)); test(_do[2].size() == 3); test(_do[2].find("abc") != _do[2].end()); - test(_do[2].find("abc")->second == ICE_ENUM(Test::MyEnum, enum1)); + test(_do[2].find("abc")->second == Test::ICE_ENUM(MyEnum, enum1)); test(_do[2].find("qwerty") != _do[2].end()); - test(_do[2].find("qwerty")->second == ICE_ENUM(Test::MyEnum, enum3)); + test(_do[2].find("qwerty")->second == Test::ICE_ENUM(MyEnum, enum3)); test(_do[2].find("Hello!!") != _do[2].end()); - test(_do[2].find("Hello!!")->second == ICE_ENUM(Test::MyEnum, enum2)); + test(_do[2].find("Hello!!")->second == Test::ICE_ENUM(MyEnum, enum2)); called(); } @@ -708,25 +708,25 @@ public: { test(ro.size() == 2); test(ro[0].size() == 2); - test(ro[0].find(ICE_ENUM(Test::MyEnum, enum2)) != ro[0].end()); - test(ro[0].find(ICE_ENUM(Test::MyEnum, enum2))->second == "Hello!!"); - test(ro[0].find(ICE_ENUM(Test::MyEnum, enum3)) != ro[0].end()); - test(ro[0].find(ICE_ENUM(Test::MyEnum, enum3))->second == "qwerty"); + test(ro[0].find(Test::ICE_ENUM(MyEnum, enum2)) != ro[0].end()); + test(ro[0].find(Test::ICE_ENUM(MyEnum, enum2))->second == "Hello!!"); + test(ro[0].find(Test::ICE_ENUM(MyEnum, enum3)) != ro[0].end()); + test(ro[0].find(Test::ICE_ENUM(MyEnum, enum3))->second == "qwerty"); test(ro[1].size() == 1); - test(ro[1].find(ICE_ENUM(Test::MyEnum, enum1)) != ro[1].end()); - test(ro[1].find(ICE_ENUM(Test::MyEnum, enum1))->second == "abc"); + test(ro[1].find(Test::ICE_ENUM(MyEnum, enum1)) != ro[1].end()); + test(ro[1].find(Test::ICE_ENUM(MyEnum, enum1))->second == "abc"); test(_do.size() == 3); test(_do[0].size() == 1); - test(_do[0].find(ICE_ENUM(Test::MyEnum, enum1)) != _do[0].end()); - test(_do[0].find(ICE_ENUM(Test::MyEnum, enum1))->second == "Goodbye"); + test(_do[0].find(Test::ICE_ENUM(MyEnum, enum1)) != _do[0].end()); + test(_do[0].find(Test::ICE_ENUM(MyEnum, enum1))->second == "Goodbye"); test(_do[1].size() == 1); - test(_do[1].find(ICE_ENUM(Test::MyEnum, enum1)) != _do[1].end()); - test(_do[1].find(ICE_ENUM(Test::MyEnum, enum1))->second == "abc"); + test(_do[1].find(Test::ICE_ENUM(MyEnum, enum1)) != _do[1].end()); + test(_do[1].find(Test::ICE_ENUM(MyEnum, enum1))->second == "abc"); test(_do[2].size() == 2); - test(_do[2].find(ICE_ENUM(Test::MyEnum, enum2)) != _do[2].end()); - test(_do[2].find(ICE_ENUM(Test::MyEnum, enum2))->second == "Hello!!"); - test(_do[2].find(ICE_ENUM(Test::MyEnum, enum3)) != _do[2].end()); - test(_do[2].find(ICE_ENUM(Test::MyEnum, enum3))->second == "qwerty"); + test(_do[2].find(Test::ICE_ENUM(MyEnum, enum2)) != _do[2].end()); + test(_do[2].find(Test::ICE_ENUM(MyEnum, enum2))->second == "Hello!!"); + test(_do[2].find(Test::ICE_ENUM(MyEnum, enum3)) != _do[2].end()); + test(_do[2].find(Test::ICE_ENUM(MyEnum, enum3))->second == "qwerty"); called(); } @@ -740,32 +740,32 @@ public: test(ro.size() == 2); test(ro[0].size() == 3); test(ro[0].find(ms11) != ro[0].end()); - test(ro[0].find(ms11)->second == ICE_ENUM(Test::MyEnum, enum1)); + test(ro[0].find(ms11)->second == Test::ICE_ENUM(MyEnum, enum1)); test(ro[0].find(ms22) != ro[0].end()); - test(ro[0].find(ms22)->second == ICE_ENUM(Test::MyEnum, enum3)); + test(ro[0].find(ms22)->second == Test::ICE_ENUM(MyEnum, enum3)); test(ro[0].find(ms23) != ro[0].end()); - test(ro[0].find(ms23)->second == ICE_ENUM(Test::MyEnum, enum2)); + test(ro[0].find(ms23)->second == Test::ICE_ENUM(MyEnum, enum2)); test(ro[1].size() == 2); test(ro[1].find(ms11) != ro[1].end()); - test(ro[1].find(ms11)->second == ICE_ENUM(Test::MyEnum, enum1)); + test(ro[1].find(ms11)->second == Test::ICE_ENUM(MyEnum, enum1)); test(ro[1].find(ms12) != ro[1].end()); - test(ro[1].find(ms12)->second == ICE_ENUM(Test::MyEnum, enum2)); + test(ro[1].find(ms12)->second == Test::ICE_ENUM(MyEnum, enum2)); test(_do.size() == 3); test(_do[0].size() == 1); test(_do[0].find(ms23) != _do[0].end()); - test(_do[0].find(ms23)->second == ICE_ENUM(Test::MyEnum, enum3)); + test(_do[0].find(ms23)->second == Test::ICE_ENUM(MyEnum, enum3)); test(_do[1].size() == 2); test(_do[1].find(ms11) != _do[1].end()); - test(_do[1].find(ms11)->second == ICE_ENUM(Test::MyEnum, enum1)); + test(_do[1].find(ms11)->second == Test::ICE_ENUM(MyEnum, enum1)); test(_do[1].find(ms12) != _do[1].end()); - test(_do[1].find(ms12)->second == ICE_ENUM(Test::MyEnum, enum2)); + test(_do[1].find(ms12)->second == Test::ICE_ENUM(MyEnum, enum2)); test(_do[2].size() == 3); test(_do[2].find(ms11) != _do[2].end()); - test(_do[2].find(ms11)->second == ICE_ENUM(Test::MyEnum, enum1)); + test(_do[2].find(ms11)->second == Test::ICE_ENUM(MyEnum, enum1)); test(_do[2].find(ms22) != _do[2].end()); - test(_do[2].find(ms22)->second == ICE_ENUM(Test::MyEnum, enum3)); + test(_do[2].find(ms22)->second == Test::ICE_ENUM(MyEnum, enum3)); test(_do[2].find(ms23) != _do[2].end()); - test(_do[2].find(ms23)->second == ICE_ENUM(Test::MyEnum, enum2)); + test(_do[2].find(ms23)->second == Test::ICE_ENUM(MyEnum, enum2)); called(); } @@ -958,24 +958,24 @@ public: void opMyEnumMyEnumSD(const Test::MyEnumMyEnumSD& ro, const Test::MyEnumMyEnumSD& _do) { test(_do.size() == 1); - test(_do.find(ICE_ENUM(Test::MyEnum, enum1)) != _do.end()); - test(_do.find(ICE_ENUM(Test::MyEnum, enum1))->second.size() == 2); - test(_do.find(ICE_ENUM(Test::MyEnum, enum1))->second[0] == ICE_ENUM(Test::MyEnum, enum3)); - test(_do.find(ICE_ENUM(Test::MyEnum, enum1))->second[1] == ICE_ENUM(Test::MyEnum, enum3)); + test(_do.find(Test::ICE_ENUM(MyEnum, enum1)) != _do.end()); + test(_do.find(Test::ICE_ENUM(MyEnum, enum1))->second.size() == 2); + test(_do.find(Test::ICE_ENUM(MyEnum, enum1))->second[0] == Test::ICE_ENUM(MyEnum, enum3)); + test(_do.find(Test::ICE_ENUM(MyEnum, enum1))->second[1] == Test::ICE_ENUM(MyEnum, enum3)); test(ro.size() == 3); - test(ro.find(ICE_ENUM(Test::MyEnum, enum3)) != ro.end()); - test(ro.find(ICE_ENUM(Test::MyEnum, enum3))->second.size() == 3); - test(ro.find(ICE_ENUM(Test::MyEnum, enum3))->second[0] == ICE_ENUM(Test::MyEnum, enum1)); - test(ro.find(ICE_ENUM(Test::MyEnum, enum3))->second[1] == ICE_ENUM(Test::MyEnum, enum1)); - test(ro.find(ICE_ENUM(Test::MyEnum, enum3))->second[2] == ICE_ENUM(Test::MyEnum, enum2)); - test(ro.find(ICE_ENUM(Test::MyEnum, enum2)) != ro.end()); - test(ro.find(ICE_ENUM(Test::MyEnum, enum2))->second.size() == 2); - test(ro.find(ICE_ENUM(Test::MyEnum, enum2))->second[0] == ICE_ENUM(Test::MyEnum, enum1)); - test(ro.find(ICE_ENUM(Test::MyEnum, enum2))->second[1] == ICE_ENUM(Test::MyEnum, enum2)); - test(ro.find(ICE_ENUM(Test::MyEnum, enum1)) != ro.end()); - test(ro.find(ICE_ENUM(Test::MyEnum, enum1))->second.size() == 2); - test(ro.find(ICE_ENUM(Test::MyEnum, enum1))->second[0] == ICE_ENUM(Test::MyEnum, enum3)); - test(ro.find(ICE_ENUM(Test::MyEnum, enum1))->second[1] == ICE_ENUM(Test::MyEnum, enum3)); + test(ro.find(Test::ICE_ENUM(MyEnum, enum3)) != ro.end()); + test(ro.find(Test::ICE_ENUM(MyEnum, enum3))->second.size() == 3); + test(ro.find(Test::ICE_ENUM(MyEnum, enum3))->second[0] == Test::ICE_ENUM(MyEnum, enum1)); + test(ro.find(Test::ICE_ENUM(MyEnum, enum3))->second[1] == Test::ICE_ENUM(MyEnum, enum1)); + test(ro.find(Test::ICE_ENUM(MyEnum, enum3))->second[2] == Test::ICE_ENUM(MyEnum, enum2)); + test(ro.find(Test::ICE_ENUM(MyEnum, enum2)) != ro.end()); + test(ro.find(Test::ICE_ENUM(MyEnum, enum2))->second.size() == 2); + test(ro.find(Test::ICE_ENUM(MyEnum, enum2))->second[0] == Test::ICE_ENUM(MyEnum, enum1)); + test(ro.find(Test::ICE_ENUM(MyEnum, enum2))->second[1] == Test::ICE_ENUM(MyEnum, enum2)); + test(ro.find(Test::ICE_ENUM(MyEnum, enum1)) != ro.end()); + test(ro.find(Test::ICE_ENUM(MyEnum, enum1))->second.size() == 2); + test(ro.find(Test::ICE_ENUM(MyEnum, enum1))->second[0] == Test::ICE_ENUM(MyEnum, enum3)); + test(ro.find(Test::ICE_ENUM(MyEnum, enum1))->second[1] == Test::ICE_ENUM(MyEnum, enum3)); called(); } @@ -1237,8 +1237,8 @@ twowaysAMI(const Ice::CommunicatorPtr& communicator, const Test::MyClassPrxPtr& { CallbackPtr cb = ICE_MAKE_SHARED(Callback); #ifdef ICE_CPP11_MAPPING - p->opMyEnumAsync(MyEnum::enum2, - [&](MyEnum e1, MyEnum e2) + p->opMyEnumAsync(Test::MyEnum::enum2, + [&](Test::MyEnum e1, Test::MyEnum e2) { cb->opMyEnum(e1, e2); }, @@ -1256,7 +1256,7 @@ twowaysAMI(const Ice::CommunicatorPtr& communicator, const Test::MyClassPrxPtr& CallbackPtr cb = ICE_MAKE_SHARED(Callback, communicator); #ifdef ICE_CPP11_MAPPING p->opMyClassAsync(p, - [&](shared_ptr<MyClassPrx> c1, shared_ptr<MyClassPrx> c2, shared_ptr<MyClassPrx> c3) + [&](shared_ptr<Test::MyClassPrx> c1, shared_ptr<Test::MyClassPrx> c2, shared_ptr<Test::MyClassPrx> c3) { cb->opMyClass(move(c1), move(c2), move(c3)); }, @@ -1273,11 +1273,11 @@ twowaysAMI(const Ice::CommunicatorPtr& communicator, const Test::MyClassPrxPtr& { Test::Structure si1; si1.p = p; - si1.e = ICE_ENUM(Test::MyEnum, enum3); + si1.e = Test::ICE_ENUM(MyEnum, enum3); si1.s.s = "abc"; Test::Structure si2; si2.p = 0; - si2.e = ICE_ENUM(Test::MyEnum, enum2); + si2.e = Test::ICE_ENUM(MyEnum, enum2); si2.s.s = "def"; CallbackPtr cb = ICE_MAKE_SHARED(Callback, communicator); @@ -1700,12 +1700,12 @@ twowaysAMI(const Ice::CommunicatorPtr& communicator, const Test::MyClassPrxPtr& { Test::StringMyEnumD di1; - di1["abc"] = ICE_ENUM(Test::MyEnum, enum1); - di1[""] = ICE_ENUM(Test::MyEnum, enum2); + di1["abc"] = Test::ICE_ENUM(MyEnum, enum1); + di1[""] = Test::ICE_ENUM(MyEnum, enum2); Test::StringMyEnumD di2; - di2["abc"] = ICE_ENUM(Test::MyEnum, enum1); - di2["qwerty"] = ICE_ENUM(Test::MyEnum, enum3); - di2["Hello!!"] = ICE_ENUM(Test::MyEnum, enum2); + di2["abc"] = Test::ICE_ENUM(MyEnum, enum1); + di2["qwerty"] = Test::ICE_ENUM(MyEnum, enum3); + di2["Hello!!"] = Test::ICE_ENUM(MyEnum, enum2); CallbackPtr cb = ICE_MAKE_SHARED(Callback); #ifdef ICE_CPP11_MAPPING @@ -1727,15 +1727,15 @@ twowaysAMI(const Ice::CommunicatorPtr& communicator, const Test::MyClassPrxPtr& Test::MyStruct ms11 = { 1, 1 }; Test::MyStruct ms12 = { 1, 2 }; Test::MyStructMyEnumD di1; - di1[ms11] = ICE_ENUM(Test::MyEnum, enum1); - di1[ms12] = ICE_ENUM(Test::MyEnum, enum2); + di1[ms11] = Test::ICE_ENUM(MyEnum, enum1); + di1[ms12] = Test::ICE_ENUM(MyEnum, enum2); Test::MyStruct ms22 = { 2, 2 }; Test::MyStruct ms23 = { 2, 3 }; Test::MyStructMyEnumD di2; - di2[ms11] = ICE_ENUM(Test::MyEnum, enum1); - di2[ms22] = ICE_ENUM(Test::MyEnum, enum3); - di2[ms23] = ICE_ENUM(Test::MyEnum, enum2); + di2[ms11] = Test::ICE_ENUM(MyEnum, enum1); + di2[ms22] = Test::ICE_ENUM(MyEnum, enum3); + di2[ms23] = Test::ICE_ENUM(MyEnum, enum2); CallbackPtr cb = ICE_MAKE_SHARED(Callback); #ifdef ICE_CPP11_MAPPING @@ -1906,14 +1906,14 @@ twowaysAMI(const Ice::CommunicatorPtr& communicator, const Test::MyClassPrxPtr& dsi2.resize(1); Test::StringMyEnumD di1; - di1["abc"] = ICE_ENUM(Test::MyEnum, enum1); - di1[""] = ICE_ENUM(Test::MyEnum, enum2); + di1["abc"] = Test::ICE_ENUM(MyEnum, enum1); + di1[""] = Test::ICE_ENUM(MyEnum, enum2); Test::StringMyEnumD di2; - di2["abc"] = ICE_ENUM(Test::MyEnum, enum1); - di2["qwerty"] = ICE_ENUM(Test::MyEnum, enum3); - di2["Hello!!"] = ICE_ENUM(Test::MyEnum, enum2); + di2["abc"] = Test::ICE_ENUM(MyEnum, enum1); + di2["qwerty"] = Test::ICE_ENUM(MyEnum, enum3); + di2["Hello!!"] = Test::ICE_ENUM(MyEnum, enum2); Test::StringMyEnumD di3; - di3["Goodbye"] = ICE_ENUM(Test::MyEnum, enum1); + di3["Goodbye"] = Test::ICE_ENUM(MyEnum, enum1); dsi1[0] = di1; dsi1[1] = di2; @@ -1942,12 +1942,12 @@ twowaysAMI(const Ice::CommunicatorPtr& communicator, const Test::MyClassPrxPtr& dsi2.resize(1); Test::MyEnumStringD di1; - di1[ICE_ENUM(Test::MyEnum, enum1)] = "abc"; + di1[Test::ICE_ENUM(MyEnum, enum1)] = "abc"; Test::MyEnumStringD di2; - di2[ICE_ENUM(Test::MyEnum, enum2)] = "Hello!!"; - di2[ICE_ENUM(Test::MyEnum, enum3)] = "qwerty"; + di2[Test::ICE_ENUM(MyEnum, enum2)] = "Hello!!"; + di2[Test::ICE_ENUM(MyEnum, enum3)] = "qwerty"; Test::MyEnumStringD di3; - di3[ICE_ENUM(Test::MyEnum, enum1)] = "Goodbye"; + di3[Test::ICE_ENUM(MyEnum, enum1)] = "Goodbye"; dsi1[0] = di1; dsi1[1] = di2; @@ -1978,18 +1978,18 @@ twowaysAMI(const Ice::CommunicatorPtr& communicator, const Test::MyClassPrxPtr& Test::MyStruct ms11 = { 1, 1 }; Test::MyStruct ms12 = { 1, 2 }; Test::MyStructMyEnumD di1; - di1[ms11] = ICE_ENUM(Test::MyEnum, enum1); - di1[ms12] = ICE_ENUM(Test::MyEnum, enum2); + di1[ms11] = Test::ICE_ENUM(MyEnum, enum1); + di1[ms12] = Test::ICE_ENUM(MyEnum, enum2); Test::MyStruct ms22 = { 2, 2 }; Test::MyStruct ms23 = { 2, 3 }; Test::MyStructMyEnumD di2; - di2[ms11] = ICE_ENUM(Test::MyEnum, enum1); - di2[ms22] = ICE_ENUM(Test::MyEnum, enum3); - di2[ms23] = ICE_ENUM(Test::MyEnum, enum2); + di2[ms11] = Test::ICE_ENUM(MyEnum, enum1); + di2[ms22] = Test::ICE_ENUM(MyEnum, enum3); + di2[ms23] = Test::ICE_ENUM(MyEnum, enum2); Test::MyStructMyEnumD di3; - di3[ms23] = ICE_ENUM(Test::MyEnum, enum3); + di3[ms23] = Test::ICE_ENUM(MyEnum, enum3); dsi1[0] = di1; dsi1[1] = di2; @@ -1998,7 +1998,7 @@ twowaysAMI(const Ice::CommunicatorPtr& communicator, const Test::MyClassPrxPtr& CallbackPtr cb = ICE_MAKE_SHARED(Callback); #ifdef ICE_CPP11_MAPPING p->opMyStructMyEnumDSAsync(dsi1, dsi2, - [&](Test::MyStructMyEnumDS dsi3, MyStructMyEnumDS dsi4) + [&](Test::MyStructMyEnumDS dsi3, Test::MyStructMyEnumDS dsi4) { cb->opMyStructMyEnumDS(move(dsi3), move(dsi4)); }, @@ -2304,17 +2304,17 @@ twowaysAMI(const Ice::CommunicatorPtr& communicator, const Test::MyClassPrxPtr& Test::MyEnumS si2; Test::MyEnumS si3; - si1.push_back(ICE_ENUM(Test::MyEnum, enum1)); - si1.push_back(ICE_ENUM(Test::MyEnum, enum1)); - si1.push_back(ICE_ENUM(Test::MyEnum, enum2)); - si2.push_back(ICE_ENUM(Test::MyEnum, enum1)); - si2.push_back(ICE_ENUM(Test::MyEnum, enum2)); - si3.push_back(ICE_ENUM(Test::MyEnum, enum3)); - si3.push_back(ICE_ENUM(Test::MyEnum, enum3)); + si1.push_back(Test::ICE_ENUM(MyEnum, enum1)); + si1.push_back(Test::ICE_ENUM(MyEnum, enum1)); + si1.push_back(Test::ICE_ENUM(MyEnum, enum2)); + si2.push_back(Test::ICE_ENUM(MyEnum, enum1)); + si2.push_back(Test::ICE_ENUM(MyEnum, enum2)); + si3.push_back(Test::ICE_ENUM(MyEnum, enum3)); + si3.push_back(Test::ICE_ENUM(MyEnum, enum3)); - sdi1[ICE_ENUM(Test::MyEnum, enum3)] = si1; - sdi1[ICE_ENUM(Test::MyEnum, enum2)] = si2; - sdi2[ICE_ENUM(Test::MyEnum, enum1)] = si3; + sdi1[Test::ICE_ENUM(MyEnum, enum3)] = si1; + sdi1[Test::ICE_ENUM(MyEnum, enum2)] = si2; + sdi2[Test::ICE_ENUM(MyEnum, enum1)] = si3; CallbackPtr cb = ICE_MAKE_SHARED(Callback); #ifdef ICE_CPP11_MAPPING @@ -2475,7 +2475,7 @@ twowaysAMI(const Ice::CommunicatorPtr& communicator, const Test::MyClassPrxPtr& Ice::PropertiesPtr properties = ic->getProperties(); Test::MyClassPrxPtr q = ICE_UNCHECKED_CAST(Test::MyClassPrx, - ic->stringToProxy("test:" + TestHelper::getTestEndpoint(properties))); + ic->stringToProxy("test:" + Test::TestHelper::getTestEndpoint(properties))); ic->getImplicitContext()->setContext(ctx); test(ic->getImplicitContext()->getContext() == ctx); { @@ -2894,11 +2894,11 @@ twowaysAMI(const Ice::CommunicatorPtr& communicator, const Test::MyClassPrxPtr& { Test::Structure si1; si1.p = p; - si1.e = ICE_ENUM(Test::MyEnum, enum3); + si1.e = Test::ICE_ENUM(MyEnum, enum3); si1.s.s = "abc"; Test::Structure si2; si2.p = 0; - si2.e = ICE_ENUM(Test::MyEnum, enum2); + si2.e = Test::ICE_ENUM(MyEnum, enum2); si2.s.s = "def"; CallbackPtr cb = ICE_MAKE_SHARED(Callback, communicator); @@ -3276,12 +3276,12 @@ twowaysAMI(const Ice::CommunicatorPtr& communicator, const Test::MyClassPrxPtr& { Test::StringMyEnumD di1; - di1["abc"] = ICE_ENUM(Test::MyEnum, enum1); - di1[""] = ICE_ENUM(Test::MyEnum, enum2); + di1["abc"] = Test::ICE_ENUM(MyEnum, enum1); + di1[""] = Test::ICE_ENUM(MyEnum, enum2); Test::StringMyEnumD di2; - di2["abc"] = ICE_ENUM(Test::MyEnum, enum1); - di2["qwerty"] = ICE_ENUM(Test::MyEnum, enum3); - di2["Hello!!"] = ICE_ENUM(Test::MyEnum, enum2); + di2["abc"] = Test::ICE_ENUM(MyEnum, enum1); + di2["qwerty"] = Test::ICE_ENUM(MyEnum, enum3); + di2["Hello!!"] = Test::ICE_ENUM(MyEnum, enum2); CallbackPtr cb = ICE_MAKE_SHARED(Callback); auto f = p->opStringMyEnumDAsync(di1, di2); @@ -3305,15 +3305,15 @@ twowaysAMI(const Ice::CommunicatorPtr& communicator, const Test::MyClassPrxPtr& Test::MyStruct ms11 = { 1, 1 }; Test::MyStruct ms12 = { 1, 2 }; Test::MyStructMyEnumD di1; - di1[ms11] = ICE_ENUM(Test::MyEnum, enum1); - di1[ms12] = ICE_ENUM(Test::MyEnum, enum2); + di1[ms11] = Test::ICE_ENUM(MyEnum, enum1); + di1[ms12] = Test::ICE_ENUM(MyEnum, enum2); Test::MyStruct ms22 = { 2, 2 }; Test::MyStruct ms23 = { 2, 3 }; Test::MyStructMyEnumD di2; - di2[ms11] = ICE_ENUM(Test::MyEnum, enum1); - di2[ms22] = ICE_ENUM(Test::MyEnum, enum3); - di2[ms23] = ICE_ENUM(Test::MyEnum, enum2); + di2[ms11] = Test::ICE_ENUM(MyEnum, enum1); + di2[ms22] = Test::ICE_ENUM(MyEnum, enum3); + di2[ms23] = Test::ICE_ENUM(MyEnum, enum2); CallbackPtr cb = ICE_MAKE_SHARED(Callback); auto f = p->opMyStructMyEnumDAsync(di1, di2); @@ -3493,14 +3493,14 @@ twowaysAMI(const Ice::CommunicatorPtr& communicator, const Test::MyClassPrxPtr& dsi2.resize(1); Test::StringMyEnumD di1; - di1["abc"] = ICE_ENUM(Test::MyEnum, enum1); - di1[""] = ICE_ENUM(Test::MyEnum, enum2); + di1["abc"] = Test::ICE_ENUM(MyEnum, enum1); + di1[""] = Test::ICE_ENUM(MyEnum, enum2); Test::StringMyEnumD di2; - di2["abc"] = ICE_ENUM(Test::MyEnum, enum1); - di2["qwerty"] = ICE_ENUM(Test::MyEnum, enum3); - di2["Hello!!"] = ICE_ENUM(Test::MyEnum, enum2); + di2["abc"] = Test::ICE_ENUM(MyEnum, enum1); + di2["qwerty"] = Test::ICE_ENUM(MyEnum, enum3); + di2["Hello!!"] = Test::ICE_ENUM(MyEnum, enum2); Test::StringMyEnumD di3; - di3["Goodbye"] = ICE_ENUM(Test::MyEnum, enum1); + di3["Goodbye"] = Test::ICE_ENUM(MyEnum, enum1); dsi1[0] = di1; dsi1[1] = di2; @@ -3531,12 +3531,12 @@ twowaysAMI(const Ice::CommunicatorPtr& communicator, const Test::MyClassPrxPtr& dsi2.resize(1); Test::MyEnumStringD di1; - di1[ICE_ENUM(Test::MyEnum, enum1)] = "abc"; + di1[Test::ICE_ENUM(MyEnum, enum1)] = "abc"; Test::MyEnumStringD di2; - di2[ICE_ENUM(Test::MyEnum, enum2)] = "Hello!!"; - di2[ICE_ENUM(Test::MyEnum, enum3)] = "qwerty"; + di2[Test::ICE_ENUM(MyEnum, enum2)] = "Hello!!"; + di2[Test::ICE_ENUM(MyEnum, enum3)] = "qwerty"; Test::MyEnumStringD di3; - di3[ICE_ENUM(Test::MyEnum, enum1)] = "Goodbye"; + di3[Test::ICE_ENUM(MyEnum, enum1)] = "Goodbye"; dsi1[0] = di1; dsi1[1] = di2; @@ -3569,18 +3569,18 @@ twowaysAMI(const Ice::CommunicatorPtr& communicator, const Test::MyClassPrxPtr& Test::MyStruct ms11 = { 1, 1 }; Test::MyStruct ms12 = { 1, 2 }; Test::MyStructMyEnumD di1; - di1[ms11] = ICE_ENUM(Test::MyEnum, enum1); - di1[ms12] = ICE_ENUM(Test::MyEnum, enum2); + di1[ms11] = Test::ICE_ENUM(MyEnum, enum1); + di1[ms12] = Test::ICE_ENUM(MyEnum, enum2); Test::MyStruct ms22 = { 2, 2 }; Test::MyStruct ms23 = { 2, 3 }; Test::MyStructMyEnumD di2; - di2[ms11] = ICE_ENUM(Test::MyEnum, enum1); - di2[ms22] = ICE_ENUM(Test::MyEnum, enum3); - di2[ms23] = ICE_ENUM(Test::MyEnum, enum2); + di2[ms11] = Test::ICE_ENUM(MyEnum, enum1); + di2[ms22] = Test::ICE_ENUM(MyEnum, enum3); + di2[ms23] = Test::ICE_ENUM(MyEnum, enum2); Test::MyStructMyEnumD di3; - di3[ms23] = ICE_ENUM(Test::MyEnum, enum3); + di3[ms23] = Test::ICE_ENUM(MyEnum, enum3); dsi1[0] = di1; dsi1[1] = di2; @@ -3914,17 +3914,17 @@ twowaysAMI(const Ice::CommunicatorPtr& communicator, const Test::MyClassPrxPtr& Test::MyEnumS si2; Test::MyEnumS si3; - si1.push_back(ICE_ENUM(Test::MyEnum, enum1)); - si1.push_back(ICE_ENUM(Test::MyEnum, enum1)); - si1.push_back(ICE_ENUM(Test::MyEnum, enum2)); - si2.push_back(ICE_ENUM(Test::MyEnum, enum1)); - si2.push_back(ICE_ENUM(Test::MyEnum, enum2)); - si3.push_back(ICE_ENUM(Test::MyEnum, enum3)); - si3.push_back(ICE_ENUM(Test::MyEnum, enum3)); - - sdi1[ICE_ENUM(Test::MyEnum, enum3)] = si1; - sdi1[ICE_ENUM(Test::MyEnum, enum2)] = si2; - sdi2[ICE_ENUM(Test::MyEnum, enum1)] = si3; + si1.push_back(Test::ICE_ENUM(MyEnum, enum1)); + si1.push_back(Test::ICE_ENUM(MyEnum, enum1)); + si1.push_back(Test::ICE_ENUM(MyEnum, enum2)); + si2.push_back(Test::ICE_ENUM(MyEnum, enum1)); + si2.push_back(Test::ICE_ENUM(MyEnum, enum2)); + si3.push_back(Test::ICE_ENUM(MyEnum, enum3)); + si3.push_back(Test::ICE_ENUM(MyEnum, enum3)); + + sdi1[Test::ICE_ENUM(MyEnum, enum3)] = si1; + sdi1[Test::ICE_ENUM(MyEnum, enum2)] = si2; + sdi2[Test::ICE_ENUM(MyEnum, enum1)] = si3; CallbackPtr cb = ICE_MAKE_SHARED(Callback); auto f = p->opMyEnumMyEnumSDAsync(sdi1, sdi2); diff --git a/cpp/test/Ice/stringConverter/Client.cpp b/cpp/test/Ice/stringConverter/Client.cpp index bc746df14ca..e32b6e51dbe 100644 --- a/cpp/test/Ice/stringConverter/Client.cpp +++ b/cpp/test/Ice/stringConverter/Client.cpp @@ -55,7 +55,7 @@ Client::run(int argc, char** argv) narrowEncoding = "iso815"; wideEncoding = "ucs4"; -#elif defined(_AIX) +#elif defined(_AIX) && !defined(_LIBICONV_VERSION) // Always big-endian narrowEncoding = "ISO8859-15"; diff --git a/cpp/test/Ice/stringConverter/Makefile.mk b/cpp/test/Ice/stringConverter/Makefile.mk index 22c6a4d2ef0..3ca7713a6b9 100644 --- a/cpp/test/Ice/stringConverter/Makefile.mk +++ b/cpp/test/Ice/stringConverter/Makefile.mk @@ -2,6 +2,6 @@ # Copyright (c) ZeroC, Inc. All rights reserved. # -$(test)_ldflags = $(iconv_ldflags) +$(test)_libs = iconv tests += $(test) diff --git a/cpp/test/Ice/udp/AllTests.cpp b/cpp/test/Ice/udp/AllTests.cpp index c7c8dc1ce1d..cbe74f201f6 100644 --- a/cpp/test/Ice/udp/AllTests.cpp +++ b/cpp/test/Ice/udp/AllTests.cpp @@ -154,7 +154,22 @@ allTests(Test::TestHelper* helper) while(nRetry-- > 0) { replyI->reset(); - objMcast->ping(reply); + try + { + objMcast->ping(reply); + } + catch(const Ice::SocketException&) + { + // Multicast IPv6 not supported on the platform. This occurs for example + // on AIX PVP clould VMs. + if(communicator->getProperties()->getProperty("Ice.IPv6") == "1") + { + cout << "(not supported) "; + ret = true; + break; + } + throw; + } ret = replyI->waitReply(5, IceUtil::Time::seconds(2)); if(ret) { @@ -175,7 +190,6 @@ allTests(Test::TestHelper* helper) cout << "testing udp bi-dir connection... " << flush; obj->ice_getConnection()->setAdapter(adapter); - objMcast->ice_getConnection()->setAdapter(adapter); nRetry = 5; while(nRetry-- > 0) { @@ -205,6 +219,7 @@ allTests(Test::TestHelper* helper) // // cout << "testing udp bi-dir connection... " << flush; // nRetry = 5; +// objMcast->ice_getConnection()->setAdapter(adapter); // while(nRetry-- > 0) // { // replyI->reset(); diff --git a/cpp/test/Ice/udp/Server.cpp b/cpp/test/Ice/udp/Server.cpp index 34113776aba..17a8427ef46 100644 --- a/cpp/test/Ice/udp/Server.cpp +++ b/cpp/test/Ice/udp/Server.cpp @@ -56,10 +56,26 @@ Server::run(int argc, char** argv) #endif } communicator->getProperties()->setProperty("McastTestAdapter.Endpoints", endpoint.str()); - Ice::ObjectAdapterPtr mcastAdapter = communicator->createObjectAdapter("McastTestAdapter"); - mcastAdapter->add(ICE_MAKE_SHARED(TestIntfI), Ice::stringToIdentity("test")); - mcastAdapter->activate(); + try + { + Ice::ObjectAdapterPtr mcastAdapter = communicator->createObjectAdapter("McastTestAdapter"); + mcastAdapter->add(ICE_MAKE_SHARED(TestIntfI), Ice::stringToIdentity("test")); + mcastAdapter->activate(); + } + catch(const Ice::SocketException&) + { + // Multicast IPv6 not supported on the platform. This occurs for example + // on AIX PVP clould VMs. + if(communicator->getProperties()->getProperty("Ice.IPv6") == "1") + { + cout << "McastTestAdapter ready" << endl; + } + else + { + throw; + } + } serverReady(); communicator->waitForShutdown(); diff --git a/cpp/test/IceGrid/fileLock/test.py b/cpp/test/IceGrid/fileLock/test.py index 3a0cd85cbec..11055392cad 100644 --- a/cpp/test/IceGrid/fileLock/test.py +++ b/cpp/test/IceGrid/fileLock/test.py @@ -8,7 +8,7 @@ class IceGridAdminTestCase(IceGridTestCase): def runClientSide(self, current): sys.stdout.write("testing IceGrid file lock... ") - registry = IceGridRegistryMaster(portnum=25, readyCount=0, quiet=True); + registry = IceGridRegistryMaster(portnum=25, ready="", quiet=True); registry.start(current) registry.expect(current, ".*IceUtil::FileLockException.*") registry.stop(current, False) diff --git a/cpp/test/IceGrid/session/AllTests.cpp b/cpp/test/IceGrid/session/AllTests.cpp index 256236e8dd0..d265c5284a0 100644 --- a/cpp/test/IceGrid/session/AllTests.cpp +++ b/cpp/test/IceGrid/session/AllTests.cpp @@ -480,6 +480,10 @@ testFailedAndPrintObservers(const char* expr, const char* file, unsigned int lin #undef test #define test(ex) ((ex) ? ((void)0) : testFailedAndPrintObservers(#ex, __FILE__, __LINE__)) +#if defined(_AIX) && defined(__GNUC__) && !defined(__ibmxl__) +// Strange optimization bug with catching ExtendedPermissionDeniedException with GCC 8.1 on AIX +__attribute__((optimize("O0"))) +#endif void allTests(Test::TestHelper* helper) { diff --git a/cpp/test/IceStorm/single/test.py b/cpp/test/IceStorm/single/test.py index a225315302f..9e4500ac08c 100644 --- a/cpp/test/IceStorm/single/test.py +++ b/cpp/test/IceStorm/single/test.py @@ -6,16 +6,16 @@ # # Make sure the subscriber uses a larger size receive buffer size then # the IceStorm send buffer size. This ensures the test works with bogus -# OS configurations where the reicever buffer size is smaller than the +# OS configurations where the receiver buffer size is smaller than the # send buffer size (causing the received messages to be truncated). See # bug #6070 and #7558. # -props = { "Ice.UDP.SndSize" : 2048 * 1024, "Ice.Warn.Dispatch" : 0 } +props = { "Ice.UDP.SndSize" : 512 * 1024, "Ice.Warn.Dispatch" : 0 } persistent = IceStorm(props = props) transient = IceStorm(props = props, transient=True) replicated = [ IceStorm(replica=i, nreplicas=3, props = props) for i in range(0,3) ] -sub = Subscriber(args=["{testcase.parent.name}"], props = { "Ice.UDP.RcvSize" : 4096 * 1024 }, readyCount=3) +sub = Subscriber(args=["{testcase.parent.name}"], props = { "Ice.UDP.RcvSize" : 1024 * 1024 }, readyCount=3) pub = Publisher(args=["{testcase.parent.name}"]) class IceStormSingleTestCase(IceStormTestCase): diff --git a/cpp/test/IceUtil/unicode/Client.cpp b/cpp/test/IceUtil/unicode/Client.cpp index 8e09ef3618e..e40ad062532 100644 --- a/cpp/test/IceUtil/unicode/Client.cpp +++ b/cpp/test/IceUtil/unicode/Client.cpp @@ -187,8 +187,12 @@ main(int argc, char* argv[]) // // Euro sign (U+20AC) is encoded with 1 UTF-16 code unit, and 3 UTF-8 code units // U+10437 is a Deseret character, encoded with 2 UTF-16 code units, and 4 UTF-8 code units - // + // xlC in 32-bit mode truncates U+10437 into a single UTF-16 character +#if defined(__IBMCPP__) && !defined(__64BIT__) + wstring ws = L"\u20ac\u20ac\ud801\udc37"; +#else wstring ws = L"\u20ac\u20ac\U00010437"; +#endif if(sizeof(wchar_t) == 2) { diff --git a/cpp/test/Slice/errorDetection/test.py b/cpp/test/Slice/errorDetection/test.py index 001543cb0e6..ede8e665bbf 100644 --- a/cpp/test/Slice/errorDetection/test.py +++ b/cpp/test/Slice/errorDetection/test.py @@ -33,20 +33,21 @@ class SliceErrorDetectionTestCase(ClientTestCase): regex1 = re.compile("\.ice$", re.IGNORECASE) lines1 = output.strip().splitlines() - lines2 = open(os.path.join(testdir, regex1.sub(".err", file)), "r").readlines() - if len(lines1) != len(lines2): - raise RuntimeError("failed (lines1 = {0}, lines2 = {1})!".format(len(lines1), len(lines2))) - - regex2 = re.compile("^.*(?=" + os.path.basename(file) + ")") - i = 0 - while i < len(lines1): - line1 = regex2.sub("", lines1[i]).strip() - line2 = regex2.sub("", lines2[i]).strip() - if line1 != line2: - raise RuntimeError("failed! (line1 = \"{0}\", line2 = \"{1}\"".format(line1, line2)) - i = i + 1 - else: - current.writeln("ok") + with open(os.path.join(testdir, regex1.sub(".err", file)), "r") as f: + lines2 = f.readlines() + if len(lines1) != len(lines2): + raise RuntimeError("failed (lines1 = {0}, lines2 = {1})!".format(len(lines1), len(lines2))) + + regex2 = re.compile("^.*(?=" + os.path.basename(file) + ")") + i = 0 + while i < len(lines1): + line1 = regex2.sub("", lines1[i]).strip() + line2 = regex2.sub("", lines2[i]).strip() + if line1 != line2: + raise RuntimeError("failed! (line1 = \"{0}\", line2 = \"{1}\"".format(line1, line2)) + i = i + 1 + else: + current.writeln("ok") for language in ["cpp", "cs", "html", "java", "js", "matlab", "objc", "php", "py", "rb"]: compiler = SliceTranslator('slice2%s' % language) diff --git a/cpp/test/Slice/headers/test.py b/cpp/test/Slice/headers/test.py index 2ded9c53337..7b66e895638 100644 --- a/cpp/test/Slice/headers/test.py +++ b/cpp/test/Slice/headers/test.py @@ -93,7 +93,7 @@ class SliceHeadersTestCase(ClientTestCase): os.system("mkdir -p tmp/Ice-x.y.z/slice/Ice") os.system("cd tmp && ln -s Ice-x.y.z Ice-x.y") f = open("tmp/Ice-x.y.z/slice/Ice/Identity.ice", "w") - f.write("// dumy file") + f.write("// dummy file") os.system("mkdir -p project1") f = open("project1/A.ice", "w") @@ -108,23 +108,24 @@ class SliceHeadersTestCase(ClientTestCase): # # symlink directory with extra / at end + # (the symlink with / at the end fails on AIX) # - # - os.system("mkdir -p tmp/Ice-x.y.z/slice/Ice") - os.system("mkdir -p tmp/Ice") - os.system("cd tmp/Ice && ln -s ../Ice-x.y.z/slice/ .") - f = open("tmp/Ice-x.y.z/slice/Ice/Identity.ice", "w") - f.write("// dumy file") - f.close() - os.system("mkdir -p project1") - f = open("project1/A.ice", "w") - f.write("#include <Ice/Identity.ice>") - f.close() - os.system("cd project1 && %s -I%s/tmp/Ice/slice A.ice" % (slice2cpp, basedir)) - f = open("project1/A.h") - if not re.search(re.escape('#include <Ice/Identity.h>'), f.read()): - raise RuntimeError("failed!") - self.clean() + if not isinstance(platform, AIX): + os.system("mkdir -p tmp/Ice-x.y.z/slice/Ice") + os.system("mkdir -p tmp/Ice") + os.system("cd tmp/Ice && ln -s ../Ice-x.y.z/slice/ .") + f = open("tmp/Ice-x.y.z/slice/Ice/Identity.ice", "w") + f.write("// dummy file") + f.close() + os.system("mkdir -p project1") + f = open("project1/A.ice", "w") + f.write("#include <Ice/Identity.ice>") + f.close() + os.system("cd project1 && %s -I%s/tmp/Ice/slice A.ice" % (slice2cpp, basedir)) + f = open("project1/A.h") + if not re.search(re.escape('#include <Ice/Identity.h>'), f.read()): + raise RuntimeError("failed!") + self.clean() current.writeln("ok") diff --git a/cpp/test/Slice/parser/Makefile.mk b/cpp/test/Slice/parser/Makefile.mk index c46cfbb48ab..38686ff72f5 100644 --- a/cpp/test/Slice/parser/Makefile.mk +++ b/cpp/test/Slice/parser/Makefile.mk @@ -3,7 +3,6 @@ # $(test)_libraries := SliceParser - -$(test)_sliceflags := -I$(test) +$(test)_sliceflags := -I$(test) tests += $(test) |