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 | |
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
102 files changed, 2185 insertions, 710 deletions
diff --git a/.gitignore b/.gitignore index 3472432f40e..07282ef77c1 100644 --- a/.gitignore +++ b/.gitignore @@ -112,4 +112,9 @@ csharp/AppX cpp/AppX cpp/test/Slice/errorDetection/tmp -Carthage
\ No newline at end of file +Carthage + +# iOS builds + +**/objs-*/ +**/build-*/ diff --git a/CHANGELOG-3.7.md b/CHANGELOG-3.7.md index 5facbe9bdb5..4ba699852ef 100644 --- a/CHANGELOG-3.7.md +++ b/CHANGELOG-3.7.md @@ -12,26 +12,28 @@ particular aspect of Ice. * [C++ Changes](#c-changes) * [C# Changes](#c-changes-1) * [Java Changes](#java-changes) + * [MATLAB Changes](#matlab-changes) + * [Python Changes](#python-changes) - [Changes in Ice 3.7.2](#changes-in-ice-372) * [General Changes](#general-changes) * [C++ Changes](#c-changes-2) * [C# Changes](#c-changes-3) * [Java Changes](#java-changes) * [JavaScript Changes](#javascript-changes) - * [MATLAB Changes](#matlab-changes) + * [MATLAB Changes](#matlab-changes-1) * [Objective-C Changes](#objective-c-changes) * [PHP Changes](#php-changes) - * [Python Changes](#python-changes) + * [Python Changes](#python-changes-1) - [Changes in Ice 3.7.1](#changes-in-ice-371) * [General Changes](#general-changes-1) * [C++ Changes](#c-changes-4) * [C# Changes](#c-changes-5) * [Java Changes](#java-changes-1) * [JavaScript Changes](#javascript-changes-1) - * [MATLAB Changes](#matlab-changes-1) + * [MATLAB Changes](#matlab-changes-2) * [Objective-C Changes](#objective-c-changes-1) * [PHP Changes](#php-changes-1) - * [Python Changes](#python-changes-1) + * [Python Changes](#python-changes-2) * [Ruby Changes](#ruby-changes) - [Changes in Ice 3.7.0](#changes-in-ice-370) * [General Changes](#general-changes-2) @@ -41,15 +43,31 @@ particular aspect of Ice. * [JavaScript Changes](#javascript-changes-2) * [Objective-C Changes](#objective-c-changes-2) * [PHP Changes](#php-changes-2) - * [Python Changes](#python-changes-2) + * [Python Changes](#python-changes-3) * [Ruby Changes](#ruby-changes-1) # Changes in Ice 3.7.3 These are the changes since Ice 3.7.2. +## General Changes + +- Fixed Slice compilers to allow forward declared interfaces and classes that + are marshaled or unmarshaled in a Slice file without being fully defined in + that Slice file. This was allowed (but not documented) in Ice 3.6 and earlier + releases, and disallowed in Ice 3.7.0 - Ice 3.7.2. + +- Added `ice_isFixed` proxy method to test whether a proxy is a fixed proxy + or not. + ## C++ Changes +- Removed IceStorm restriction where retryCount could only be used with two-way + proxies. It's now possible to use it with one-way or batch proxies. + +- Added new metadata directive `cpp:source-include`, to include a header file in + the generated source (.cpp) file. + - Fixed IceGrid node bug where the setting of supplementary groups would fail if the user had more than NGROUPS_MAX groups. @@ -57,6 +75,27 @@ These are the changes since Ice 3.7.2. ran as a given user was incorrect when running the IceGrid node as root. The server would be ran with the root/wheel supplementary group. +- Fixed a bug in IceGrid node that could result in an infinite loop when + the system call to `getpwuid_r` fails with `ERANGE`. + +- Fixed build failures on Linux ppc64el due to `__linux` macro not being defined + in C++11 mode, `__linux__` must be used. + +- Add support for Visual Studio 2019. + +- Fixed GCC 9 build failures. + +## C# Changes + +- Added back support for caching the output stream used to marshal the response + of a synchronous dispatch. + +- Fixed C# to not require unsafe code, `AllowUnsafeBlocks` is not longer set when + building Ice for C#. + +- Fixed loading of Bzip2 native libraries in Linux to fallback to libbz2.so.1 + if libbz2.so.1.0 doesn't exists. + ## Java Changes - Added back support for caching the output stream used to marshal the response @@ -66,10 +105,22 @@ These are the changes since Ice 3.7.2. when building Ice for Java with JDK 9 or greater, the JARs are compatible with JDK 8. -## C# Changes +## MATLAB Changes -- Added back support for caching the output stream used to marshal the response - of a synchronous dispatch. +- Added support for `Ice.ClassGraphDepthMax` property to prevent stack property + to prevent stack overflows in case a sender sends a very large graph. This was + already supported with other language mappings but it was missing in MATLAB. + +- Fixed a bug in `ice_isA` implementation that result in `ice_isA` throwing + `FacetNotExistException` when it should return null. + +## Python Changes + +- Fix a bug where using an optional data member with the `python:numpy.ndarray` + sequence mapping can result in segmentation fault of the python interpreter. + +- Fix a bug where using an empty sequence with a type that use the Python buffer + protocol can result in an assert if running with a python debug build. # Changes in Ice 3.7.2 @@ -79,8 +130,8 @@ These are the changes since Ice 3.7.1. - Add support for TLS 1.3 to IceSSL. -- Add support for reading Ice properties from the HKCU Windows registry hive. Previously - you could only read properties from the HKLM Windows registry hive. +- Add support for reading Ice properties from the HKCU Windows registry hive. + Previously you could only read properties from the HKLM Windows registry hive. ## C++ Changes diff --git a/config/Make.project.rules b/config/Make.project.rules index ebcb6dc3c8b..fe00dec070d 100644 --- a/config/Make.project.rules +++ b/config/Make.project.rules @@ -43,11 +43,11 @@ component-configs = $(call unique,$(foreach c,$(configs),\ # # Some variables for utilities # -INSTALL = install -p -MV = mv -f -RM = rm -f -MKDIR = mkdir -CHMOD = chmod +INSTALL ?= install -p +MV ?= mv -f +RM ?= rm -f +MKDIR ?= mkdir +CHMOD ?= chmod Q := $(if $(V),,@) E := $(if $(V),@:,@echo) @@ -936,6 +936,7 @@ currentdir = $(call dirname,$(word $(words $(MAKEFILE_LIST)),$(MAKEFILE_LIS unique = $(strip $(if $1,$(firstword $1) $(call unique,$(filter-out $(firstword $1),$1)))) runique = $(strip $(if $1,$(lastword $1) $(call runique,$(filter-out $(lastword $1),$1)))) files-to-dirs = $(call unique,$(call dirname,$(filter $(if $2,$(addprefix %.,$2),%),$1))) +join-with = $(subst $(space),$1,$(strip $2)) empty := space := $(empty) $(empty) @@ -1087,7 +1088,7 @@ platform-and-config-var = $(strip $(platform-var) $(config-var)) # # Functions to transform a list of source filenames to generated source/header, object or dependency filenames. -# +# generated-extensions := ice source-extensions := ice y l cpp m mm diff --git a/config/Make.rules b/config/Make.rules index d944f6d94ad..015e9643cec 100644 --- a/config/Make.rules +++ b/config/Make.rules @@ -26,7 +26,7 @@ embedded_runpath ?= yes # # Define new_dtags as yes if you want the linker to enable the new style # dtags, this will cause the linker to add a runpath entry instead of -# a rpath entry. This only aplly to gcc builds on Linux +# a rpath entry. This only apply to gcc builds on Linux # new_dtags ?= no @@ -91,11 +91,15 @@ include $(top_srcdir)/config/Make.project.rules include $(top_srcdir)/config/Make.tests.rules dotnet := $(shell command -v dotnet 2> /dev/null) +nodejs := $(shell command -v node 2> /dev/null) # # Languages, platforms and configurations to build # -supported-languages ?= cpp $(if $(filter %/dotnet,$(dotnet)),csharp) java java-compat python js ruby php $(if $(filter Darwin,$(os)),objective-c) +supported-languages ?= $(strip cpp java java-compat python ruby php \ + $(if $(filter %/node,$(nodejs)),js) \ + $(if $(filter %/dotnet,$(dotnet)),csharp) \ + $(if $(filter Darwin,$(os)),objective-c)) supported-configs ?= shared version = 3.7b1 diff --git a/config/Make.rules.AIX b/config/Make.rules.AIX index c020059ba7a..76c9100e59f 100644 --- a/config/Make.rules.AIX +++ b/config/Make.rules.AIX @@ -2,27 +2,30 @@ # Copyright (c) ZeroC, Inc. All rights reserved. # -supported-platforms = ppc ppc64 +# The default platform (ppc64) is listed first +supported-platforms = ppc64 ppc -ppc_cppflags = -q32 -D_LARGE_FILES -ppc_ldflags = $(ppc_cppflags) -ppc_targetdir = $(if $(filter %/build,$5),/ppc) - -ppc64_cppflags = -q64 -ppc64_ldflags = $(ppc64_cppflags) -ppc64_targetdir = $(if $(filter %/build,$5),/ppc64,$(if $(filter-out $($1_target),program),64)) -ppc64_targetname = $(if $(and $(filter $(bindir)%,$($4_targetdir)),$(filter $($1_target),program)),_64) +supported-compilers = xlC_r xlclang++ g++ +COMPILER ?= $(firstword $(supported-compilers)) -shared_cppflags = -brtl -static_targetdir = $(if $(and $(filter-out %/build,$5),$(filter $($1_target),program)),,static) +ifneq ($(filter $(COMPILER),$(supported-compilers)),$(COMPILER)) + $(error invalid compiler $(COMPILER); the supported compilers are: $(supported-compilers)) +endif -platform_cxx = xlC_r -platform_ld = xlC_r platform_ar = $(AR) +INSTALL = installbsd -c + +ppc_targetdir = $(if $(filter %/build,$5),/ppc,$(if $(filter-out $($1_target),program),32)) +ppc_installdir = $(if $(and $(filter-out $($1_target),program),$(if $5,$(filter-out %32,$5),true)),32) +# All 32-bit programs in "bin" get the _32 suffix +ppc_targetname = $(if $(and $(filter $(bindir)%,$($4_targetdir)),$(filter $($1_target),program)),_32) -xlc_compiler = yes +ppc64_targetdir = $(if $(filter %/build,$5),/ppc64) -cppflags = -qrtti=all -qstaticinline -qhalt=i $(if $(filter yes,$(OPTIMIZE)),-O2 -DNDEBUG,-g) +static_targetdir = $(if $(and $(filter-out %/build,$5),$(filter $($1_target),program)),,static) + +platform_cxx = $(COMPILER) +platform_ld = $(COMPILER) ifeq ($(embedded_runpath),yes) # @@ -33,25 +36,108 @@ ifeq ($(embedded_runpath),yes) endif endif -depend-cppflags = -qmakedep=gcc -MF $1 -rpath-ldflag = -Wl,-blibpath:$1:/usr/lib - -# $(call mklib,$1=target,$2=objects,$3=libname,$4=version,$5=soversion,$6=ldflags,$7=platform) -mklib = $(or $($7_ar),$(AR)) -X32_64 cr $1 $2 - -# $(call mkshlib,$1=target,$2=objects,$3=libname,$4=version,$5=soversion,$6=ldflags,$7=platform) -tmpsofile = $(dir $1)lib$2.so$(if $3,.$3) -mkshlib ?= $(platform_cxx) -qmkshrobj -o $(call tmpsofile,$1,$3,$5) $2 $6 && \ - $(platform_ar) -X32_64 cr $1 $(call tmpsofile,$1,$3,$5) && \ - rm $(call tmpsofile,$1,$3,$5) - # # $(call mkxxx,$1=libname,$2=version,$3=soversion) # mkshlibfilename = lib$(1).a - mkpymodulename = $(1).so +# $(call mklib,$1=target,$2=objects,$3=libname,$4=version,$5=soversion,$6=ldflags,$7=platform) +mklib = $(or $($7_ar),$(AR)) -X32_64 crs $1 $2 + Ice_system_libs = -lcrypto IceSSL_system_libs = -lssl -lcrypto Glacier2CryptPermissionsVerifier_system_libs = -lcrypt + +# Disabled, AIX doesn't support rpath +rpath-ldflag := + +# +# Compute the libpath ldflag to add when when linking an executable/library. We +# go through the dependencies and add the libpath directories for 3rd party +# libraries. When then append the global libpath variable. +# +make-lib-libpath = $(call unique,$(foreach d,$1 $(call get-all-deps,$1),$(foreach l,$($d_libs),$($l_libpath))) $2) +shared_ldflags = -Wl,-blibpath:$$(call join-with,:,$$(call make-lib-libpath,$4,$(subst :,$(space),$(libpath)))) +static_ldflags = -Wl,-blibpath:$$(call join-with,:,$$(call make-lib-libpath,$4,$(subst :,$(space),$(libpath)))) + +# +# Compiler-specific section +# +ifeq ($(COMPILER),g++) + +# It's critical to list /opt/freeware/lib/pthread first to get the thread-safe version +# of the C++ library runtime. +# Note that rpath-ldflag is not usable on AIX as unlike the Linux version, -blibpath is not cumulative +# and the last option wins. +# +ifeq ($(embedded_runpath),yes) + libpath = /opt/freeware/lib/pthread:$(embedded_runpath_prefix)/lib:/opt/freeware/lib:/usr/lib +else + libpath = /opt/freeware/lib/pthread:/opt/freeware/lib:/usr/lib +endif + +ppc_cppflags = -maix32 -D_LARGE_FILES -pthread +ppc_ldflags = $(ppc_cppflags) +ppc64_cppflags = -maix64 -pthread +ppc64_ldflags = $(ppc64_cppflags) + +shared_cppflags = $(if $(filter-out program,$($1_target)),-fPIC,-fPIE) -fvisibility=hidden + +cppflags = $(if $(filter yes,$(OPTIMIZE)),-O2 -DNDEBUG,-g) +nodeprecatedwarnings-cppflags := -Wno-deprecated-declarations + +# $(call mkshlib,$1=target,$2=objects,$3=libname,$4=version,$5=soversion,$6=ldflags,$7=platform) +tmpsofile = $(dir $1)lib$2.so$(if $3,.$3) +mkshlib ?= $(platform_cxx) -shared -o $(call tmpsofile,$1,$3,$5) $2 $6 && \ + $(platform_ar) -X32_64 crs $1 $(call tmpsofile,$1,$3,$5) && \ + rm $(call tmpsofile,$1,$3,$5) + +else + +ifeq ($(embedded_runpath),yes) + libpath = $(embedded_runpath_prefix)/lib:/usr/lib +else + libpath = /usr/lib +endif + +ppc_cppflags = -q32 -D_LARGE_FILES +ppc_ldflags = $(ppc_cppflags) +ppc64_cppflags = -q64 +ppc64_ldflags = $(ppc64_cppflags) + +shared_cppflags = $(if $(filter-out program,$($1_target)),-qpic,) + +ifeq ($(COMPILER),xlC_r) + # Used to suppress warnings in generated code + xlc_compiler = yes +endif + +cppflags = $(if $(filter yes,$(OPTIMIZE)),-O2 -qmaxmem=-1 -DNDEBUG,-g) + +ifeq ($(COMPILER),xlC_r) + cppflags += -qrtti -qstaticinline -qhalt=i +else ifeq ($(COMPILER),xlclang++) + cppflags += -mcpu=pwr8 -Werror + nodeprecatedwarnings-cppflags := -Wno-deprecated-declarations +endif + +depend-cppflags = -qmakedep=gcc -MF $1 + +# $(call mkshlib,$1=target,$2=objects,$3=libname,$4=version,$5=soversion,$6=ldflags,$7=platform) +tmpsofile = $(dir $1)lib$2.so$(if $3,.$3) +mkshlib ?= $(platform_cxx) -qmkshrobj -o $(call tmpsofile,$1,$3,$5) $2 $6 && \ + $(platform_ar) -X32_64 crs $1 $(call tmpsofile,$1,$3,$5) && \ + rm $(call tmpsofile,$1,$3,$5) + +ifeq ($(iconv_home),) +# Make sure we load /usr/lib/libiconv +iconv_libpath = /usr/lib +endif + +ifeq ($(expat_home),) +# Add /opt/freeware/lib/pthread to libpath for libgcc_s +expat_libpath = /opt/freeware/lib/pthread +endif + +endif 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) diff --git a/csharp/Makefile b/csharp/Makefile index f0dc5088e0c..33c59414242 100644 --- a/csharp/Makefile +++ b/csharp/Makefile @@ -2,14 +2,16 @@ # Copyright (c) ZeroC, Inc. All rights reserved. # +DOTNETARGS = $(if $(filter $(OPTIMIZE),no),/p:Configuration=Debug) + all: - dotnet msbuild msbuild/ice.proj /m + dotnet msbuild msbuild/ice.proj $(DOTNETARGS) /m tests: - dotnet msbuild msbuild/ice.proj /m + dotnet msbuild msbuild/ice.proj $(DOTNETARGS) /m srcs: - dotnet msbuild msbuild/ice.proj /t:BuildDist /m + dotnet msbuild msbuild/ice.proj $(DOTNETARGS) /t:BuildDist /m distclean clean: dotnet msbuild msbuild/ice.proj /t:Clean /m diff --git a/csharp/src/Ice/DispatchInterceptor.cs b/csharp/src/Ice/DispatchInterceptor.cs index 665b504ef3e..54e39251ac6 100644 --- a/csharp/src/Ice/DispatchInterceptor.cs +++ b/csharp/src/Ice/DispatchInterceptor.cs @@ -26,7 +26,23 @@ namespace Ice public override System.Threading.Tasks.Task<OutputStream> iceDispatch(IceInternal.Incoming inc, Current current) { - return dispatch(inc); + try + { + return dispatch(inc); + } + catch(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(current.encoding == null || (current.encoding.major == 0 && current.encoding.minor == 0)) + { + inc.skipReadParams(); + } + throw; + } } } } diff --git a/csharp/src/Ice/Incoming.cs b/csharp/src/Ice/Incoming.cs index 621099d773b..c467f67c349 100644 --- a/csharp/src/Ice/Incoming.cs +++ b/csharp/src/Ice/Incoming.cs @@ -268,17 +268,27 @@ namespace IceInternal { if(task == null) { - _os = startWriteParams(); - write(_os, default(R)); - endWriteParams(_os); - return null; // Response is cached in the Incoming to not have to create unecessary Task + // + // Write default constructed response if no task is provided + // + var os = startWriteParams(); + write(os, default(R)); + endWriteParams(os); + return setResult(os); } else { + var cached = getAndClearCachedOutputStream(); // If an output stream is cached, re-use it + + // + // NOTE: it's important that the continuation doesn't mutate the Incoming state to + // guarantee thread-safety. Multiple continuations can execute concurrently if the + // user installed a dispatch interceptor and the dispatch is retried. + // return task.ContinueWith((Task<R> t) => { var result = t.GetAwaiter().GetResult(); - var os = startWriteParams(); + var os = startWriteParams(cached); write(os, result); endWriteParams(os); return Task.FromResult(os); @@ -290,15 +300,24 @@ namespace IceInternal { if(task == null) { - _os = writeEmptyParams(); - return null; + // + // Write response if no task is provided + // + return setResult(writeEmptyParams()); } else { + var cached = getAndClearCachedOutputStream(); // If an output stream is cached, re-use it + + // + // NOTE: it's important that the continuation doesn't mutate the Incoming state to + // guarantee thread-safety. Multiple continuations can execute concurrently if the + // user installed a dispatch interceptor and the dispatch is retried. + // return task.ContinueWith((Task t) => { t.GetAwaiter().GetResult(); - return Task.FromResult(writeEmptyParams()); + return Task.FromResult(writeEmptyParams(cached)); }, TaskContinuationOptions.ExecuteSynchronously).Unwrap(); } } @@ -307,11 +326,15 @@ namespace IceInternal { if(task == null) { - _os = default(T).getOutputStream(_current); - return null; // Response is cached in the Incoming to not have to create unecessary Task + return setResult(default(T).getOutputStream(_current)); } else { + // + // NOTE: it's important that the continuation doesn't mutate the Incoming state to + // guarantee thread-safety. Multiple continuations can execute concurrently if the + // user installed a dispatch interceptor and the dispatch is retried. + // return task.ContinueWith((Task<T> t) => { return Task.FromResult(t.GetAwaiter().GetResult().getOutputStream(_current)); @@ -432,6 +455,20 @@ namespace IceInternal _format = format; } + public Ice.OutputStream getAndClearCachedOutputStream() + { + if(_response) + { + var cached = _os; + _os = null; + return cached; + } + else + { + return null; // Don't consume unnecessarily the output stream if we are dispatching a oneway request + } + } + static public Ice.OutputStream createResponseOutputStream(Ice.Current current) { var os = new Ice.OutputStream(current.adapter.getCommunicator(), Ice.Util.currentProtocolEncoding); @@ -441,17 +478,18 @@ namespace IceInternal return os; } - public Ice.OutputStream startWriteParams() + private Ice.OutputStream startWriteParams(Ice.OutputStream os) { if(!_response) { throw new Ice.MarshalException("can't marshal out parameters for oneway dispatch"); } - // If there's an output stream set, re-use it for the response - var os = _os == null ? new Ice.OutputStream(_instance, Ice.Util.currentProtocolEncoding) : _os; + if(os == null) // Create the output stream if none is provided + { + os = new Ice.OutputStream(_instance, Ice.Util.currentProtocolEncoding); + } Debug.Assert(os.pos() == 0); - _os = null; os.writeBlob(Protocol.replyHdr); os.writeInt(_current.requestId); os.writeByte(ReplyStatus.replyOK); @@ -459,6 +497,11 @@ namespace IceInternal return os; } + public Ice.OutputStream startWriteParams() + { + return startWriteParams(getAndClearCachedOutputStream()); + } + public void endWriteParams(Ice.OutputStream os) { if(_response) @@ -467,14 +510,15 @@ namespace IceInternal } } - public Ice.OutputStream writeEmptyParams() + private Ice.OutputStream writeEmptyParams(Ice.OutputStream os) { if(_response) { - // If there's an output stream set, re-use it for the response - var os = _os == null ? new Ice.OutputStream(_instance, Ice.Util.currentProtocolEncoding) : _os; + if(os == null) // Create the output stream if none is provided + { + os = new Ice.OutputStream(_instance, Ice.Util.currentProtocolEncoding); + } Debug.Assert(os.pos() == 0); - _os = null; os.writeBlob(Protocol.replyHdr); os.writeInt(_current.requestId); os.writeByte(ReplyStatus.replyOK); @@ -487,7 +531,12 @@ namespace IceInternal } } - public Ice.OutputStream writeParamEncaps(byte[] v, bool ok) + public Ice.OutputStream writeEmptyParams() + { + return writeEmptyParams(getAndClearCachedOutputStream()); + } + + public Ice.OutputStream writeParamEncaps(Ice.OutputStream os, byte[] v, bool ok) { if(!ok && _observer != null) { @@ -496,10 +545,11 @@ namespace IceInternal if(_response) { - // If there's an output stream set, re-use it for the response - var os = _os == null ? new Ice.OutputStream(_instance, Ice.Util.currentProtocolEncoding) : _os; + if(os == null) // Create the output stream if none is provided + { + os = new Ice.OutputStream(_instance, Ice.Util.currentProtocolEncoding); + } Debug.Assert(os.pos() == 0); - _os = null; os.writeBlob(Protocol.replyHdr); os.writeInt(_current.requestId); os.writeByte(ok ? ReplyStatus.replyOK : ReplyStatus.replyUserException); diff --git a/csharp/src/Ice/Object.cs b/csharp/src/Ice/Object.cs index dd9913ba5f3..78f776e671b 100644 --- a/csharp/src/Ice/Object.cs +++ b/csharp/src/Ice/Object.cs @@ -310,7 +310,7 @@ namespace Ice byte[] inEncaps = inS.readParamEncaps(); byte[] outEncaps; bool ok = ice_invoke(inEncaps, out outEncaps, current); - inS.setResult(inS.writeParamEncaps(outEncaps, ok)); + inS.setResult(inS.writeParamEncaps(inS.getAndClearCachedOutputStream(), outEncaps, ok)); return null; } } @@ -323,10 +323,12 @@ namespace Ice public override Task<Ice.OutputStream> iceDispatch(IceInternal.Incoming inS, Current current) { byte[] inEncaps = inS.readParamEncaps(); - return ice_invokeAsync(inEncaps, current).ContinueWith((Task<Object_Ice_invokeResult> t) => + var task = ice_invokeAsync(inEncaps, current); + var cached = inS.getAndClearCachedOutputStream(); + return task.ContinueWith((Task<Object_Ice_invokeResult> t) => { var ret = t.GetAwaiter().GetResult(); - return Task.FromResult(inS.writeParamEncaps(ret.outEncaps, ret.returnValue)); + return Task.FromResult(inS.writeParamEncaps(cached, ret.outEncaps, ret.returnValue)); }).Unwrap(); } } diff --git a/csharp/test/Ice/interceptor/Client.cs b/csharp/test/Ice/interceptor/Client.cs index a459ee8fb65..efdc4a6db83 100644 --- a/csharp/test/Ice/interceptor/Client.cs +++ b/csharp/test/Ice/interceptor/Client.cs @@ -3,6 +3,7 @@ // using System; +using System.Collections.Generic; using Test; namespace Ice @@ -89,6 +90,11 @@ namespace Ice test(interceptor.getLastOperation().Equals("badSystemAdd")); test(!interceptor.getLastStatus()); output.WriteLine("ok"); + + output.Write("testing exceptions raised by the interceptor... "); + output.Flush(); + testInterceptorExceptions(prx); + output.WriteLine("ok"); } private void runAmdTest(Test.MyObjectPrx prx, InterceptorI interceptor) @@ -108,6 +114,18 @@ namespace Ice test(prx.amdAddWithRetry(33, 12) == 45); test(interceptor.getLastOperation().Equals("amdAddWithRetry")); test(interceptor.getLastStatus()); + + { + var ctx = new Dictionary<string, string>(); + ctx.Add("retry", "yes"); + for(int i = 0; i < 10; ++i) + { + test(prx.amdAdd(33, 12, ctx) == 45); + test(interceptor.getLastOperation().Equals("amdAdd")); + test(interceptor.getLastStatus()); + } + } + output.WriteLine("ok"); output.Write("testing user exception... "); @@ -163,6 +181,11 @@ namespace Ice test(interceptor.getLastOperation().Equals("amdBadSystemAdd")); test(interceptor.getLastStatus()); output.WriteLine("ok"); + + output.Write("testing exceptions raised by the interceptor... "); + output.Flush(); + testInterceptorExceptions(prx); + output.WriteLine("ok"); } public override void run(string[] args) @@ -206,6 +229,54 @@ namespace Ice { return TestDriver.runTest<Client>(args); } + + private void testInterceptorExceptions(Test.MyObjectPrx prx) + { + var exceptions = new List<Tuple<string, string>>(); + exceptions.Add(new Tuple<string, string>("raiseBeforeDispatch", "user")); + exceptions.Add(new Tuple<string, string>("raiseBeforeDispatch", "notExist")); + exceptions.Add(new Tuple<string, string>("raiseBeforeDispatch", "system")); + exceptions.Add(new Tuple<string, string>("raiseAfterDispatch", "user")); + exceptions.Add(new Tuple<string, string>("raiseAfterDispatch", "notExist")); + exceptions.Add(new Tuple<string, string>("raiseAfterDispatch", "system")); + foreach(var e in exceptions) + { + var ctx = new Dictionary<string, string>(); + ctx.Add(e.Item1, e.Item2); + try + { + prx.ice_ping(ctx); + test(false); + } + catch(Ice.UnknownUserException) + { + test(e.Item2.Equals("user")); + } + catch(Ice.ObjectNotExistException) + { + test(e.Item2.Equals("notExist")); + } + catch(Ice.UnknownException) + { + test(e.Item2.Equals("system")); // non-collocated + } + catch(MySystemException) + { + test(e.Item2.Equals("system")); // collocated + } + { + Ice.ObjectPrx 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(); + } + } + } } } } diff --git a/csharp/test/Ice/interceptor/InterceptorI.cs b/csharp/test/Ice/interceptor/InterceptorI.cs index 19d33bbbb58..c3f88efd13a 100644 --- a/csharp/test/Ice/interceptor/InterceptorI.cs +++ b/csharp/test/Ice/interceptor/InterceptorI.cs @@ -29,6 +29,24 @@ namespace Ice dispatch(Ice.Request request) { Ice.Current current = request.getCurrent(); + + string context; + if(current.ctx.TryGetValue("raiseBeforeDispatch", out context)) + { + if(context.Equals("user")) + { + throw new Test.InvalidInputException(); + } + else if(context.Equals("notExist")) + { + throw new Ice.ObjectNotExistException(); + } + else if(context.Equals("system")) + { + throw new MySystemException(); + } + } + lastOperation_ = current.operation; if(lastOperation_.Equals("addWithRetry") || lastOperation_.Equals("amdAddWithRetry")) @@ -57,9 +75,35 @@ namespace Ice current.ctx["retry"] = "no"; } + else if(current.ctx.TryGetValue("retry", out context) && context.Equals("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); + } var task = servant_.ice_dispatch(request); lastStatus_ = task != null; + + if(current.ctx.TryGetValue("raiseAfterDispatch", out context)) + { + if(context.Equals("user")) + { + throw new Test.InvalidInputException(); + } + else if(context.Equals("notExist")) + { + throw new Ice.ObjectNotExistException(); + } + else if(context.Equals("system")) + { + throw new MySystemException(); + } + } + return task; } diff --git a/csharp/test/Ice/metrics/AllTests.cs b/csharp/test/Ice/metrics/AllTests.cs index 387a276b248..31326ba9c53 100644 --- a/csharp/test/Ice/metrics/AllTests.cs +++ b/csharp/test/Ice/metrics/AllTests.cs @@ -914,7 +914,7 @@ public class AllTests : Test.AllTests // Tests for twoway // 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"] = "id"; updateProps(clientProps, serverProps, update, props, "Invocation"); test(serverMetrics.getMetricsView("View", out timestamp)["Invocation"].Length == 0); @@ -1071,19 +1071,9 @@ public class AllTests : Test.AllTests if(!collocated) { im1 = (IceMX.InvocationMetrics)map["fail"]; - if(!(im1.current <= 1 && im1.total == 3 && im1.failures == 3 && im1.retry == 3 && im1.remotes.Length == 6)) - { - System.Console.Error.WriteLine("current: " + im1.current + " total: " + im1.total + - " failures: " + im1.failures + " retry: " + im1.retry + - " remotes: " + im1.remotes.Length); - test(false); - } - 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.Length == 1); + rim1 = (IceMX.ChildInvocationMetrics)(collocated ? im1.collocated[0] : im1.remotes[0]); + test(rim1.current == 0 && rim1.total == 6 && rim1.failures == 6); checkFailure(clientMetrics, "Invocation", im1.id, "::Ice::ConnectionLostException", 3, output); } @@ -50,7 +50,7 @@ <Properties>Platform=$(Platform);Configuration=$(Configuration)</Properties> </Projects> - <Projects Include="$(MSBuildThisFileDirectory)python\msbuild\ice.proj" Condition="'$(DefaultPlatformToolset)' == 'v140'"> + <Projects Include="$(MSBuildThisFileDirectory)python\msbuild\ice.proj" Condition="'$(DefaultPlatformToolset)' == 'v140' or '$(DefaultPlatformToolset)' == 'v141'"> <Properties>Platform=$(Platform);Configuration=$(Configuration)</Properties> </Projects> </ItemGroup> diff --git a/java-compat/gradle/wrapper/gradle-wrapper.jar b/java-compat/gradle/wrapper/gradle-wrapper.jar Binary files differindex ed88a042a28..94336fcae91 100644 --- a/java-compat/gradle/wrapper/gradle-wrapper.jar +++ b/java-compat/gradle/wrapper/gradle-wrapper.jar diff --git a/java-compat/gradle/wrapper/gradle-wrapper.properties b/java-compat/gradle/wrapper/gradle-wrapper.properties index fb7ef980f26..290541c7386 100644 --- a/java-compat/gradle/wrapper/gradle-wrapper.properties +++ b/java-compat/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.3-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.2-bin.zip diff --git a/java-compat/src/Ice/src/main/java/Ice/DispatchInterceptor.java b/java-compat/src/Ice/src/main/java/Ice/DispatchInterceptor.java index 8735ff7eea6..355e81dd354 100644 --- a/java-compat/src/Ice/src/main/java/Ice/DispatchInterceptor.java +++ b/java-compat/src/Ice/src/main/java/Ice/DispatchInterceptor.java @@ -43,5 +43,18 @@ public abstract class DispatchInterceptor extends ObjectImpl { return false; } + catch(java.lang.Throwable ex) + { + // + // 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(current.encoding == null || (current.encoding.major == 0 && current.encoding.minor == 0)) + { + in.skipReadParams(); + } + throw ex; + } } } diff --git a/java-compat/test/src/main/java/test/Ice/interceptor/AMDInterceptorI.java b/java-compat/test/src/main/java/test/Ice/interceptor/AMDInterceptorI.java index ffade5fbac4..db208419d44 100644 --- a/java-compat/test/src/main/java/test/Ice/interceptor/AMDInterceptorI.java +++ b/java-compat/test/src/main/java/test/Ice/interceptor/AMDInterceptorI.java @@ -5,6 +5,7 @@ package test.Ice.interceptor; import test.Ice.interceptor.Test.RetryException; +import test.Ice.interceptor.Test.InvalidInputException; // // A dispatch interceptor with special handling for AMD requests @@ -23,6 +24,24 @@ class AMDInterceptorI extends InterceptorI implements Ice.DispatchInterceptorAsy throws Ice.UserException { Ice.Current current = request.getCurrent(); + + String context = current.ctx.get("raiseBeforeDispatch"); + if(context != null) + { + if(context.equals("user")) + { + throw new InvalidInputException(); + } + else if(context.equals("notExist")) + { + throw new Ice.ObjectNotExistException(); + } + else if(context.equals("system")) + { + throw new MySystemException(); + } + } + _lastOperation = current.operation; if(_lastOperation.equals("amdAddWithRetry")) @@ -51,8 +70,35 @@ class AMDInterceptorI extends InterceptorI implements Ice.DispatchInterceptorAsy request.getCurrent().ctx.put("retry", "no"); } + else if(current.ctx.get("retry") != null && current.ctx.get("retry").equals("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); + } _lastStatus = _servant.ice_dispatch(request, this); + + context = current.ctx.get("raiseAfterDispatch"); + if(context != null) + { + if(context.equals("user")) + { + throw new InvalidInputException(); + } + else if(context.equals("notExist")) + { + throw new Ice.ObjectNotExistException(); + } + else if(context.equals("system")) + { + throw new MySystemException(); + } + } + return _lastStatus; } diff --git a/java-compat/test/src/main/java/test/Ice/interceptor/Client.java b/java-compat/test/src/main/java/test/Ice/interceptor/Client.java index d029404145e..2c95ccfdc21 100644 --- a/java-compat/test/src/main/java/test/Ice/interceptor/Client.java +++ b/java-compat/test/src/main/java/test/Ice/interceptor/Client.java @@ -96,6 +96,11 @@ public class Client extends test.TestHelper test(interceptor.getLastOperation().equals("amdAdd")); test(!interceptor.getLastStatus()); out.println("ok"); + + out.print("testing exceptions raised by the interceptor... "); + out.flush(); + testInterceptorExceptions(prx); + out.println("ok"); } private void @@ -114,6 +119,16 @@ public class Client extends test.TestHelper test(prx.amdAddWithRetry(33, 12) == 45); test(interceptor.getLastOperation().equals("amdAddWithRetry")); test(!interceptor.getLastStatus()); + { + java.util.Map<String, String> ctx = new java.util.HashMap<>(); + ctx.put("retry", "yes"); + for(int i = 0; i < 10; ++i) + { + test(prx.amdAdd(33, 12, ctx) == 45); + test(interceptor.getLastOperation().equals("amdAdd")); + test(!interceptor.getLastStatus()); + } + } out.println("ok"); out.print("testing user exception... "); out.flush(); @@ -169,6 +184,11 @@ public class Client extends test.TestHelper test(!interceptor.getLastStatus()); test(interceptor.getException() instanceof MySystemException); out.println("ok"); + + out.print("testing exceptions raised by the interceptor... "); + out.flush(); + testInterceptorExceptions(prx); + out.println("ok"); } public void run(String[] args) @@ -210,4 +230,63 @@ public class Client extends test.TestHelper runAmdTest(prxForAMD, amdInterceptor, out); } } + + private class ExceptionPoint + { + public ExceptionPoint(String point, String exception) + { + this.point = point; + this.exception = exception; + } + public String point; + public String exception; + }; + + private void testInterceptorExceptions(MyObjectPrx prx) + { + java.util.List<ExceptionPoint> exceptions = new java.util.ArrayList<ExceptionPoint>(); + exceptions.add(new ExceptionPoint("raiseBeforeDispatch", "user")); + exceptions.add(new ExceptionPoint("raiseBeforeDispatch", "notExist")); + exceptions.add(new ExceptionPoint("raiseBeforeDispatch", "system")); + exceptions.add(new ExceptionPoint("raiseAfterDispatch", "user")); + exceptions.add(new ExceptionPoint("raiseAfterDispatch", "notExist")); + exceptions.add(new ExceptionPoint("raiseAfterDispatch", "system")); + for(ExceptionPoint e : exceptions) + { + java.util.Map<String, String> ctx = new java.util.HashMap<String, String>(); + ctx.put(e.point, e.exception); + try + { + prx.ice_ping(ctx); + test(false); + } + catch(Ice.UnknownUserException ex) + { + test(e.exception.equals("user")); + } + catch(Ice.ObjectNotExistException ex) + { + test(e.exception.equals("notExist")); + } + catch(Ice.UnknownException ex) + { + test(e.exception.equals("system")); // non-collocated + } + catch(MySystemException ex) + { + test(e.exception.equals("system")); // collocated + } + { + Ice.ObjectPrx 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(); + } + } + } } diff --git a/java-compat/test/src/main/java/test/Ice/interceptor/InterceptorI.java b/java-compat/test/src/main/java/test/Ice/interceptor/InterceptorI.java index 547234e705b..0c067d65d66 100644 --- a/java-compat/test/src/main/java/test/Ice/interceptor/InterceptorI.java +++ b/java-compat/test/src/main/java/test/Ice/interceptor/InterceptorI.java @@ -5,6 +5,7 @@ package test.Ice.interceptor; import test.Ice.interceptor.Test.RetryException; +import test.Ice.interceptor.Test.InvalidInputException; class InterceptorI extends Ice.DispatchInterceptor { @@ -28,6 +29,24 @@ class InterceptorI extends Ice.DispatchInterceptor throws Ice.UserException { Ice.Current current = request.getCurrent(); + + String context = current.ctx.get("raiseBeforeDispatch"); + if(context != null) + { + if(context.equals("user")) + { + throw new InvalidInputException(); + } + else if(context.equals("notExist")) + { + throw new Ice.ObjectNotExistException(); + } + else if(context.equals("system")) + { + throw new MySystemException(); + } + } + _lastOperation = current.operation; if(_lastOperation.equals("addWithRetry")) @@ -51,6 +70,24 @@ class InterceptorI extends Ice.DispatchInterceptor } _lastStatus = _servant.ice_dispatch(request); + + context = current.ctx.get("raiseAfterDispatch"); + if(context != null) + { + if(context.equals("user")) + { + throw new InvalidInputException(); + } + else if(context.equals("notExist")) + { + throw new Ice.ObjectNotExistException(); + } + else if(context.equals("system")) + { + throw new MySystemException(); + } + } + return _lastStatus; } diff --git a/java-compat/test/src/main/java/test/Ice/interceptor/MyObjectI.java b/java-compat/test/src/main/java/test/Ice/interceptor/MyObjectI.java index 1f60cb0adb8..cebd1882ccd 100644 --- a/java-compat/test/src/main/java/test/Ice/interceptor/MyObjectI.java +++ b/java-compat/test/src/main/java/test/Ice/interceptor/MyObjectI.java @@ -65,6 +65,7 @@ class MyObjectI extends _MyObjectDisp public void amdAdd_async(final AMD_MyObject_amdAdd cb, final int x, final int y, Ice.Current current) { + final boolean retry = current.ctx.get("retry") != null && current.ctx.get("retry").equals("yes"); Thread thread = new Thread() { @Override @@ -78,7 +79,17 @@ class MyObjectI extends _MyObjectDisp catch(InterruptedException e) { } - cb.ice_response(x + y); + try + { + cb.ice_response(x + y); + } + catch(Ice.ResponseSentException ex) + { + if(!retry) + { + throw ex; + } + } } }; diff --git a/java-compat/test/src/main/java/test/Ice/metrics/AllTests.java b/java-compat/test/src/main/java/test/Ice/metrics/AllTests.java index c4843c606b4..376c72a76af 100644 --- a/java-compat/test/src/main/java/test/Ice/metrics/AllTests.java +++ b/java-compat/test/src/main/java/test/Ice/metrics/AllTests.java @@ -977,7 +977,7 @@ public class AllTests out.flush(); props.put("IceMX.Metrics.View.Map.Invocation.GroupBy", "operation"); - props.put("IceMX.Metrics.View.Map.Invocation.Map.Remote.GroupBy", "localPort"); + props.put("IceMX.Metrics.View.Map.Invocation.Map.Remote.GroupBy", "id"); props.put("IceMX.Metrics.View.Map.Invocation.Map.Collocated.GroupBy", "id"); updateProps(clientProps, serverProps, update, props, "Invocation"); test(serverMetrics.getMetricsView("View", timestamp).get("Invocation").length == 0); @@ -1142,13 +1142,9 @@ public class AllTests if(!collocated) { im1 = (IceMX.InvocationMetrics)map.get("fail"); - test(im1.current <= 1 && im1.total == 3 && im1.failures == 3 && im1.retry == 3 && im1.remotes.length == 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.length == 1); + rim1 = (IceMX.ChildInvocationMetrics)im1.remotes[0]; + test(rim1.current == 0 && rim1.total == 6 && rim1.failures == 6); checkFailure(clientMetrics, "Invocation", im1.id, "::Ice::ConnectionLostException", 3, out); } diff --git a/java-compat/test/src/main/java/test/IceSSL/configuration/AllTests.java b/java-compat/test/src/main/java/test/IceSSL/configuration/AllTests.java index e4a57497ee6..8de74f60b51 100644 --- a/java-compat/test/src/main/java/test/IceSSL/configuration/AllTests.java +++ b/java-compat/test/src/main/java/test/IceSSL/configuration/AllTests.java @@ -1386,6 +1386,10 @@ public class AllTests { server.ice_ping(); } + catch(Ice.SecurityException ex) + { + // Expected on systems that disable DSA (EL8) + } catch(Ice.LocalException ex) { ex.printStackTrace(); @@ -1511,7 +1515,7 @@ public class AllTests } catch(Ice.ConnectionLostException ex) { - // Expected on systems that disable DSA + // Expected on systems that disable DSA (EL8) } catch(Ice.LocalException ex) { diff --git a/java/gradle/wrapper/gradle-wrapper.jar b/java/gradle/wrapper/gradle-wrapper.jar Binary files differindex 29953ea141f..94336fcae91 100644 --- a/java/gradle/wrapper/gradle-wrapper.jar +++ b/java/gradle/wrapper/gradle-wrapper.jar diff --git a/java/gradle/wrapper/gradle-wrapper.properties b/java/gradle/wrapper/gradle-wrapper.properties index e0b3fb8d70b..290541c7386 100644 --- a/java/gradle/wrapper/gradle-wrapper.properties +++ b/java/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.2-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.3-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/java/src/Ice/src/main/java/com/zeroc/Ice/Blobject.java b/java/src/Ice/src/main/java/com/zeroc/Ice/Blobject.java index e23f5e7e6a5..9d3637badaf 100644 --- a/java/src/Ice/src/main/java/com/zeroc/Ice/Blobject.java +++ b/java/src/Ice/src/main/java/com/zeroc/Ice/Blobject.java @@ -39,6 +39,6 @@ public interface Blobject extends com.zeroc.Ice.Object { byte[] inEncaps = in.readParamEncaps(); com.zeroc.Ice.Object.Ice_invokeResult r = ice_invoke(inEncaps, current); - return in.setResult(in.writeParamEncaps(r.outParams, r.returnValue)); + return in.setResult(in.writeParamEncaps(in.getAndClearCachedOutputStream(), r.outParams, r.returnValue)); } } diff --git a/java/src/Ice/src/main/java/com/zeroc/Ice/BlobjectAsync.java b/java/src/Ice/src/main/java/com/zeroc/Ice/BlobjectAsync.java index cb9ddadfd16..6a148071905 100644 --- a/java/src/Ice/src/main/java/com/zeroc/Ice/BlobjectAsync.java +++ b/java/src/Ice/src/main/java/com/zeroc/Ice/BlobjectAsync.java @@ -45,7 +45,9 @@ public interface BlobjectAsync extends com.zeroc.Ice.Object { byte[] inEncaps = in.readParamEncaps(); CompletableFuture<OutputStream> f = new CompletableFuture<>(); - ice_invokeAsync(inEncaps, current).whenComplete((result, ex) -> + CompletionStage<Object.Ice_invokeResult> s = ice_invokeAsync(inEncaps, current); + final OutputStream cached = in.getAndClearCachedOutputStream(); // If an output stream is cached, re-use it + s.whenComplete((result, ex) -> { if(ex != null) { @@ -53,7 +55,7 @@ public interface BlobjectAsync extends com.zeroc.Ice.Object } else { - f.complete(in.writeParamEncaps(result.outParams, result.returnValue)); + f.complete(in.writeParamEncaps(cached, result.outParams, result.returnValue)); } }); return f; diff --git a/java/src/Ice/src/main/java/com/zeroc/Ice/DispatchInterceptor.java b/java/src/Ice/src/main/java/com/zeroc/Ice/DispatchInterceptor.java index d825707630e..8523bdc929d 100644 --- a/java/src/Ice/src/main/java/com/zeroc/Ice/DispatchInterceptor.java +++ b/java/src/Ice/src/main/java/com/zeroc/Ice/DispatchInterceptor.java @@ -36,6 +36,22 @@ public abstract class DispatchInterceptor implements com.zeroc.Ice.Object public CompletionStage<OutputStream> _iceDispatch(com.zeroc.IceInternal.Incoming in, Current current) throws UserException { - return dispatch(in); + try + { + return dispatch(in); + } + catch(java.lang.Throwable ex) + { + // + // 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(current.encoding == null || (current.encoding.major == 0 && current.encoding.minor == 0)) + { + in.skipReadParams(); + } + throw ex; + } } } diff --git a/java/src/Ice/src/main/java/com/zeroc/IceInternal/Incoming.java b/java/src/Ice/src/main/java/com/zeroc/IceInternal/Incoming.java index dc5a60d390a..f8d899ae365 100644 --- a/java/src/Ice/src/main/java/com/zeroc/IceInternal/Incoming.java +++ b/java/src/Ice/src/main/java/com/zeroc/IceInternal/Incoming.java @@ -271,6 +271,13 @@ final public class Incoming implements com.zeroc.Ice.Request public <T> CompletionStage<OutputStream> setResultFuture(CompletionStage<T> f, Write<T> write) { + final OutputStream cached = getAndClearCachedOutputStream(); // If an output stream is cached, re-use it + + // + // NOTE: it's important that the continuation doesn't mutate the Incoming state to + // guarantee thread-safety. Multiple continuations can execute concurrently if the + // user installed a dispatch interceptor and the dispatch is retried. + // final CompletableFuture<OutputStream> r = new CompletableFuture<OutputStream>(); f.whenComplete((result, ex) -> { @@ -280,7 +287,7 @@ final public class Incoming implements com.zeroc.Ice.Request } else { - OutputStream os = startWriteParams(); + OutputStream os = startWriteParams(cached); write.write(os, result); endWriteParams(os); r.complete(os); @@ -291,6 +298,13 @@ final public class Incoming implements com.zeroc.Ice.Request public CompletionStage<OutputStream> setResultFuture(CompletionStage<Void> f) { + final OutputStream cached = getAndClearCachedOutputStream(); // If an output stream is cached, re-use it + + // + // NOTE: it's important that the continuation doesn't mutate the Incoming state to + // guarantee thread-safety. Multiple continuations can execute concurrently if the + // user installed a dispatch interceptor and the dispatch is retried. + // final CompletableFuture<OutputStream> r = new CompletableFuture<OutputStream>(); f.whenComplete((result, ex) -> { @@ -300,7 +314,7 @@ final public class Incoming implements com.zeroc.Ice.Request } else { - r.complete(writeEmptyParams()); + r.complete(writeEmptyParams(cached)); } }); return r; @@ -448,6 +462,20 @@ final public class Incoming implements com.zeroc.Ice.Request _format = format; } + public OutputStream getAndClearCachedOutputStream() + { + if(_response) + { + OutputStream cached = _os; + _os = null; + return cached; + } + else + { + return null; // Don't consume unnecessarily the output stream if we are dispatching a oneway request + } + } + static public OutputStream createResponseOutputStream(Current current) { OutputStream os = new OutputStream(current.adapter.getCommunicator(), Protocol.currentProtocolEncoding); @@ -457,17 +485,18 @@ final public class Incoming implements com.zeroc.Ice.Request return os; } - public OutputStream startWriteParams() + private OutputStream startWriteParams(OutputStream os) { if(!_response) { throw new com.zeroc.Ice.MarshalException("can't marshal out parameters for oneway dispatch"); } - // If there's an output stream set, re-use it for the response - OutputStream os = _os == null ? new OutputStream(_instance, Protocol.currentProtocolEncoding) : _os; + if(os == null) // Create the output stream if none is provided + { + os = new OutputStream(_instance, Protocol.currentProtocolEncoding); + } assert(os.pos() == 0); - _os = null; os.writeBlob(Protocol.replyHdr); os.writeInt(_current.requestId); os.writeByte(ReplyStatus.replyOK); @@ -475,6 +504,11 @@ final public class Incoming implements com.zeroc.Ice.Request return os; } + public OutputStream startWriteParams() + { + return startWriteParams(getAndClearCachedOutputStream()); + } + public void endWriteParams(OutputStream os) { if(_response) @@ -483,14 +517,15 @@ final public class Incoming implements com.zeroc.Ice.Request } } - public OutputStream writeEmptyParams() + private OutputStream writeEmptyParams(OutputStream os) { if(_response) { - // If there's an output stream set, re-use it for the response - OutputStream os = _os == null ? new OutputStream(_instance, Protocol.currentProtocolEncoding) : _os; + if(os == null) // Create the output stream if none is provided + { + os = new OutputStream(_instance, Protocol.currentProtocolEncoding); + } assert(os.pos() == 0); - _os = null; os.writeBlob(Protocol.replyHdr); os.writeInt(_current.requestId); os.writeByte(ReplyStatus.replyOK); @@ -503,7 +538,12 @@ final public class Incoming implements com.zeroc.Ice.Request } } - public OutputStream writeParamEncaps(byte[] v, boolean ok) + public OutputStream writeEmptyParams() + { + return writeEmptyParams(getAndClearCachedOutputStream()); + } + + public OutputStream writeParamEncaps(OutputStream os, byte[] v, boolean ok) { if(!ok && _observer != null) { @@ -512,10 +552,11 @@ final public class Incoming implements com.zeroc.Ice.Request if(_response) { - // If there's an output stream set, re-use it for the response - OutputStream os = _os == null ? new OutputStream(_instance, Protocol.currentProtocolEncoding) : _os; + if(os == null) // Create the output stream if none is provided + { + os = new OutputStream(_instance, Protocol.currentProtocolEncoding); + } assert(os.pos() == 0); - _os = null; os.writeBlob(Protocol.replyHdr); os.writeInt(_current.requestId); os.writeByte(ok ? ReplyStatus.replyOK : ReplyStatus.replyUserException); diff --git a/java/test/android/controller/build.gradle b/java/test/android/controller/build.gradle index 2e5f8ca9e75..e8f9040f821 100644 --- a/java/test/android/controller/build.gradle +++ b/java/test/android/controller/build.gradle @@ -11,7 +11,7 @@ buildscript { } } dependencies { - classpath 'com.android.tools.build:gradle:3.2.1' + classpath 'com.android.tools.build:gradle:3.4.2' classpath 'gradle.plugin.com.zeroc.gradle.ice-builder:slice:1.4.7' } } diff --git a/java/test/android/controller/gradle/wrapper/gradle-wrapper.jar b/java/test/android/controller/gradle/wrapper/gradle-wrapper.jar Binary files differindex 29953ea141f..87b738cbd05 100644 --- a/java/test/android/controller/gradle/wrapper/gradle-wrapper.jar +++ b/java/test/android/controller/gradle/wrapper/gradle-wrapper.jar diff --git a/java/test/android/controller/gradle/wrapper/gradle-wrapper.properties b/java/test/android/controller/gradle/wrapper/gradle-wrapper.properties index e0b3fb8d70b..558870dad58 100644 --- a/java/test/android/controller/gradle/wrapper/gradle-wrapper.properties +++ b/java/test/android/controller/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.2-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-5.1.1-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/java/test/android/controller/gradlew b/java/test/android/controller/gradlew index cccdd3d517f..af6708ff229 100755 --- a/java/test/android/controller/gradlew +++ b/java/test/android/controller/gradlew @@ -28,7 +28,7 @@ APP_NAME="Gradle" APP_BASE_NAME=`basename "$0"` # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS="" +DEFAULT_JVM_OPTS='"-Xmx64m"' # Use the maximum available, or set MAX_FD != -1 to use that value. MAX_FD="maximum" diff --git a/java/test/android/controller/gradlew.bat b/java/test/android/controller/gradlew.bat index f9553162f12..6d57edc706c 100644 --- a/java/test/android/controller/gradlew.bat +++ b/java/test/android/controller/gradlew.bat @@ -14,7 +14,7 @@ set APP_BASE_NAME=%~n0 set APP_HOME=%DIRNAME% @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -set DEFAULT_JVM_OPTS= +set DEFAULT_JVM_OPTS="-Xmx64m" @rem Find java.exe if defined JAVA_HOME goto findJavaFromJavaHome diff --git a/java/test/android/controller/settings.gradle b/java/test/android/controller/settings.gradle new file mode 100644 index 00000000000..e69de29bb2d --- /dev/null +++ b/java/test/android/controller/settings.gradle diff --git a/java/test/src/main/java/test/Ice/interceptor/Client.java b/java/test/src/main/java/test/Ice/interceptor/Client.java index 9bd89a14661..bbb62f152b9 100644 --- a/java/test/src/main/java/test/Ice/interceptor/Client.java +++ b/java/test/src/main/java/test/Ice/interceptor/Client.java @@ -89,6 +89,11 @@ public class Client extends test.TestHelper test(interceptor.getLastOperation().equals("badSystemAdd")); test(!interceptor.getLastStatus()); out.println("ok"); + + out.print("testing exceptions raised by the interceptor... "); + out.flush(); + testInterceptorExceptions(prx); + out.println("ok"); } private void runAmdTest(MyObjectPrx prx, InterceptorI interceptor, PrintWriter out) @@ -106,6 +111,16 @@ public class Client extends test.TestHelper test(prx.amdAddWithRetry(33, 12) == 45); test(interceptor.getLastOperation().equals("amdAddWithRetry")); test(interceptor.getLastStatus()); + { + java.util.Map<String, String> ctx = new java.util.HashMap<>(); + ctx.put("retry", "yes"); + for(int i = 0; i < 10; ++i) + { + test(prx.amdAdd(33, 12, ctx) == 45); + test(interceptor.getLastOperation().equals("amdAdd")); + test(interceptor.getLastStatus()); + } + } out.println("ok"); out.print("testing user exception... "); out.flush(); @@ -159,6 +174,11 @@ public class Client extends test.TestHelper test(interceptor.getLastOperation().equals("amdBadSystemAdd")); test(interceptor.getLastStatus()); out.println("ok"); + + out.print("testing exceptions raised by the interceptor... "); + out.flush(); + testInterceptorExceptions(prx); + out.println("ok"); } public void run(String[] args) @@ -197,4 +217,63 @@ public class Client extends test.TestHelper runAmdTest(prx, interceptor, out); } } + + private class ExceptionPoint + { + public ExceptionPoint(String point, String exception) + { + this.point = point; + this.exception = exception; + } + public String point; + public String exception; + }; + + private void testInterceptorExceptions(MyObjectPrx prx) + { + java.util.List<ExceptionPoint> exceptions = new java.util.ArrayList<>(); + exceptions.add(new ExceptionPoint("raiseBeforeDispatch", "user")); + exceptions.add(new ExceptionPoint("raiseBeforeDispatch", "notExist")); + exceptions.add(new ExceptionPoint("raiseBeforeDispatch", "system")); + exceptions.add(new ExceptionPoint("raiseAfterDispatch", "user")); + exceptions.add(new ExceptionPoint("raiseAfterDispatch", "notExist")); + exceptions.add(new ExceptionPoint("raiseAfterDispatch", "system")); + for(ExceptionPoint e : exceptions) + { + java.util.Map<String, String> ctx = new java.util.HashMap<>(); + ctx.put(e.point, e.exception); + try + { + prx.ice_ping(ctx); + test(false); + } + catch(com.zeroc.Ice.UnknownUserException ex) + { + test(e.exception.equals("user")); + } + catch(com.zeroc.Ice.ObjectNotExistException ex) + { + test(e.exception.equals("notExist")); + } + catch(com.zeroc.Ice.UnknownException ex) + { + test(e.exception.equals("system")); // non-collocated + } + catch(MySystemException ex) + { + test(e.exception.equals("system")); // collocated + } + { + com.zeroc.Ice.ObjectPrx 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(); + } + } + } } diff --git a/java/test/src/main/java/test/Ice/interceptor/InterceptorI.java b/java/test/src/main/java/test/Ice/interceptor/InterceptorI.java index 2437717ecb1..afd5597f6b0 100644 --- a/java/test/src/main/java/test/Ice/interceptor/InterceptorI.java +++ b/java/test/src/main/java/test/Ice/interceptor/InterceptorI.java @@ -9,6 +9,7 @@ import java.util.concurrent.CompletionStage; import com.zeroc.Ice.OutputStream; import test.Ice.interceptor.Test.RetryException; +import test.Ice.interceptor.Test.InvalidInputException; class InterceptorI extends com.zeroc.Ice.DispatchInterceptor { @@ -30,6 +31,24 @@ class InterceptorI extends com.zeroc.Ice.DispatchInterceptor throws com.zeroc.Ice.UserException { com.zeroc.Ice.Current current = request.getCurrent(); + + String context = current.ctx.get("raiseBeforeDispatch"); + if(context != null) + { + if(context.equals("user")) + { + throw new InvalidInputException(); + } + else if(context.equals("notExist")) + { + throw new com.zeroc.Ice.ObjectNotExistException(); + } + else if(context.equals("system")) + { + throw new MySystemException(); + } + } + _lastOperation = current.operation; if(_lastOperation.equals("addWithRetry") || _lastOperation.equals("amdAddWithRetry")) @@ -51,9 +70,35 @@ class InterceptorI extends com.zeroc.Ice.DispatchInterceptor current.ctx.put("retry", "no"); } + else if(current.ctx.get("retry") != null && current.ctx.get("retry").equals("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); + } CompletionStage<OutputStream> f = _servant.ice_dispatch(request); _lastStatus = f != null; + + context = current.ctx.get("raiseAfterDispatch"); + if(context != null) + { + if(context.equals("user")) + { + throw new InvalidInputException(); + } + else if(context.equals("notExist")) + { + throw new com.zeroc.Ice.ObjectNotExistException(); + } + else if(context.equals("system")) + { + throw new MySystemException(); + } + } return f; } diff --git a/java/test/src/main/java/test/Ice/metrics/AllTests.java b/java/test/src/main/java/test/Ice/metrics/AllTests.java index e72cb7586a9..c6035f6548e 100644 --- a/java/test/src/main/java/test/Ice/metrics/AllTests.java +++ b/java/test/src/main/java/test/Ice/metrics/AllTests.java @@ -911,7 +911,7 @@ public class AllTests out.flush(); props.put("IceMX.Metrics.View.Map.Invocation.GroupBy", "operation"); - props.put("IceMX.Metrics.View.Map.Invocation.Map.Remote.GroupBy", "localPort"); + props.put("IceMX.Metrics.View.Map.Invocation.Map.Remote.GroupBy", "id"); props.put("IceMX.Metrics.View.Map.Invocation.Map.Collocated.GroupBy", "id"); updateProps(clientProps, serverProps, props, "Invocation"); test(serverMetrics.getMetricsView("View").returnValue.get("Invocation").length == 0); @@ -1094,13 +1094,9 @@ public class AllTests if(!collocated) { im1 = (InvocationMetrics)map.get("fail"); - test(im1.current <= 1 && im1.total == 3 && im1.failures == 3 && im1.retry == 3 && im1.remotes.length == 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.length == 1); + rim1 = (ChildInvocationMetrics)im1.remotes[0]; + test(rim1.current == 0 && rim1.total == 6 && rim1.failures == 6); checkFailure(clientMetrics, "Invocation", im1.id, "::Ice::ConnectionLostException", 3, out); } diff --git a/java/test/src/main/java/test/IceSSL/configuration/AllTests.java b/java/test/src/main/java/test/IceSSL/configuration/AllTests.java index 1f978a03e7d..bfa01f4e882 100644 --- a/java/test/src/main/java/test/IceSSL/configuration/AllTests.java +++ b/java/test/src/main/java/test/IceSSL/configuration/AllTests.java @@ -1385,6 +1385,10 @@ public class AllTests { server.ice_ping(); } + catch(com.zeroc.Ice.SecurityException ex) + { + // Expected on systems that disable DSA (EL8) + } catch(com.zeroc.Ice.LocalException ex) { ex.printStackTrace(); @@ -1511,7 +1515,7 @@ public class AllTests } catch(com.zeroc.Ice.ConnectionLostException ex) { - // Expected on systems that disable DSA + // Expected on systems that disable DSA (EL8) } catch(com.zeroc.Ice.LocalException ex) { diff --git a/js/package-lock.json b/js/package-lock.json index e0b017e6a6f..78b14327e71 100644 --- a/js/package-lock.json +++ b/js/package-lock.json @@ -40,14 +40,14 @@ } }, "@babel/core": { - "version": "7.5.0", - "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.5.0.tgz", - "integrity": "sha512-6Isr4X98pwXqHvtigw71CKgmhL1etZjPs5A67jL/w0TkLM9eqmFR40YrnJvEc1WnMZFsskjsmid8bHZyxKEAnw==", + "version": "7.5.4", + "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.5.4.tgz", + "integrity": "sha512-+DaeBEpYq6b2+ZmHx3tHspC+ZRflrvLqwfv8E3hNr5LVQoyBnL8RPKSBCg+rK2W2My9PWlujBiqd0ZPsR9Q6zQ==", "dev": true, "requires": { "@babel/code-frame": "^7.0.0", "@babel/generator": "^7.5.0", - "@babel/helpers": "^7.5.0", + "@babel/helpers": "^7.5.4", "@babel/parser": "^7.5.0", "@babel/template": "^7.4.4", "@babel/traverse": "^7.5.0", @@ -298,9 +298,9 @@ } }, "@babel/helpers": { - "version": "7.5.0", - "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.5.0.tgz", - "integrity": "sha512-EgCUEa8cNwuMrwo87l2d7i2oShi8m2Q58H7h3t4TWtqATZalJYFwfL9DulRe02f3KdqM9xmMCw3v/7Ll+EiaWg==", + "version": "7.5.4", + "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.5.4.tgz", + "integrity": "sha512-6LJ6xwUEJP51w0sIgKyfvFMJvIb9mWAfohJp0+m6eHJigkFdcH8duZ1sfhn0ltJRzwUIT/yqqhdSfRpCpL7oow==", "dev": true, "requires": { "@babel/template": "^7.4.4", @@ -357,9 +357,9 @@ } }, "@babel/plugin-proposal-object-rest-spread": { - "version": "7.5.0", - "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-object-rest-spread/-/plugin-proposal-object-rest-spread-7.5.0.tgz", - "integrity": "sha512-G1qy5EdcO3vYhbxlXjRSR2SXB8GsxYv9hoRKT1Jdn3qy/NUnFqUUnqymKZ00Pbj+3FXNh06B+BUZzecrp3sxNw==", + "version": "7.5.4", + "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-object-rest-spread/-/plugin-proposal-object-rest-spread-7.5.4.tgz", + "integrity": "sha512-KCx0z3y7y8ipZUMAEEJOyNi11lMb/FOPUjjB113tfowgw0c16EGYos7worCKBcUAh2oG+OBnoUhsnTSoLpV9uA==", "dev": true, "requires": { "@babel/helper-plugin-utils": "^7.0.0", @@ -741,9 +741,9 @@ } }, "@babel/preset-env": { - "version": "7.5.0", - "resolved": "https://registry.npmjs.org/@babel/preset-env/-/preset-env-7.5.0.tgz", - "integrity": "sha512-/5oQ7cYg+6sH9Dt9yx5IiylnLPiUdyMHl5y+K0mKVNiW2wJ7FpU5bg8jKcT8PcCbxdYzfv6OuC63jLEtMuRSmQ==", + "version": "7.5.4", + "resolved": "https://registry.npmjs.org/@babel/preset-env/-/preset-env-7.5.4.tgz", + "integrity": "sha512-hFnFnouyRNiH1rL8YkX1ANCNAUVC8Djwdqfev8i1415tnAG+7hlA5zhZ0Q/3Q5gkop4HioIPbCEWAalqcbxRoQ==", "dev": true, "requires": { "@babel/helper-module-imports": "^7.0.0", @@ -751,7 +751,7 @@ "@babel/plugin-proposal-async-generator-functions": "^7.2.0", "@babel/plugin-proposal-dynamic-import": "^7.5.0", "@babel/plugin-proposal-json-strings": "^7.2.0", - "@babel/plugin-proposal-object-rest-spread": "^7.5.0", + "@babel/plugin-proposal-object-rest-spread": "^7.5.4", "@babel/plugin-proposal-optional-catch-binding": "^7.2.0", "@babel/plugin-proposal-unicode-property-regex": "^7.4.4", "@babel/plugin-syntax-async-generators": "^7.2.0", @@ -925,12 +925,61 @@ } } }, + "@nodelib/fs.scandir": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.1.tgz", + "integrity": "sha512-NT/skIZjgotDSiXs0WqYhgcuBKhUMgfekCmCGtkUAiLqZdOnrdjmZr9wRl3ll64J9NF79uZ4fk16Dx0yMc/Xbg==", + "dev": true, + "requires": { + "@nodelib/fs.stat": "2.0.1", + "run-parallel": "^1.1.9" + } + }, + "@nodelib/fs.stat": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/@nodelib/fs.stat/-/fs.stat-2.0.1.tgz", + "integrity": "sha512-+RqhBlLn6YRBGOIoVYthsG0J9dfpO79eJyN7BYBkZJtfqrBwf2KK+rD/M/yjZR6WBmIhAgOV7S60eCgaSWtbFw==", + "dev": true + }, + "@nodelib/fs.walk": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/@nodelib/fs.walk/-/fs.walk-1.2.2.tgz", + "integrity": "sha512-J/DR3+W12uCzAJkw7niXDcqcKBg6+5G5Q/ZpThpGNzAUz70eOR6RV4XnnSN01qHZiVl0eavoxJsBypQoKsV2QQ==", + "dev": true, + "requires": { + "@nodelib/fs.scandir": "2.1.1", + "fastq": "^1.6.0" + } + }, "@types/estree": { "version": "0.0.39", "resolved": "https://registry.npmjs.org/@types/estree/-/estree-0.0.39.tgz", "integrity": "sha512-EYNwp3bU+98cpU4lAWYYL7Zz+2gryWH1qbdDTidVd6hkiR6weksdbMadyXKXNPEkQFhXM+hVO9ZygomHXp+AIw==", "dev": true }, + "@types/events": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/@types/events/-/events-3.0.0.tgz", + "integrity": "sha512-EaObqwIvayI5a8dCzhFrjKzVwKLxjoG9T6Ppd5CEo07LRKfQ8Yokw54r5+Wq7FaBQ+yXRvQAYPrHwya1/UFt9g==", + "dev": true + }, + "@types/glob": { + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/@types/glob/-/glob-7.1.1.tgz", + "integrity": "sha512-1Bh06cbWJUHMC97acuD6UMG29nMt0Aqz1vF3guLfG+kHHJhy3AyohZFFxYk2f7Q1SQIrNwvncxAE0N/9s70F2w==", + "dev": true, + "requires": { + "@types/events": "*", + "@types/minimatch": "*", + "@types/node": "*" + } + }, + "@types/minimatch": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/@types/minimatch/-/minimatch-3.0.3.tgz", + "integrity": "sha512-tHq6qdbT9U1IRSGf14CL0pUlULksvY9OZ+5eEgl1N7t+OA3tGvNpxJCzuKQlsNgCVwbAs670L1vcVQi8j9HjnA==", + "dev": true + }, "@types/node": { "version": "10.12.12", "resolved": "https://registry.npmjs.org/@types/node/-/node-10.12.12.tgz", @@ -1157,18 +1206,9 @@ } }, "array-union": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/array-union/-/array-union-1.0.2.tgz", - "integrity": "sha1-mjRBDk9OPaI96jdb5b5w8kd47Dk=", - "dev": true, - "requires": { - "array-uniq": "^1.0.1" - } - }, - "array-uniq": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/array-uniq/-/array-uniq-1.0.3.tgz", - "integrity": "sha1-r2rId6Jcx/dOBYiUdThY39sk/bY=", + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/array-union/-/array-union-2.1.0.tgz", + "integrity": "sha512-HGyxoOTYUyCM6stUe6EJgnd4EoewAI7zMdfqO+kGjnlZmBDz/cR5pf8r/cR4Wq60sL/p0IkcjUEEPwS3GFrIyw==", "dev": true }, "array-unique": { @@ -1355,14 +1395,14 @@ } }, "browserslist": { - "version": "4.6.3", - "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.6.3.tgz", - "integrity": "sha512-CNBqTCq22RKM8wKJNowcqihHJ4SkI8CGeK7KOR9tPboXUuS5Zk5lQgzzTbs4oxD8x+6HUshZUa2OyNI9lR93bQ==", + "version": "4.6.6", + "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.6.6.tgz", + "integrity": "sha512-D2Nk3W9JL9Fp/gIcWei8LrERCS+eXu9AM5cfXA8WEZ84lFks+ARnZ0q/R69m2SV3Wjma83QDDPxsNKXUwdIsyA==", "dev": true, "requires": { - "caniuse-lite": "^1.0.30000975", - "electron-to-chromium": "^1.3.164", - "node-releases": "^1.1.23" + "caniuse-lite": "^1.0.30000984", + "electron-to-chromium": "^1.3.191", + "node-releases": "^1.1.25" } }, "buffer-equal": { @@ -1407,9 +1447,9 @@ "dev": true }, "caniuse-lite": { - "version": "1.0.30000979", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30000979.tgz", - "integrity": "sha512-gcu45yfq3B7Y+WB05fOMfr0EiSlq+1u+m6rPHyJli/Wy3PVQNGaU7VA4bZE5qw+AU2UVOBR/N5g1bzADUqdvFw==", + "version": "1.0.30000984", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30000984.tgz", + "integrity": "sha512-n5tKOjMaZ1fksIpQbjERuqCyfgec/m9pferkFQbLmWtqLUdmt12hNhjSwsmPdqeiG2NkITOQhr1VYIwWSAceiA==", "dev": true }, "chalk": { @@ -1853,17 +1893,16 @@ } }, "del": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/del/-/del-3.0.0.tgz", - "integrity": "sha1-U+z2mf/LyzljdpGrE7rxYIGXZuU=", + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/del/-/del-5.0.0.tgz", + "integrity": "sha512-TfU3nUY0WDIhN18eq+pgpbLY9AfL5RfiE9czKaTSolc6aK7qASXfDErvYgjV1UqCR4sNXDoxO0/idPmhDUt2Sg==", "dev": true, "requires": { - "globby": "^6.1.0", - "is-path-cwd": "^1.0.0", - "is-path-in-cwd": "^1.0.0", - "p-map": "^1.1.1", - "pify": "^3.0.0", - "rimraf": "^2.2.8" + "globby": "^10.0.0", + "is-path-cwd": "^2.0.0", + "is-path-in-cwd": "^2.0.0", + "p-map": "^2.0.0", + "rimraf": "^2.6.3" } }, "detect-file": { @@ -1878,6 +1917,23 @@ "integrity": "sha1-9B8cEL5LAOh7XxPaaAdZ8sW/0+I=", "dev": true }, + "dir-glob": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/dir-glob/-/dir-glob-3.0.1.tgz", + "integrity": "sha512-WkrWp9GR4KXfKGYzOLmTuGVi1UWFfws377n9cc55/tb6DuqyF6pcQ5AbiHEshaDpY9v6oaSr2XCDidGmMwdzIA==", + "dev": true, + "requires": { + "path-type": "^4.0.0" + }, + "dependencies": { + "path-type": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-type/-/path-type-4.0.0.tgz", + "integrity": "sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==", + "dev": true + } + } + }, "dom-serializer": { "version": "0.1.1", "resolved": "https://registry.npmjs.org/dom-serializer/-/dom-serializer-0.1.1.tgz", @@ -1964,9 +2020,9 @@ } }, "electron-to-chromium": { - "version": "1.3.187", - "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.187.tgz", - "integrity": "sha512-XCEygaK7Fs35/RwS+67YbBWs/ydG+oUFPuy1wv558jC3Opd2DHwRyRqrCmhxpmPmCSVlZujYX4TOmOXuMz2GZA==", + "version": "1.3.191", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.191.tgz", + "integrity": "sha512-jasjtY5RUy/TOyiUYM2fb4BDaPZfm6CXRFeJDMfFsXYADGxUN49RBqtgB7EL2RmJXeIRUk9lM1U6A5yk2YJMPQ==", "dev": true }, "end-of-stream": { @@ -2225,6 +2281,83 @@ "time-stamp": "^1.0.0" } }, + "fast-glob": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.0.4.tgz", + "integrity": "sha512-wkIbV6qg37xTJwqSsdnIphL1e+LaGz4AIQqr00mIubMaEhv1/HEmJ0uuCGZRNRUkZZmOB5mJKO0ZUTVq+SxMQg==", + "dev": true, + "requires": { + "@nodelib/fs.stat": "^2.0.1", + "@nodelib/fs.walk": "^1.2.1", + "glob-parent": "^5.0.0", + "is-glob": "^4.0.1", + "merge2": "^1.2.3", + "micromatch": "^4.0.2" + }, + "dependencies": { + "braces": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz", + "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==", + "dev": true, + "requires": { + "fill-range": "^7.0.1" + } + }, + "fill-range": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", + "integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==", + "dev": true, + "requires": { + "to-regex-range": "^5.0.1" + } + }, + "glob-parent": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.0.0.tgz", + "integrity": "sha512-Z2RwiujPRGluePM6j699ktJYxmPpJKCfpGA13jz2hmFZC7gKetzrWvg5KN3+OsIFmydGyZ1AVwERCq1w/ZZwRg==", + "dev": true, + "requires": { + "is-glob": "^4.0.1" + } + }, + "is-number": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", + "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", + "dev": true + }, + "micromatch": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.2.tgz", + "integrity": "sha512-y7FpHSbMUMoyPbYUSzO6PaZ6FyRnQOpHuKwbo1G+Knck95XVU4QAiKdGEnj5wwoS7PlOgthX/09u5iFJ+aYf5Q==", + "dev": true, + "requires": { + "braces": "^3.0.1", + "picomatch": "^2.0.5" + } + }, + "to-regex-range": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", + "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", + "dev": true, + "requires": { + "is-number": "^7.0.0" + } + } + } + }, + "fastq": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.6.0.tgz", + "integrity": "sha512-jmxqQ3Z/nXoeyDmWAzF9kH1aGZSis6e/SbfPmJpUnyZ0ogr6iscHQaml4wsEepEWSdtmpy+eVXmCRIMpxaXqOA==", + "dev": true, + "requires": { + "reusify": "^1.0.0" + } + }, "fill-range": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-4.0.0.tgz", @@ -3041,22 +3174,25 @@ "dev": true }, "globby": { - "version": "6.1.0", - "resolved": "http://registry.npmjs.org/globby/-/globby-6.1.0.tgz", - "integrity": "sha1-9abXDoOV4hyFj7BInWTfAkJNUGw=", - "dev": true, - "requires": { - "array-union": "^1.0.1", - "glob": "^7.0.3", - "object-assign": "^4.0.1", - "pify": "^2.0.0", - "pinkie-promise": "^2.0.0" + "version": "10.0.1", + "resolved": "https://registry.npmjs.org/globby/-/globby-10.0.1.tgz", + "integrity": "sha512-sSs4inE1FB2YQiymcmTv6NWENryABjUNPeWhOvmn4SjtKybglsyPZxFB3U1/+L1bYi0rNZDqCLlHyLYDl1Pq5A==", + "dev": true, + "requires": { + "@types/glob": "^7.1.1", + "array-union": "^2.1.0", + "dir-glob": "^3.0.1", + "fast-glob": "^3.0.3", + "glob": "^7.1.3", + "ignore": "^5.1.1", + "merge2": "^1.2.3", + "slash": "^3.0.0" }, "dependencies": { - "pify": { - "version": "2.3.0", - "resolved": "http://registry.npmjs.org/pify/-/pify-2.3.0.tgz", - "integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=", + "slash": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/slash/-/slash-3.0.0.tgz", + "integrity": "sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==", "dev": true } } @@ -3527,6 +3663,12 @@ "requires-port": "^1.0.0" } }, + "ignore": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.1.2.tgz", + "integrity": "sha512-vdqWBp7MyzdmHkkRWV5nY+PfGRbYbahfuvsBCh277tq+w9zyNi7h5CYJCK0kmzti9kU+O/cB7sE8HvKv6aXAKQ==", + "dev": true + }, "inflight": { "version": "1.0.6", "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", @@ -3717,27 +3859,27 @@ } }, "is-path-cwd": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-path-cwd/-/is-path-cwd-1.0.0.tgz", - "integrity": "sha1-0iXsIxMuie3Tj9p2dHLmLmXxEG0=", + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/is-path-cwd/-/is-path-cwd-2.2.0.tgz", + "integrity": "sha512-w942bTcih8fdJPJmQHFzkS76NEP8Kzzvmw92cXsazb8intwLqPibPPdXf4ANdKV3rYMuuQYGIWtvz9JilB3NFQ==", "dev": true }, "is-path-in-cwd": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/is-path-in-cwd/-/is-path-in-cwd-1.0.1.tgz", - "integrity": "sha512-FjV1RTW48E7CWM7eE/J2NJvAEEVektecDBVBE5Hh3nM1Jd0kvhHtX68Pr3xsDf857xt3Y4AkwVULK1Vku62aaQ==", + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/is-path-in-cwd/-/is-path-in-cwd-2.1.0.tgz", + "integrity": "sha512-rNocXHgipO+rvnP6dk3zI20RpOtrAM/kzbB258Uw5BWr3TpXi861yzjo16Dn4hUox07iw5AyeMLHWsujkjzvRQ==", "dev": true, "requires": { - "is-path-inside": "^1.0.0" + "is-path-inside": "^2.1.0" } }, "is-path-inside": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/is-path-inside/-/is-path-inside-1.0.1.tgz", - "integrity": "sha1-jvW33lBDej/cprToZe96pVy0gDY=", + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/is-path-inside/-/is-path-inside-2.1.0.tgz", + "integrity": "sha512-wiyhTzfDWsvwAW53OBWF5zuvaOGlZ6PwYxAbPVDhpm+gM09xKQGjBq/8uYN12aDvMxnAnq3dxTyoSoRNmg5YFg==", "dev": true, "requires": { - "path-is-inside": "^1.0.1" + "path-is-inside": "^1.0.2" } }, "is-plain-obj": { @@ -3965,9 +4107,9 @@ } }, "lodash": { - "version": "4.17.11", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.11.tgz", - "integrity": "sha512-cQKh8igo5QUhZ7lg38DYWAxMvjSAKG0A8wGSVimP07SIUEK2UO+arSRKbRZWtelMtN5V0Hkwh5ryOto/SshYIg==", + "version": "4.17.14", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.14.tgz", + "integrity": "sha512-mmKYbW3GLuJeX+iGP+Y7Gp1AiGHGbXHCOh/jZmrawMmsE7MS4znI3RL2FsjbqOyMayHInjOeykW7PEajUk1/xw==", "dev": true }, "loose-envify": { @@ -4073,6 +4215,12 @@ "timers-ext": "^0.1.5" } }, + "merge2": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/merge2/-/merge2-1.2.3.tgz", + "integrity": "sha512-gdUU1Fwj5ep4kplwcmftruWofEFt6lfpkkr3h860CXbAB9c3hGb55EOL2ali0Td5oebvW0E1+3Sr+Ur7XfKpRA==", + "dev": true + }, "micromatch": { "version": "3.1.10", "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-3.1.10.tgz", @@ -4378,9 +4526,9 @@ } }, "p-map": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/p-map/-/p-map-1.2.0.tgz", - "integrity": "sha512-r6zKACMNhjPJMTl8KcFH4li//gkrXWfbD6feV8l6doRHlzljFWGJ2AP6iKaCJXyZmAUMOPtvbW7EXkbWO/pLEA==", + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/p-map/-/p-map-2.1.0.tgz", + "integrity": "sha512-y3b8Kpd8OAN444hxfBbFfj1FY/RjtTd8tzYwhUqNYXx0fXx2iX4maP4Qr6qhIKbQXI02wTLAda4fYUbDagTUFw==", "dev": true }, "parse-filepath": { @@ -4488,10 +4636,10 @@ } } }, - "pify": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/pify/-/pify-3.0.0.tgz", - "integrity": "sha1-5aSs0sEB/fPZpNB/DbxNtJ3SgXY=", + "picomatch": { + "version": "2.0.7", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.0.7.tgz", + "integrity": "sha512-oLHIdio3tZ0qH76NybpeneBhYVj0QFTfXEFTc/B3zKQspYfYYkWYgFsmzo+4kvId/bQRcNkVeguI3y+CD22BtA==", "dev": true }, "pinkie": { @@ -4681,9 +4829,9 @@ } }, "regexp-tree": { - "version": "0.1.10", - "resolved": "https://registry.npmjs.org/regexp-tree/-/regexp-tree-0.1.10.tgz", - "integrity": "sha512-K1qVSbcedffwuIslMwpe6vGlj+ZXRnGkvjAtFHfDZZZuEdA/h0dxljAPu9vhUo6Rrx2U2AwJ+nSQ6hK+lrP5MQ==", + "version": "0.1.11", + "resolved": "https://registry.npmjs.org/regexp-tree/-/regexp-tree-0.1.11.tgz", + "integrity": "sha512-7/l/DgapVVDzZobwMCCgMlqiqyLFJ0cduo/j+3BcDJIB+yJdsYCfKuI3l/04NV+H/rfNRdPIDbXNZHM9XvQatg==", "dev": true }, "regexpu-core": { @@ -4849,30 +4997,36 @@ "integrity": "sha512-TTlYpa+OL+vMMNG24xSlQGEJ3B/RzEfUlLct7b5G/ytav+wPrplCpVMFuwzXbkecJrb6IYo1iFb0S9v37754mg==", "dev": true }, + "reusify": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/reusify/-/reusify-1.0.4.tgz", + "integrity": "sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw==", + "dev": true + }, "rimraf": { - "version": "2.6.2", - "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.6.2.tgz", - "integrity": "sha512-lreewLK/BlghmxtfH36YYVg1i8IAce4TI7oao75I1g245+6BctqTVQiBP3YUJ9C6DQOXJmkYR9X9fCLtCOJc5w==", + "version": "2.6.3", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.6.3.tgz", + "integrity": "sha512-mwqeW5XsA2qAejG46gYdENaxXjx9onRNCfn7L0duuP4hCuTIi/QO7PDK07KJfp1d+izWPrzEJDcSqBa0OZQriA==", "dev": true, "requires": { - "glob": "^7.0.5" + "glob": "^7.1.3" } }, "rollup": { - "version": "1.16.6", - "resolved": "https://registry.npmjs.org/rollup/-/rollup-1.16.6.tgz", - "integrity": "sha512-oM3iKkzPCq9Da95wCnNfS8YlNZjgCD5c/TceKnJIthI9FOeJqnO3PUr/C5Suv9Kjzh0iphKL02PLeja3A5AMIA==", + "version": "1.17.0", + "resolved": "https://registry.npmjs.org/rollup/-/rollup-1.17.0.tgz", + "integrity": "sha512-k/j1m0NIsI4SYgCJR4MWPstGJOWfJyd6gycKoMhyoKPVXxm+L49XtbUwZyFsrSU2YXsOkM4u1ll9CS/ZgJBUpw==", "dev": true, "requires": { "@types/estree": "0.0.39", - "@types/node": "^12.0.10", - "acorn": "^6.1.1" + "@types/node": "^12.6.2", + "acorn": "^6.2.0" }, "dependencies": { "@types/node": { - "version": "12.0.12", - "resolved": "https://registry.npmjs.org/@types/node/-/node-12.0.12.tgz", - "integrity": "sha512-Uy0PN4R5vgBUXFoJrKryf5aTk3kJ8Rv3PdlHjl6UaX+Cqp1QE0yPQ68MPXGrZOfG7gZVNDIJZYyot0B9ubXUrQ==", + "version": "12.6.4", + "resolved": "https://registry.npmjs.org/@types/node/-/node-12.6.4.tgz", + "integrity": "sha512-ZKrDzI6KhrqtLpccI1YxMh4d+qzNnftNtp6iL9c4mLTNgzguFu7VR7pXH/C/MfzikMeoXjvISL9mlIGNGGDXDg==", "dev": true }, "acorn": { @@ -4883,6 +5037,12 @@ } } }, + "run-parallel": { + "version": "1.1.9", + "resolved": "https://registry.npmjs.org/run-parallel/-/run-parallel-1.1.9.tgz", + "integrity": "sha512-DEqnSRTDw/Tc3FXf49zedI638Z9onwUotBMiUFKmrO2sdFKIbXamXGQ3Axd4qgphxKB4kw/qP1w5kTxnfU1B9Q==", + "dev": true + }, "safe-buffer": { "version": "5.1.2", "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", @@ -5460,9 +5620,9 @@ "dev": true }, "typescript": { - "version": "3.5.2", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-3.5.2.tgz", - "integrity": "sha512-7KxJovlYhTX5RaRbUdkAXN1KUZ8PwWlTzQdHV6xNqvuFOs7+WBo10TQUqT19Q/Jz2hk5v9TQDIhyLhhJY4p5AA==", + "version": "3.5.3", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-3.5.3.tgz", + "integrity": "sha512-ACzBtm/PhXBDId6a6sDJfroT2pOWt/oOnk4/dElG5G33ZL776N3Y6/6bKZJBFpd+b05F3Ct9qDjMeJmRWtE2/g==", "dev": true }, "typescript-formatter": { @@ -5719,24 +5879,12 @@ } }, "vinyl-paths": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/vinyl-paths/-/vinyl-paths-2.1.0.tgz", - "integrity": "sha1-AIIEN8ujgmLO+IAthA+T4zku5Es=", + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/vinyl-paths/-/vinyl-paths-3.0.0.tgz", + "integrity": "sha512-8UiUPcZopECG0Ld10GAmNTH0BrSrtPWCxhNKn81/0XDGau+TWyjZ70+ZZN2SzG4Z539uZWF2xAtunJTNEff7dw==", "dev": true, "requires": { - "through2": "^2.0.0" - }, - "dependencies": { - "through2": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/through2/-/through2-2.0.5.tgz", - "integrity": "sha512-/mrRod8xqpA+IHSLyGCQ2s8SPHiCDEeQJSep1jqLYeEUClOFG2Qsh+4FU6G9VeqpZnGW/Su8LQGc4YKni5rYSQ==", - "dev": true, - "requires": { - "readable-stream": "~2.3.6", - "xtend": "~4.0.1" - } - } + "through2": "^3.0.1" } }, "vinyl-sourcemap": { diff --git a/js/package.json b/js/package.json index 35ef4609401..15fb37b7168 100644 --- a/js/package.json +++ b/js/package.json @@ -18,13 +18,13 @@ "browserslist": "> 0.25%, not dead", "devDependencies": { "@babel/cli": "^7.5.0", - "@babel/core": "^7.5.0", + "@babel/core": "^7.5.4", "@babel/plugin-transform-async-to-generator": "^7.5.0", - "@babel/preset-env": "^7.5.0", + "@babel/preset-env": "^7.5.4", "babel-plugin-rewrite-require": "^1.14.5", "core-js": "^3.1.4", "core-js-bundle": "^3.1.4", - "del": "^3.0.0", + "del": "^5.0.0", "esprima": "^4.0.1", "gulp": "^4.0.2", "gulp-babel": "^8.0.0", @@ -44,13 +44,13 @@ "plugin-error": "^1.0.1", "pump": "^3.0.0", "regenerator-runtime": "^0.13.2", - "rollup": "^1.16.6", + "rollup": "^1.17.0", "source-map": "^0.7.3", "through2": "^3.0.1", - "typescript": "^3.5.2", + "typescript": "^3.5.3", "typescript-formatter": "^7.2.2", "vinyl": "^2.2.0", - "vinyl-paths": "^2.1.0" + "vinyl-paths": "^3.0.0" }, "scripts": { "build": "gulp", diff --git a/js/test/Ice/objects/Client.js b/js/test/Ice/objects/Client.js index 23984ccaed8..9e214a1a4c4 100644 --- a/js/test/Ice/objects/Client.js +++ b/js/test/Ice/objects/Client.js @@ -475,7 +475,8 @@ test(f21.ice_getIdentity().name == "F21"); test(f22.ice_getIdentity().name == "F22"); - if(initial.hasF3()) + const hasF3 = await initial.hasF3(); + if(hasF3) { const [f31, f32] = await initial.opF3( new Test.F3(new Test.F1("F11"), Test.F2Prx.uncheckedCast(communicator.stringToProxy("F21")))); diff --git a/objective-c/test/Ice/metrics/AllTests.m b/objective-c/test/Ice/metrics/AllTests.m index 6e4049afb62..986d86cd3c0 100644 --- a/objective-c/test/Ice/metrics/AllTests.m +++ b/objective-c/test/Ice/metrics/AllTests.m @@ -917,7 +917,7 @@ metricsAllTests(id<ICECommunicator> communicator) tprintf("testing invocation metrics... "); [props setObject:@"operation" forKey:@"IceMX.Metrics.View.Map.Invocation.GroupBy"]; - [props setObject:@"localPort" forKey:@"IceMX.Metrics.View.Map.Invocation.Map.Remote.GroupBy"]; + [props setObject:@"id" forKey:@"IceMX.Metrics.View.Map.Invocation.Map.Remote.GroupBy"]; updateProps(clientProps, serverProps, update, props, @"Invocation"); test([[[serverMetrics getMetricsView:@"View" timestamp:×tamp] objectForKey:@"Invocation"] count] == 0); @@ -1077,31 +1077,9 @@ metricsAllTests(id<ICECommunicator> communicator) checkFailure(clientMetrics, @"Invocation", im1.id_, @"::Ice::UnknownException", 3); im1 = (ICEMXInvocationMetrics*)[map objectForKey:@"fail"]; - test(im1.current <= 1 && im1.total == 3 && im1.failures == 3 && im1.retry == 3 && [im1.remotes count] == 6); - - test(((ICEMXMetrics*)[im1.remotes objectAtIndex:0]).current == 0 && - ((ICEMXMetrics*)[im1.remotes objectAtIndex:0]).total == 1 && - ((ICEMXMetrics*)[im1.remotes objectAtIndex:0]).failures == 1); - - test(((ICEMXMetrics*)[im1.remotes objectAtIndex:1]).current == 0 && - ((ICEMXMetrics*)[im1.remotes objectAtIndex:1]).total == 1 && - ((ICEMXMetrics*)[im1.remotes objectAtIndex:1]).failures == 1); - - test(((ICEMXMetrics*)[im1.remotes objectAtIndex:2]).current == 0 && - ((ICEMXMetrics*)[im1.remotes objectAtIndex:2]).total == 1 && - ((ICEMXMetrics*)[im1.remotes objectAtIndex:2]).failures == 1); - - test(((ICEMXMetrics*)[im1.remotes objectAtIndex:3]).current == 0 && - ((ICEMXMetrics*)[im1.remotes objectAtIndex:3]).total == 1 && - ((ICEMXMetrics*)[im1.remotes objectAtIndex:3]).failures == 1); - - test(((ICEMXMetrics*)[im1.remotes objectAtIndex:4]).current == 0 && - ((ICEMXMetrics*)[im1.remotes objectAtIndex:4]).total == 1 && - ((ICEMXMetrics*)[im1.remotes objectAtIndex:4]).failures == 1); - - test(((ICEMXMetrics*)[im1.remotes objectAtIndex:5]).current == 0 && - ((ICEMXMetrics*)[im1.remotes objectAtIndex:5]).total == 1 && - ((ICEMXMetrics*)[im1.remotes objectAtIndex:5]).failures == 1); + test(im1.current <= 1 && im1.total == 3 && im1.failures == 3 && im1.retry == 3 && [im1.remotes count] == 1); + rim1 = (ICEMXRemoteMetrics*)[im1.remotes objectAtIndex:0]; + test(rim1.current == 0 && rim1.total == 6 && rim1.failures == 6); checkFailure(clientMetrics, @"Invocation", im1.id_, @"::Ice::ConnectionLostException", 3); diff --git a/objective-c/test/Ice/timeout/AllTests.m b/objective-c/test/Ice/timeout/AllTests.m index 24de082b966..64be1128004 100644 --- a/objective-c/test/Ice/timeout/AllTests.m +++ b/objective-c/test/Ice/timeout/AllTests.m @@ -229,7 +229,7 @@ timeoutAllTests(id<ICECommunicator> communicator) // // Expect Success. // - id<TestTimeoutTimeoutPrx> to = [TestTimeoutTimeoutPrx uncheckedCast:[obj ice_invocationTimeout:500]]; + id<TestTimeoutTimeoutPrx> to = [TestTimeoutTimeoutPrx uncheckedCast:[obj ice_invocationTimeout:1000]]; TestTimeoutCallback* cb = [TestTimeoutCallback create]; [to begin_sleep:100 response:^ { [cb response]; } exception:^(ICEException* ex) { [cb exception:ex]; }]; [cb check]; diff --git a/objective-c/test/ios/controller/Objective-C Test Controller.xcodeproj/project.pbxproj b/objective-c/test/ios/controller/Objective-C Test Controller.xcodeproj/project.pbxproj index c931c4e3a7a..bb0f4b1531d 100644 --- a/objective-c/test/ios/controller/Objective-C Test Controller.xcodeproj/project.pbxproj +++ b/objective-c/test/ios/controller/Objective-C Test Controller.xcodeproj/project.pbxproj @@ -355,6 +355,8 @@ 14CF14CC215A4A7800499968 /* ObjectsDerivedEx.ice in Sources */ = {isa = PBXBuildFile; fileRef = 14CF14BC215A491100499968 /* ObjectsDerivedEx.ice */; }; 14FFBAA01E29361A00EA55AF /* ExternalAccessory.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 14FFBA9F1E29361A00EA55AF /* ExternalAccessory.framework */; }; 14FFBAA11E29362900EA55AF /* ExternalAccessory.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 14FFBA9F1E29361A00EA55AF /* ExternalAccessory.framework */; }; + 820CD39F22D737950056BEDA /* ObjectsForward.ice in Sources */ = {isa = PBXBuildFile; fileRef = 820CD39C22D65C8E0056BEDA /* ObjectsForward.ice */; }; + 820CD3A022D737A50056BEDA /* ObjectsForward.ice in Sources */ = {isa = PBXBuildFile; fileRef = 820CD39C22D65C8E0056BEDA /* ObjectsForward.ice */; }; /* End PBXBuildFile section */ /* Begin PBXBuildRule section */ @@ -594,6 +596,7 @@ 14CF14BC215A491100499968 /* ObjectsDerivedEx.ice */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = ObjectsDerivedEx.ice; path = ../../Ice/objects/ObjectsDerivedEx.ice; sourceTree = "<group>"; }; 14CF14BE215A491100499968 /* ObjectsDerived.ice */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = ObjectsDerived.ice; path = ../../Ice/objects/ObjectsDerived.ice; sourceTree = "<group>"; }; 14FFBA9F1E29361A00EA55AF /* ExternalAccessory.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = ExternalAccessory.framework; path = System/Library/Frameworks/ExternalAccessory.framework; sourceTree = SDKROOT; }; + 820CD39C22D65C8E0056BEDA /* ObjectsForward.ice */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = ObjectsForward.ice; path = ../../Ice/objects/ObjectsForward.ice; sourceTree = "<group>"; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -1133,6 +1136,7 @@ 14CF1432215A47DF00499968 /* objects */ = { isa = PBXGroup; children = ( + 820CD39C22D65C8E0056BEDA /* ObjectsForward.ice */, 14A4CE08215A4C06002AD8F7 /* ObjectsTest.ice */, 14CF14BE215A491100499968 /* ObjectsDerived.ice */, 14CF14BC215A491100499968 /* ObjectsDerivedEx.ice */, @@ -1227,6 +1231,7 @@ developmentRegion = English; hasScannedForEncodings = 0; knownRegions = ( + English, en, Base, ); @@ -1275,6 +1280,7 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( + 820CD39F22D737950056BEDA /* ObjectsForward.ice in Sources */, 14A4CE0A215A4C31002AD8F7 /* ObjectsTest.ice in Sources */, 14CF14CB215A4A7800499968 /* ObjectsDerived.ice in Sources */, 14CF14CC215A4A7800499968 /* ObjectsDerivedEx.ice in Sources */, @@ -1449,6 +1455,7 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( + 820CD3A022D737A50056BEDA /* ObjectsForward.ice in Sources */, 14A4CE0B215A4C3E002AD8F7 /* ObjectsTest.ice in Sources */, 14A4CE0C215A4C3E002AD8F7 /* ObjectsDerived.ice in Sources */, 14A4CE0D215A4C3E002AD8F7 /* ObjectsDerivedEx.ice in Sources */, diff --git a/php/src/php5/Types.cpp b/php/src/php5/Types.cpp index 79fb6d2ca5b..061a5007fb7 100644 --- a/php/src/php5/Types.cpp +++ b/php/src/php5/Types.cpp @@ -1794,7 +1794,7 @@ IcePHP::SequenceInfo::marshalPrimitiveSequence(const PrimitiveInfoPtr& pi, zval* seq[i++] = static_cast<Ice::Byte>(l); zend_hash_move_forward_ex(arr, &pos); } - os->write(&seq[0], &seq[0] + seq.size()); + os->write(seq); break; } case PrimitiveInfo::KindShort: @@ -1814,7 +1814,7 @@ IcePHP::SequenceInfo::marshalPrimitiveSequence(const PrimitiveInfoPtr& pi, zval* seq[i++] = static_cast<Ice::Short>(l); zend_hash_move_forward_ex(arr, &pos); } - os->write(&seq[0], &seq[0] + seq.size()); + os->write(seq); break; } case PrimitiveInfo::KindInt: @@ -1834,7 +1834,7 @@ IcePHP::SequenceInfo::marshalPrimitiveSequence(const PrimitiveInfoPtr& pi, zval* seq[i++] = static_cast<Ice::Int>(l); zend_hash_move_forward_ex(arr, &pos); } - os->write(&seq[0], &seq[0] + seq.size()); + os->write(seq); break; } case PrimitiveInfo::KindLong: @@ -1867,7 +1867,7 @@ IcePHP::SequenceInfo::marshalPrimitiveSequence(const PrimitiveInfoPtr& pi, zval* seq[i++] = l; zend_hash_move_forward_ex(arr, &pos); } - os->write(&seq[0], &seq[0] + seq.size()); + os->write(seq); break; } case PrimitiveInfo::KindFloat: @@ -1898,7 +1898,7 @@ IcePHP::SequenceInfo::marshalPrimitiveSequence(const PrimitiveInfoPtr& pi, zval* seq[i++] = static_cast<Ice::Float>(d); zend_hash_move_forward_ex(arr, &pos); } - os->write(&seq[0], &seq[0] + seq.size()); + os->write(seq); break; } case PrimitiveInfo::KindDouble: @@ -1929,7 +1929,7 @@ IcePHP::SequenceInfo::marshalPrimitiveSequence(const PrimitiveInfoPtr& pi, zval* seq[i++] = d; zend_hash_move_forward_ex(arr, &pos); } - os->write(&seq[0], &seq[0] + seq.size()); + os->write(seq); break; } case PrimitiveInfo::KindString: diff --git a/php/src/php7/Types.cpp b/php/src/php7/Types.cpp index d5d3d528ba3..63fdbc7dbe1 100644 --- a/php/src/php7/Types.cpp +++ b/php/src/php7/Types.cpp @@ -1753,7 +1753,7 @@ IcePHP::SequenceInfo::marshalPrimitiveSequence(const PrimitiveInfoPtr& pi, zval* } ZEND_HASH_FOREACH_END(); - os->write(&seq[0], &seq[0] + seq.size()); + os->write(seq); break; } case PrimitiveInfo::KindShort: @@ -1773,7 +1773,7 @@ IcePHP::SequenceInfo::marshalPrimitiveSequence(const PrimitiveInfoPtr& pi, zval* } ZEND_HASH_FOREACH_END(); - os->write(&seq[0], &seq[0] + seq.size()); + os->write(seq); break; } case PrimitiveInfo::KindInt: @@ -1793,7 +1793,7 @@ IcePHP::SequenceInfo::marshalPrimitiveSequence(const PrimitiveInfoPtr& pi, zval* } ZEND_HASH_FOREACH_END(); - os->write(&seq[0], &seq[0] + seq.size()); + os->write(seq); break; } case PrimitiveInfo::KindLong: @@ -1826,7 +1826,7 @@ IcePHP::SequenceInfo::marshalPrimitiveSequence(const PrimitiveInfoPtr& pi, zval* } ZEND_HASH_FOREACH_END(); - os->write(&seq[0], &seq[0] + seq.size()); + os->write(seq); break; } case PrimitiveInfo::KindFloat: @@ -1857,7 +1857,7 @@ IcePHP::SequenceInfo::marshalPrimitiveSequence(const PrimitiveInfoPtr& pi, zval* } ZEND_HASH_FOREACH_END(); - os->write(&seq[0], &seq[0] + seq.size()); + os->write(seq); break; } case PrimitiveInfo::KindDouble: @@ -1888,7 +1888,7 @@ IcePHP::SequenceInfo::marshalPrimitiveSequence(const PrimitiveInfoPtr& pi, zval* } ZEND_HASH_FOREACH_END(); - os->write(&seq[0], &seq[0] + seq.size()); + os->write(seq); break; } case PrimitiveInfo::KindString: diff --git a/python/config/Make.rules b/python/config/Make.rules index ee53f40d516..b28101189ee 100644 --- a/python/config/Make.rules +++ b/python/config/Make.rules @@ -33,6 +33,15 @@ allow-undefined-symbols := yes python_ldflags := $(filter-out -lpython% -ldl -lutil,$(python_ldflags)) endif +ifeq ($(os),AIX) +# We use an attribute (not an export file) to export the entry point +link-with-python-exp := -Wl,-bE:Modules/python.exp +python_ldflags := $(filter-out $(link-with-python-exp),$(python_ldflags)) + +# $(call mkshlib,$1=target,$2=objects,$3=libname,$4=version,$5=soversion,$6=ldflags,$7=platform) +mkshlib = $(or $($7_cxx),$(CXX)) -shared -o $1 $2 $6 +endif + ifneq ($(OPTIMIZE),yes) # Remove optimization options if building debug build python_cppflags := $(filter-out -O% -DNDEBUG -Wp$(comma)-D_FORTIFY_SOURCE=%,$(python_cppflags)) diff --git a/python/config/Make.rules.AIX b/python/config/Make.rules.AIX deleted file mode 100644 index c68a32b03d9..00000000000 --- a/python/config/Make.rules.AIX +++ /dev/null @@ -1,6 +0,0 @@ -# -# Copyright (c) ZeroC, Inc. All rights reserved. -# - -# $(call mkshlib,$1=target,$2=objects,$3=libname,$4=version,$5=soversion,$6=ldflags,$7=platform) -mkshlib = $(or $($7_cxx),$(CXX)) -qmkshrobj -o $1 $2 $6 diff --git a/python/modules/IcePy/Operation.cpp b/python/modules/IcePy/Operation.cpp index f4bcd8256cc..d343d244c2a 100644 --- a/python/modules/IcePy/Operation.cpp +++ b/python/modules/IcePy/Operation.cpp @@ -3189,7 +3189,7 @@ IcePy::SyncBlobjectInvocation::invoke(PyObject* args, PyObject* /* kwds */) } else { - op = PyBytes_FromStringAndSize(reinterpret_cast<const char*>(&out[0]), out.size()); + op = PyBytes_FromStringAndSize(reinterpret_cast<const char*>(&out[0]), static_cast<Py_ssize_t>(out.size())); } if(!op.get()) { diff --git a/python/modules/IcePy/Types.cpp b/python/modules/IcePy/Types.cpp index 7ecc7379af7..21a9cd897db 100644 --- a/python/modules/IcePy/Types.cpp +++ b/python/modules/IcePy/Types.cpp @@ -42,6 +42,8 @@ static ExceptionInfoMap _exceptionInfoMap; namespace { +const char* emptySeq = ""; + // // This exception is raised if the factory specified in a sequence metadata // cannot be load or is not valid @@ -281,9 +283,12 @@ bufferGetBuffer(BufferObject* self, Py_buffer* view, int flags) PyErr_SetString(PyExc_BufferError, "fill buffer info failed"); return -1; } - view->obj = reinterpret_cast<PyObject*>(self); - Py_INCREF(view->obj); + // + // Don't nee to increase the view->obj ref count here + // PyBuffer_FillInfo already increases it. + // + //Py_INCREF(view->obj); return 0; } @@ -520,10 +525,10 @@ IcePy::StreamUtil::setSlicedDataMember(PyObject* obj, const Ice::SlicedDataPtr& if((*p)->bytes.size() > 0) { #if PY_VERSION_HEX >= 0x03000000 - bytes = PyBytes_FromStringAndSize(reinterpret_cast<const char*>(&(*p)->bytes[0]), + bytes = PyBytes_FromStringAndSize((*p)->bytes.empty() ? 0 : reinterpret_cast<const char*>(&(*p)->bytes[0]), static_cast<Py_ssize_t>((*p)->bytes.size())); #else - bytes = PyString_FromStringAndSize(reinterpret_cast<const char*>(&(*p)->bytes[0]), + bytes = PyString_FromStringAndSize((*p)->bytes.empty() ? 0 : reinterpret_cast<const char*>(&(*p)->bytes[0]), static_cast<Py_ssize_t>((*p)->bytes.size())); #endif } @@ -2276,10 +2281,10 @@ IcePy::SequenceInfo::createSequenceFromMemory(const SequenceMappingPtr& sm, const char* buffer, Py_ssize_t size, BuiltinType type, - bool copy) + bool adopt) { PyObjectHandle memoryview; - if(copy) + if(adopt && size > 0) { PyObjectHandle bufferObject = createBuffer(new Buffer(buffer, size, type)); if(!bufferObject.get()) @@ -2288,15 +2293,15 @@ IcePy::SequenceInfo::createSequenceFromMemory(const SequenceMappingPtr& sm, throw AbortMarshaling(); } memoryview = PyMemoryView_FromObject(bufferObject.get()); - Py_XDECREF(bufferObject.get()); } else { + char* buf = const_cast<char*>(size == 0 ? emptySeq : buffer); #if PY_VERSION_HEX >= 0x03030000 - memoryview = PyMemoryView_FromMemory(const_cast<char*>(buffer), size, PyBUF_READ); + memoryview = PyMemoryView_FromMemory(buf, size, PyBUF_READ); #else Py_buffer pybuffer; - if(PyBuffer_FillInfo(&pybuffer, 0, const_cast<char*>(buffer), size, 1, PyBUF_SIMPLE) != 0) + if(PyBuffer_FillInfo(&pybuffer, 0, buf, size, 1, PyBUF_SIMPLE) != 0) { assert(PyErr_Occurred()); throw AbortMarshaling(); @@ -2325,11 +2330,11 @@ IcePy::SequenceInfo::createSequenceFromMemory(const SequenceMappingPtr& sm, PyTuple_SET_ITEM(args.get(), 0, incRef(memoryview.get())); PyTuple_SET_ITEM(args.get(), 1, incRef(builtinType.get())); // - // If we copy the data to a Buffer object we set the copy factory argument to false + // If the Buffer object adopts the data we set the copy factory argument to false // to avoid a second copy in the factory. // - PyTuple_SET_ITEM(args.get(), 2, copy ? incFalse() : incTrue()); - PyObjectHandle result = PyObject_Call(sm->factory.get(), args.get(), 0); + PyTuple_SET_ITEM(args.get(), 2, adopt ? incFalse() : incTrue()); + PyObjectHandle result = PyObject_Call(sm->factory, args.get(), 0); if(!result.get()) { @@ -2359,13 +2364,11 @@ IcePy::SequenceInfo::unmarshalPrimitiveSequence(const PrimitiveInfoPtr& pi, Ice: IceUtil::ScopedArray<bool> arr; is->read(p, arr); int sz = static_cast<int>(p.second - p.first); - if(sm->factory.get()) + if(sm->factory) { - result = createSequenceFromMemory(sm, - reinterpret_cast<const char*>(arr.get() != 0 ? arr.release() : p.first), - sz, - BuiltinTypeBool, - arr.get() != 0); + bool adopt = arr.get() != 0; + const char* data = reinterpret_cast<const char*>(arr.get() != 0 ? arr.release() : p.first); + result = createSequenceFromMemory(sm, data, sz, BuiltinTypeBool, adopt); } else { @@ -2388,7 +2391,7 @@ IcePy::SequenceInfo::unmarshalPrimitiveSequence(const PrimitiveInfoPtr& pi, Ice: pair<const Ice::Byte*, const Ice::Byte*> p; is->read(p); int sz = static_cast<int>(p.second - p.first); - if(sm->factory.get()) + if(sm->factory) { result = createSequenceFromMemory(sm, reinterpret_cast<const char*>(p.first), sz, BuiltinTypeByte, false); } @@ -2433,13 +2436,11 @@ IcePy::SequenceInfo::unmarshalPrimitiveSequence(const PrimitiveInfoPtr& pi, Ice: IceUtil::ScopedArray<Ice::Short> arr; is->read(p, arr); int sz = static_cast<int>(p.second - p.first); - if(sm->factory.get()) + if(sm->factory) { - result = createSequenceFromMemory(sm, - reinterpret_cast<const char*>(arr.get() != 0 ? arr.release() : p.first), - sz * 2, - BuiltinTypeShort, - arr.get() != 0); + bool adopt = arr.get() != 0; + const char* data = reinterpret_cast<const char*>(arr.get() != 0 ? arr.release() : p.first); + result = createSequenceFromMemory(sm, data, sz * 2, BuiltinTypeShort, adopt); } else { @@ -2469,13 +2470,11 @@ IcePy::SequenceInfo::unmarshalPrimitiveSequence(const PrimitiveInfoPtr& pi, Ice: IceUtil::ScopedArray<Ice::Int> arr; is->read(p, arr); int sz = static_cast<int>(p.second - p.first); - if(sm->factory.get()) + if(sm->factory) { - result = createSequenceFromMemory(sm, - reinterpret_cast<const char*>(arr.get() != 0 ? arr.release() : p.first), - sz * 4, - BuiltinTypeInt, - arr.get() != 0); + bool adopt = arr.get() != 0; + const char* data = reinterpret_cast<const char*>(arr.get() != 0 ? arr.release() : p.first); + result = createSequenceFromMemory(sm, data, sz * 4, BuiltinTypeInt, adopt); } else { @@ -2504,13 +2503,11 @@ IcePy::SequenceInfo::unmarshalPrimitiveSequence(const PrimitiveInfoPtr& pi, Ice: IceUtil::ScopedArray<Ice::Long> arr; is->read(p, arr); int sz = static_cast<int>(p.second - p.first); - if(sm->factory.get()) + if(sm->factory) { - result = createSequenceFromMemory(sm, - reinterpret_cast<const char*>(arr.get() != 0 ? arr.release() : p.first), - sz * 8, - BuiltinTypeLong, - arr.get() != 0); + bool adopt = arr.get() != 0; + const char* data = reinterpret_cast<const char*>(arr.get() != 0 ? arr.release() : p.first); + result = createSequenceFromMemory(sm, data, sz * 8, BuiltinTypeLong, adopt); } else { @@ -2540,13 +2537,11 @@ IcePy::SequenceInfo::unmarshalPrimitiveSequence(const PrimitiveInfoPtr& pi, Ice: IceUtil::ScopedArray<Ice::Float> arr; is->read(p, arr); int sz = static_cast<int>(p.second - p.first); - if(sm->factory.get()) + if(sm->factory) { - result = createSequenceFromMemory(sm, - reinterpret_cast<const char*>(arr.get() != 0 ? arr.release() : p.first), - sz * 4, - BuiltinTypeFloat, - arr.get() != 0); + bool adopt = arr.get() != 0; + const char* data = reinterpret_cast<const char*>(arr.get() != 0 ? arr.release() : p.first); + result = createSequenceFromMemory(sm, data, sz * 4, BuiltinTypeFloat, adopt); } else { @@ -2576,13 +2571,11 @@ IcePy::SequenceInfo::unmarshalPrimitiveSequence(const PrimitiveInfoPtr& pi, Ice: IceUtil::ScopedArray<Ice::Double> arr; is->read(p, arr); int sz = static_cast<int>(p.second - p.first); - if(sm->factory.get()) + if(sm->factory) { - result = createSequenceFromMemory(sm, - reinterpret_cast<const char*>(arr.get() != 0 ? arr.release() : p.first), - sz * 8, - BuiltinTypeDouble, - arr.get() != 0); + bool adopt = arr.get() != 0; + const char* data = reinterpret_cast<const char*>(arr.get() != 0 ? arr.release() : p.first); + result = createSequenceFromMemory(sm, data, sz * 8, BuiltinTypeDouble, adopt); } else { @@ -2678,11 +2671,13 @@ IcePy::SequenceInfo::SequenceMapping::getType(const Ice::StringSeq& metaData, Ty } IcePy::SequenceInfo::SequenceMapping::SequenceMapping(Type t) : - type(t) + type(t), + factory(0) { } -IcePy::SequenceInfo::SequenceMapping::SequenceMapping(const Ice::StringSeq& meta) +IcePy::SequenceInfo::SequenceMapping::SequenceMapping(const Ice::StringSeq& meta) : + factory(0) { if(!getType(meta, type)) { @@ -2696,7 +2691,7 @@ IcePy::SequenceInfo::SequenceMapping::init(const Ice::StringSeq& meta) if(type == SEQ_ARRAY) { factory = lookupType("Ice.createArray"); - if(!factory.get()) + if(!factory) { PyErr_Format(PyExc_ImportError, STRCAST("factory type not found `Ice.createArray'")); throw InvalidSequenceFactoryException(); @@ -2705,7 +2700,7 @@ IcePy::SequenceInfo::SequenceMapping::init(const Ice::StringSeq& meta) else if(type == SEQ_NUMPYARRAY) { factory = lookupType("Ice.createNumPyArray"); - if(!factory.get()) + if(!factory) { PyErr_Format(PyExc_ImportError, STRCAST("factory type not found `Ice.createNumPyArray'")); throw InvalidSequenceFactoryException(); @@ -2720,12 +2715,12 @@ IcePy::SequenceInfo::SequenceMapping::init(const Ice::StringSeq& meta) { const string typestr = i->substr(prefix.size()); factory = lookupType(typestr); - if(!factory.get()) + if(!factory) { PyErr_Format(PyExc_ImportError, STRCAST("factory type not found `%s'"), typestr.c_str()); throw InvalidSequenceFactoryException(); } - if(!PyCallable_Check(factory.get())) + if(!PyCallable_Check(factory)) { PyErr_Format(PyExc_RuntimeError, STRCAST("factory type `%s' is not callable"), typestr.c_str()); throw InvalidSequenceFactoryException(); @@ -2734,7 +2729,6 @@ IcePy::SequenceInfo::SequenceMapping::init(const Ice::StringSeq& meta) } } } - Py_XINCREF(factory.get()); } void @@ -2769,7 +2763,7 @@ IcePy::SequenceInfo::SequenceMapping::createContainer(int sz) const { // // Must never be called for SEQ_MEMORYVIEW, as the container - // is created by the use factory function. + // is created by the user factory function. // assert(false); return 0; diff --git a/python/modules/IcePy/Types.h b/python/modules/IcePy/Types.h index fe82c9f4842..06d774eb615 100644 --- a/python/modules/IcePy/Types.h +++ b/python/modules/IcePy/Types.h @@ -359,7 +359,7 @@ private: void setItem(PyObject*, int, PyObject*) const; Type type; - PyObjectHandle factory; + PyObject* factory; }; typedef IceUtil::Handle<SequenceMapping> SequenceMappingPtr; diff --git a/python/modules/IcePy/Util.cpp b/python/modules/IcePy/Util.cpp index 6a17e0e4c1d..f15c7a5c690 100644 --- a/python/modules/IcePy/Util.cpp +++ b/python/modules/IcePy/Util.cpp @@ -174,7 +174,7 @@ IcePy::getString(PyObject* p) char* s; Py_ssize_t sz; PyBytes_AsStringAndSize(bytes.get(), &s, &sz); - str.assign(s, sz); + str.assign(s, static_cast<size_t>(sz)); } #else str.assign(PyString_AS_STRING(p), static_cast<size_t>(PyString_GET_SIZE(p))); diff --git a/python/python/Ice/__init__.py b/python/python/Ice/__init__.py index a5cd8990c44..1b64975c43b 100644 --- a/python/python/Ice/__init__.py +++ b/python/python/Ice/__init__.py @@ -521,28 +521,28 @@ class EnumBase(object): def __lt__(self, other): if isinstance(other, self.__class__): - return self._value < other._value; + return self._value < other._value elif other == None: return False return NotImplemented def __le__(self, other): if isinstance(other, self.__class__): - return self._value <= other._value; - elif other == None: + return self._value <= other._value + elif other is None: return False return NotImplemented def __eq__(self, other): if isinstance(other, self.__class__): - return self._value == other._value; + return self._value == other._value elif other == None: return False return NotImplemented def __ne__(self, other): if isinstance(other, self.__class__): - return self._value != other._value; + return self._value != other._value elif other == None: return False return NotImplemented @@ -556,7 +556,7 @@ class EnumBase(object): def __ge__(self, other): if isinstance(other, self.__class__): - return self._value >= other._value; + return self._value >= other._value elif other == None: return False return NotImplemented @@ -820,28 +820,6 @@ define the start and stop methods.''' to terminate.''' pass -class BatchRequest(object): - '''Base class for batch request interceptor. A subclass must -define the enqueue method.''' - def __init__(self, size, operation, proxy): - self._size = size - self._operation = operation - self._proxy = proxy - - def getSize(): - return self._size - - def getOperation(): - return self._operation - - def getProxy(): - return self._proxy - - def enqueue(): - '''Call enqueue from the batch request interceptor enqueue -implementation to confirm the batching a this request.''' - pass - class BatchRequestInterceptor(object): '''Base class for batch request interceptor. A subclass must define the enqueue method.''' @@ -849,7 +827,7 @@ define the enqueue method.''' def __init__(self): pass - def enqueue(request, queueCount, queueSize): + def enqueue(self, request, queueCount, queueSize): '''Invoked when a request is batched.''' pass diff --git a/python/python/Makefile b/python/python/Makefile index e8bc84429ff..f5bb725a3af 100644 --- a/python/python/Makefile +++ b/python/python/Makefile @@ -33,7 +33,7 @@ install:: | $(DESTDIR)$(install_pythondir)/Ice $(Q)$(INSTALL) -m 644 Ice/__init__.py $(DESTDIR)$(install_pythondir)/Ice # Ice/Future requires python >= 3.5 ifeq ($(shell $(PYTHON) -c "print(1 if $(python-version) >= 3.5 else 0)"),1) - $(Q)$(INSTALL) -d -m 755 $(DESTDIR)$(install_pythondir)/Ice/Py3 + $(Q)$(MKDIR) -p -m 755 $(DESTDIR)$(install_pythondir)/Ice/Py3 $(Q)$(INSTALL) -m 644 Ice/Py3/IceFuture.py $(DESTDIR)$(install_pythondir)/Ice/Py3/ endif diff --git a/python/test/Ice/custom/AllTests.py b/python/test/Ice/custom/AllTests.py index d0d7c73d220..7b0a634176c 100644 --- a/python/test/Ice/custom/AllTests.py +++ b/python/test/Ice/custom/AllTests.py @@ -125,6 +125,13 @@ def allTests(helper, communicator): test(v1[i] == v[i]) test(v2[i] == v[i]) + v = [] + v1, v2 = custom.opBoolSeq(array.array("b", v)) + test(isinstance(v1, array.array)) + test(isinstance(v2, array.array)) + test(len(v1) == 0) + test(len(v2) == 0) + v = [0, 2, 4, 8, 16, 32, 64, 127] v1, v2 = custom.opByteSeq(array.array("b", v)) test(isinstance(v1, array.array)) @@ -135,6 +142,13 @@ def allTests(helper, communicator): test(v1[i] == v[i]) test(v2[i] == v[i]) + v = [] + v1, v2 = custom.opByteSeq(array.array("b", v)) + test(isinstance(v1, array.array)) + test(isinstance(v2, array.array)) + test(len(v1) == 0) + test(len(v2) == 0) + v = [0, 2, 4, 8, 16, 32, 64, 128, 256] v1, v2 = custom.opShortSeq(array.array("h", v)) test(isinstance(v1, array.array)) @@ -145,6 +159,13 @@ def allTests(helper, communicator): test(v1[i] == v[i]) test(v2[i] == v[i]) + v = [] + v1, v2 = custom.opShortSeq(array.array("h", v)) + test(isinstance(v1, array.array)) + test(isinstance(v2, array.array)) + test(len(v1) == 0) + test(len(v2) == 0) + v = [0, 2, 4, 8, 16, 32, 64, 128, 256] v1, v2 = custom.opIntSeq(array.array("i", v)) test(isinstance(v1, array.array)) @@ -155,6 +176,13 @@ def allTests(helper, communicator): test(v1[i] == v[i]) test(v2[i] == v[i]) + v = [] + v1, v2 = custom.opIntSeq(array.array("i", v)) + test(isinstance(v1, array.array)) + test(isinstance(v2, array.array)) + test(len(v1) == 0) + test(len(v2) == 0) + # # The array "q" type specifier is new in Python 3.3 # @@ -169,6 +197,13 @@ def allTests(helper, communicator): test(v1[i] == v[i]) test(v2[i] == v[i]) + v = [] + v1, v2 = custom.opLongSeq(array.array("q", v)) + test(isinstance(v1, array.array)) + test(isinstance(v2, array.array)) + test(len(v1) == 0) + test(len(v2) == 0) + v = [0.1, 0.2, 0.4, 0.8, 0.16, 0.32, 0.64, 0.128, 0.256] v1, v2 = custom.opFloatSeq(array.array("f", v)) test(isinstance(v1, array.array)) @@ -179,6 +214,13 @@ def allTests(helper, communicator): test(round(v1[i], 1) == round(v[i], 1)) test(round(v2[i], 1) == round(v[i], 1)) + v = [] + v1, v2 = custom.opFloatSeq(array.array("f", v)) + test(isinstance(v1, array.array)) + test(isinstance(v2, array.array)) + test(len(v1) == 0) + test(len(v2) == 0) + v = [0.1, 0.2, 0.4, 0.8, 0.16, 0.32, 0.64, 0.128, 0.256] v1, v2 = custom.opDoubleSeq(array.array("d", v)) test(isinstance(v1, array.array)) @@ -189,6 +231,69 @@ def allTests(helper, communicator): test(round(v1[i], 1) == round(v[i], 1)) test(round(v2[i], 1) == round(v[i], 1)) + v = [] + v1, v2 = custom.opDoubleSeq(array.array("d", v)) + test(isinstance(v1, array.array)) + test(isinstance(v2, array.array)) + test(len(v1) == 0) + test(len(v2) == 0) + + + d = Test.D() + d.boolSeq = array.array("b", [True, False, True, False, True]) + d.byteSeq = array.array("b", [0, 2, 4, 8, 16, 32, 64, 127]) + d.shortSeq = array.array("h", [0, 2, 4, 8, 16, 32, 64, 128, 256]) + d.intSeq = array.array("i", [0, 2, 4, 8, 16, 32, 64, 128, 256]) + # + # The array "q" type specifier is new in Python 3.3 + # + if sys.version_info[:2] >= (3, 3): + d.longSeq = array.array("q", [0, 2, 4, 8, 16, 32, 64, 128, 256]) + d.floatSeq = array.array("f", [0.1, 0.2, 0.4, 0.8, 0.16, 0.32, 0.64, 0.128, 0.256]) + d.doubleSeq = array.array("d", [0.1, 0.2, 0.4, 0.8, 0.16, 0.32, 0.64, 0.128, 0.256]) + + d1 = custom.opD(d) + test(isinstance(d1.boolSeq, array.array)) + test(len(d1.boolSeq) == len(d.boolSeq)) + for i in range(len(d.boolSeq)): + test(d.boolSeq[i] == d1.boolSeq[i]) + + test(isinstance(d1.byteSeq, array.array)) + test(len(d1.byteSeq) == len(d.byteSeq)) + for i in range(len(d.byteSeq)): + test(d.byteSeq[i] == d1.byteSeq[i]) + + test(isinstance(d1.intSeq, array.array)) + test(len(d1.intSeq) == len(d.intSeq)) + for i in range(len(d.intSeq)): + test(d.intSeq[i] == d1.intSeq[i]) + + # + # The array "q" type specifier is new in Python 3.3 + # + if sys.version_info[:2] >= (3, 3): + test(isinstance(d1.longSeq, array.array)) + test(len(d1.longSeq) == len(d.longSeq)) + for i in range(len(d.longSeq)): + test(d.longSeq[i] == d1.longSeq[i]) + + test(isinstance(d1.floatSeq, array.array)) + test(len(d1.floatSeq) == len(d.floatSeq)) + for i in range(len(d.floatSeq)): + test(round(d.floatSeq[i], 1) == round(d1.floatSeq[i], 1)) + + test(isinstance(d1.doubleSeq, array.array)) + test(len(d1.doubleSeq) == len(d.doubleSeq)) + for i in range(len(d.doubleSeq)): + test(round(d.doubleSeq[i], 1) == round(d1.doubleSeq[i], 1)) + + d1 = custom.opD(Test.D()) + test(d1.boolSeq == Ice.Unset) + test(d1.byteSeq == Ice.Unset) + test(d1.intSeq == Ice.Unset) + test(d1.longSeq == Ice.Unset) + test(d1.floatSeq == Ice.Unset) + test(d1.doubleSeq == Ice.Unset) # # With python 3.3 we use the new buffer interface for marshaling # sequences of types that implement the buffer protocol and this @@ -290,6 +395,13 @@ def allTests(helper, communicator): test(v1[i] == v[i]) test(v2[i] == v[i]) + v = [] + v1, v2 = custom.opBoolSeq(numpy.array(v, numpy.bool_)) + test(isinstance(v1, numpy.ndarray)) + test(isinstance(v2, numpy.ndarray)) + test(len(v1) == 0) + test(len(v2) == 0) + v = [0, 2, 4, 8, 16, 32, 64, 127] v1, v2 = custom.opByteSeq(numpy.array(v, numpy.int8)) test(isinstance(v1, numpy.ndarray)) @@ -300,6 +412,13 @@ def allTests(helper, communicator): test(v1[i] == v[i]) test(v2[i] == v[i]) + v = [] + v1, v2 = custom.opByteSeq(numpy.array(v, numpy.int8)) + test(isinstance(v1, numpy.ndarray)) + test(isinstance(v2, numpy.ndarray)) + test(len(v1) == 0) + test(len(v2) == 0) + v = [0, 2, 4, 8, 16, 32, 64, 128, 256] v1, v2 = custom.opShortSeq(numpy.array(v, numpy.int16)) test(isinstance(v1, numpy.ndarray)) @@ -310,6 +429,13 @@ def allTests(helper, communicator): test(v1[i] == v[i]) test(v2[i] == v[i]) + v = [] + v1, v2 = custom.opShortSeq(numpy.array(v, numpy.int16)) + test(isinstance(v1, numpy.ndarray)) + test(isinstance(v2, numpy.ndarray)) + test(len(v1) == 0) + test(len(v2) == 0) + v = [0, 2, 4, 8, 16, 32, 64, 128, 256] v1, v2 = custom.opIntSeq(numpy.array(v, numpy.int32)) test(isinstance(v1, numpy.ndarray)) @@ -320,6 +446,13 @@ def allTests(helper, communicator): test(v1[i] == v[i]) test(v2[i] == v[i]) + v = [] + v1, v2 = custom.opIntSeq(numpy.array(v, numpy.int32)) + test(isinstance(v1, numpy.ndarray)) + test(isinstance(v2, numpy.ndarray)) + test(len(v1) == 0) + test(len(v2) == 0) + v = [0, 2, 4, 8, 16, 32, 64, 128, 256] v1, v2 = custom.opLongSeq(numpy.array(v, numpy.int64)) test(isinstance(v1, numpy.ndarray)) @@ -330,6 +463,13 @@ def allTests(helper, communicator): test(v1[i] == v[i]) test(v2[i] == v[i]) + v = [] + v1, v2 = custom.opLongSeq(numpy.array(v, numpy.int64)) + test(isinstance(v1, numpy.ndarray)) + test(isinstance(v2, numpy.ndarray)) + test(len(v1) == 0) + test(len(v2) == 0) + v = [0.1, 0.2, 0.4, 0.8, 0.16, 0.32, 0.64, 0.128, 0.256] v1, v2 = custom.opFloatSeq(numpy.array(v, numpy.float32)) test(isinstance(v1, numpy.ndarray)) @@ -340,6 +480,13 @@ def allTests(helper, communicator): test(round(float(v1[i]), 1) == round(v[i], 1)) test(round(float(v2[i]), 1) == round(v[i], 1)) + v = [] + v1, v2 = custom.opFloatSeq(numpy.array(v, numpy.float32)) + test(isinstance(v1, numpy.ndarray)) + test(isinstance(v2, numpy.ndarray)) + test(len(v1) == 0) + test(len(v2) == 0) + v = [0.1, 0.2, 0.4, 0.8, 0.16, 0.32, 0.64, 0.128, 0.256] v1, v2 = custom.opDoubleSeq(numpy.array(v, numpy.float64)) test(isinstance(v1, numpy.ndarray)) @@ -350,6 +497,61 @@ def allTests(helper, communicator): test(round(float(v1[i]), 1) == round(v[i], 1)) test(round(float(v2[i]), 1) == round(v[i], 1)) + v = [] + v1, v2 = custom.opDoubleSeq(numpy.array(v, numpy.float64)) + test(isinstance(v1, numpy.ndarray)) + test(isinstance(v2, numpy.ndarray)) + test(len(v1) == 0) + test(len(v2) == 0) + + d = Test.NumPy.D() + d.boolSeq = numpy.array([True, False, True, False, True], numpy.bool_) + d.byteSeq = numpy.array([0, 2, 4, 8, 16, 32, 64, 127], numpy.int8) + d.shortSeq = numpy.array([0, 2, 4, 8, 16, 32, 64, 128, 256], numpy.int16) + d.intSeq = numpy.array([0, 2, 4, 8, 16, 32, 64, 128, 256], numpy.int32) + d.longSeq = numpy.array([0, 2, 4, 8, 16, 32, 64, 128, 256], numpy.int64) + d.floatSeq = numpy.array([0.1, 0.2, 0.4, 0.8, 0.16, 0.32, 0.64, 0.128, 0.256], numpy.float32) + d.doubleSeq = numpy.array([0.1, 0.2, 0.4, 0.8, 0.16, 0.32, 0.64, 0.128, 0.256], numpy.float64) + + d1 = custom.opD(d) + test(isinstance(d1.boolSeq, numpy.ndarray)) + test(len(d1.boolSeq) == len(d.boolSeq)) + for i in range(len(d.boolSeq)): + test(d.boolSeq[i] == d1.boolSeq[i]) + + test(isinstance(d1.byteSeq, numpy.ndarray)) + test(len(d1.byteSeq) == len(d.byteSeq)) + for i in range(len(d.byteSeq)): + test(d.byteSeq[i] == d1.byteSeq[i]) + + test(isinstance(d1.intSeq, numpy.ndarray)) + test(len(d1.intSeq) == len(d.intSeq)) + for i in range(len(d.intSeq)): + test(d.intSeq[i] == d1.intSeq[i]) + + test(isinstance(d1.longSeq, numpy.ndarray)) + test(len(d1.longSeq) == len(d.longSeq)) + for i in range(len(d.longSeq)): + test(d.longSeq[i] == d1.longSeq[i]) + + test(isinstance(d1.floatSeq, numpy.ndarray)) + test(len(d1.floatSeq) == len(d.floatSeq)) + for i in range(len(d.floatSeq)): + test(round(d.floatSeq[i], 1) == round(d1.floatSeq[i], 1)) + + test(isinstance(d1.doubleSeq, numpy.ndarray)) + test(len(d1.doubleSeq) == len(d.doubleSeq)) + for i in range(len(d.doubleSeq)): + test(round(d.doubleSeq[i], 1) == round(d1.doubleSeq[i], 1)) + + d1 = custom.opD(Test.NumPy.D()) + test(d1.boolSeq == Ice.Unset) + test(d1.byteSeq == Ice.Unset) + test(d1.intSeq == Ice.Unset) + test(d1.longSeq == Ice.Unset) + test(d1.floatSeq == Ice.Unset) + test(d1.doubleSeq == Ice.Unset) + v1 = numpy.array([numpy.complex128(1 + 1j), numpy.complex128(2 + 2j), numpy.complex128(3 + 3j), @@ -360,6 +562,11 @@ def allTests(helper, communicator): for i in range(len(v1)): test(v1[i] == v2[i]) + v1 = numpy.array([], numpy.complex128) + v2 = custom.opComplex128Seq(v1) + test(isinstance(v2, numpy.ndarray)) + test(len(v1) == len(v2)) + v1 = custom.opBoolMatrix() test(numpy.array_equal(v1, numpy.array([[True, False, True], [True, False, True], diff --git a/python/test/Ice/custom/Server.py b/python/test/Ice/custom/Server.py index f035cfc3144..85b3ba6d02a 100755 --- a/python/test/Ice/custom/Server.py +++ b/python/test/Ice/custom/Server.py @@ -146,6 +146,9 @@ class CustomI(Test.Custom): def opBogusArrayNoCallableFactory(self, current): return [True, False, True, False] + def opD(self, d, current): + return d + def shutdown(self, current=None): current.adapter.getCommunicator().shutdown() @@ -223,6 +226,9 @@ if hasNumPy: def opBogusNumpyArrayType(self, current): return [True, False, True, False] + def opD(self, d, current): + return d + def shutdown(self, current=None): current.adapter.getCommunicator().shutdown() diff --git a/python/test/Ice/custom/Test.ice b/python/test/Ice/custom/Test.ice index db804daa591..bbc5ccae520 100644 --- a/python/test/Ice/custom/Test.ice +++ b/python/test/Ice/custom/Test.ice @@ -57,6 +57,17 @@ module Test ["python:seq:default"] StringTuple s4; } + class D + { + optional(1) BoolSeq1 boolSeq; + optional(2) ByteSeq1 byteSeq; + optional(3) ShortSeq1 shortSeq; + optional(4) IntSeq1 intSeq; + optional(5) LongSeq1 longSeq; + optional(6) FloatSeq1 floatSeq; + optional(7) DoubleSeq1 doubleSeq; + } + interface Custom { ByteString opByteString1(ByteString b1, out ByteString b2); @@ -93,6 +104,9 @@ module Test ["python:memoryview:Custom.myBogusArraySignatureFactory"]BoolSeq1 opBogusArraySignatureFactory(); ["python:memoryview:Custom.myNoCallableFactory"]BoolSeq1 opBogusArrayNoCallableFactory(); + + D opD(D d); + void shutdown(); } } diff --git a/python/test/Ice/custom/TestNumPy.ice b/python/test/Ice/custom/TestNumPy.ice index aea2256fd85..128f5c1d07d 100644 --- a/python/test/Ice/custom/TestNumPy.ice +++ b/python/test/Ice/custom/TestNumPy.ice @@ -31,6 +31,17 @@ module Test ["python:memoryview:Custom.myNumPyComplex128Seq"] sequence<byte> Complex128Seq; + class D + { + optional(1) BoolSeq1 boolSeq; + optional(2) ByteSeq1 byteSeq; + optional(3) ShortSeq1 shortSeq; + optional(4) IntSeq1 intSeq; + optional(5) LongSeq1 longSeq; + optional(6) FloatSeq1 floatSeq; + optional(7) DoubleSeq1 doubleSeq; + } + interface Custom { BoolSeq1 opBoolSeq(BoolSeq1 v1, out BoolSeq2 v2); @@ -52,6 +63,8 @@ module Test ["python:memoryview:Custom.myBogusNumpyArrayType"]BoolSeq1 opBogusNumpyArrayType(); + D opD(D d); + void shutdown(); } } diff --git a/ruby/src/IceRuby/Types.cpp b/ruby/src/IceRuby/Types.cpp index d25cc274331..fb9aefe3ce8 100644 --- a/ruby/src/IceRuby/Types.cpp +++ b/ruby/src/IceRuby/Types.cpp @@ -270,7 +270,8 @@ IceRuby::StreamUtil::setSlicedDataMember(VALUE obj, const Ice::SlicedDataPtr& sl // // bytes // - volatile VALUE bytes = callRuby(rb_str_new, reinterpret_cast<const char*>(&(*p)->bytes[0]), + volatile VALUE bytes = callRuby(rb_str_new, + (*p)->bytes.empty() ? 0 : reinterpret_cast<const char*>(&(*p)->bytes[0]), static_cast<long>((*p)->bytes.size())); callRuby(rb_iv_set, slice, "@bytes", bytes); @@ -1187,7 +1188,7 @@ IceRuby::SequenceInfo::marshal(VALUE p, Ice::OutputStream* os, ObjectMap* object volatile VALUE arr = Qnil; - Ice::OutputStream::size_type sizePos; + Ice::OutputStream::size_type sizePos = 0; if(optional) { if(elementType->variableLength()) @@ -1431,7 +1432,7 @@ IceRuby::SequenceInfo::marshalPrimitiveSequence(const PrimitiveInfoPtr& pi, VALU } seq[static_cast<size_t>(i)] = static_cast<Ice::Byte>(val); } - os->write(&seq[0], &seq[0] + seq.size()); + os->write(seq); } break; } @@ -1448,7 +1449,7 @@ IceRuby::SequenceInfo::marshalPrimitiveSequence(const PrimitiveInfoPtr& pi, VALU } seq[static_cast<size_t>(i)] = static_cast<Ice::Short>(val); } - os->write(&seq[0], &seq[0] + seq.size()); + os->write(seq); break; } case PrimitiveInfo::KindInt: @@ -1464,7 +1465,7 @@ IceRuby::SequenceInfo::marshalPrimitiveSequence(const PrimitiveInfoPtr& pi, VALU } seq[static_cast<size_t>(i)] = static_cast<Ice::Int>(val); } - os->write(&seq[0], &seq[0] + seq.size()); + os->write(seq); break; } case PrimitiveInfo::KindLong: @@ -1475,7 +1476,7 @@ IceRuby::SequenceInfo::marshalPrimitiveSequence(const PrimitiveInfoPtr& pi, VALU { seq[static_cast<size_t>(i)] = getLong(RARRAY_AREF(arr, i)); } - os->write(&seq[0], &seq[0] + seq.size()); + os->write(seq); break; } case PrimitiveInfo::KindFloat: @@ -1492,7 +1493,7 @@ IceRuby::SequenceInfo::marshalPrimitiveSequence(const PrimitiveInfoPtr& pi, VALU assert(TYPE(v) == T_FLOAT); seq[static_cast<size_t>(i)] = static_cast<Ice::Float>(RFLOAT_VALUE(v)); } - os->write(&seq[0], &seq[0] + seq.size()); + os->write(seq); break; } case PrimitiveInfo::KindDouble: @@ -1509,7 +1510,7 @@ IceRuby::SequenceInfo::marshalPrimitiveSequence(const PrimitiveInfoPtr& pi, VALU assert(TYPE(v) == T_FLOAT); seq[static_cast<size_t>(i)] = RFLOAT_VALUE(v); } - os->write(&seq[0], &seq[0] + seq.size()); + os->write(seq); break; } case PrimitiveInfo::KindString: @@ -1520,11 +1521,18 @@ IceRuby::SequenceInfo::marshalPrimitiveSequence(const PrimitiveInfoPtr& pi, VALU { seq[static_cast<size_t>(i)] = getString(RARRAY_AREF(arr, i)); } + if(seq.empty()) + { + os->write(seq); + } + else + { #ifdef HAVE_RUBY_ENCODING_H - os->write(&seq[0], &seq[0] + seq.size(), false); // Bypass string conversion. + os->write(&seq[0], &seq[0] + seq.size(), false); // Bypass string conversion. #else - os->write(&seq[0], &seq[0] + seq.size(), true); + os->write(&seq[0], &seq[0] + seq.size(), true); #endif + } break; } } @@ -2353,7 +2361,7 @@ IceRuby::ProxyInfo::optionalFormat() const void IceRuby::ProxyInfo::marshal(VALUE p, Ice::OutputStream* os, ObjectMap*, bool optional) { - Ice::OutputStream::size_type sizePos; + Ice::OutputStream::size_type sizePos = 0; if(optional) { sizePos = os->startSize(); diff --git a/scripts/Component.py b/scripts/Component.py index 8ad3da16de1..bf97d47541d 100644 --- a/scripts/Component.py +++ b/scripts/Component.py @@ -120,7 +120,7 @@ class Ice(Component): # if parent in ["Glacier2", "IceStorm", "IceGrid"]: return False - elif isinstance(platform, Linux): + elif isinstance(platform, Windows): # # On Windows, if testing with a binary distribution, don't test Glacier2/IceBridge services # with the Debug configurations since we don't provide binaries for them. @@ -145,7 +145,6 @@ class Ice(Component): if current.config.ipv6 and testId in ["Ice/udp"]: return False - # IceSSL test doesn't work on macOS/.NET Core if isinstance(mapping, CSharpMapping) and isinstance(platform, Darwin) and parent in ["IceSSL"]: return False @@ -228,29 +227,25 @@ for m in filter(lambda x: os.path.isdir(os.path.join(toplevel, x)), os.listdir(t elif m == "python" or re.match("python-.*", m): Mapping.add(m, PythonMapping(), component) elif m == "ruby" or re.match("ruby-.*", m): - Mapping.add(m, RubyMapping(), component) + Mapping.add(m, RubyMapping(), component, enable=not isinstance(platform, Windows)) elif m == "php" or re.match("php-.*", m): Mapping.add(m, PhpMapping(), component) elif m == "js" or re.match("js-.*", m): - Mapping.add(m, JavaScriptMapping(), component) - Mapping.add("typescript", TypeScriptMapping(), component, "js") + Mapping.add(m, JavaScriptMapping(), component, enable=platform.hasNodeJS()) + Mapping.add("typescript", TypeScriptMapping(), component, "js", enable=platform.hasNodeJS()) elif m == "objective-c" or re.match("objective-c-*", m): Mapping.add(m, ObjCMapping(), component) - elif m == "csharp" or re.match("csharp-.*", m): - Mapping.add("csharp", CSharpMapping(), component) elif m == "swift" or re.match("swift-.*", m): Mapping.add("swift", SwiftMapping(), component) + elif m == "csharp" or re.match("charp-.*", m): + Mapping.add("csharp", CSharpMapping(), component, enable=isinstance(platform, Windows) or platform.hasDotNet()) if isinstance(platform, Windows): # Windows doesn't support all the mappings, we take them out here. - Mapping.remove("ruby") - if platform.getCompiler() != "v140": - Mapping.remove("python") if platform.getCompiler() not in ["v140", "v141"]: - Mapping.remove("php") -elif not platform.hasDotNet(): - # Remove C# if Dot Net Core isn't supported - Mapping.remove("csharp") + Mapping.disable("python") + if platform.getCompiler() not in ["v140", "v141"]: + Mapping.disable("php") # # Check if Matlab is installed and eventually add the Matlab mapping diff --git a/scripts/Controller.py b/scripts/Controller.py index 30c1d0dcb13..f0337fc7d7e 100755 --- a/scripts/Controller.py +++ b/scripts/Controller.py @@ -139,7 +139,8 @@ class ControllerDriver(Driver): self.testcase = None current = self.driver.getCurrent(mapping, testsuite, testcase, cross) - self.testcase = Test.Common.TestCasePrx.uncheckedCast(c.adapter.addWithUUID(TestCaseI(self.driver, current))) + prx = c.adapter.addWithUUID(TestCaseI(self.driver, current)) + self.testcase = Test.Common.TestCasePrx.uncheckedCast(c.adapter.createDirectProxy(prx.ice_getIdentity())) return self.testcase def getTestSuites(self, mapping, c): diff --git a/scripts/IceBoxUtil.py b/scripts/IceBoxUtil.py index 7fe14976af2..b9c598bc5c9 100644 --- a/scripts/IceBoxUtil.py +++ b/scripts/IceBoxUtil.py @@ -45,6 +45,9 @@ class IceBox(ProcessFromBinDir, Server): platform.getLinuxId() in ["centos", "rhel", "fedora"] and \ current.config.buildPlatform == "x86": name += "32" # Multilib platform + if isinstance(platform, AIX) and \ + current.config.buildPlatform == "ppc": + name += "_32" if current.config.cpp11: name += "++11" return name @@ -75,5 +78,8 @@ class IceBoxAdmin(ProcessFromBinDir, ProcessIsReleaseOnly, Client): return "IceBox.Admin" elif isinstance(mapping, JavaMapping): return "com.zeroc.IceBox.Admin" + elif isinstance(platform, AIX) and \ + current.config.buildPlatform == "ppc": + return "iceboxadmin_32" else: return "iceboxadmin" diff --git a/scripts/IceGridUtil.py b/scripts/IceGridUtil.py index 3482d22557f..399596001a7 100644 --- a/scripts/IceGridUtil.py +++ b/scripts/IceGridUtil.py @@ -114,10 +114,11 @@ class IceGridNode(ProcessFromBinDir, Server): class IceGridRegistry(ProcessFromBinDir, Server): - def __init__(self, name, portnum=20, readyCount=5, *args, **kargs): + def __init__(self, name, portnum=20, ready="AdminSessionManager", *args, **kargs): Server.__init__(self, "icegridregistry", mapping=Mapping.getByName("cpp"), desc="IceGrid registry " + name, - readyCount=readyCount, *args, **kargs) + ready=ready, *args, **kargs) self.portnum = portnum + self.readyCount = -1 self.name = name def setup(self, current): diff --git a/scripts/NetworkProxy.py b/scripts/NetworkProxy.py index 5633049a493..e14ea7f54fb 100644 --- a/scripts/NetworkProxy.py +++ b/scripts/NetworkProxy.py @@ -2,9 +2,15 @@ # Copyright (c) ZeroC, Inc. All rights reserved. # -import sys, os, threading, socket, select +import sys +import threading +import socket +import select + + +class InvalidRequest(Exception): + pass -class InvalidRequest(Exception): pass class BaseConnection(threading.Thread): def __init__(self, socket, remote): @@ -28,6 +34,7 @@ class BaseConnection(threading.Thread): if self.socket: self.socket.close() self.socket = None + if self.remoteSocket: self.remoteSocket.close() self.remoteSocket = None @@ -43,30 +50,32 @@ class BaseConnection(threading.Thread): self.socket.send(self.response(True)) except: self.socket.send(self.response(False)) + self.remoteSocket.close() return try: while(not self.closed): readables, writeables, exceptions = select.select([self.socket, self.remoteSocket], [], []) for r in readables: - w = self.remoteSocket if r == self.socket else self.socket + w = self.remoteSocket if r == self.socket else self.socket data = r.recv(4096) if(len(data) == 0): self.closed = True break w.send(data) - except InvalidRequest as ex: + except InvalidRequest: print("invalid request") - except Exception as ex: - #print(ex) + except Exception: pass + finally: + if self.socket: + self.socket.close() + if self.remoteSocket: + self.remoteSocket.close() - except Exception as ex: - #print(ex) + except Exception: pass - finally: - self.close() class BaseProxy(threading.Thread): def __init__(self, port): @@ -103,6 +112,8 @@ class BaseProxy(threading.Thread): self.cond.notify() except Exception as ex: self.failed = ex + self.socket.close() + self.socket = None self.cond.notify() return @@ -117,6 +128,7 @@ class BaseProxy(threading.Thread): pass finally: self.socket.close() + self.socket = None def terminate(self): with self.cond: @@ -130,23 +142,24 @@ class BaseProxy(threading.Thread): except Exception as ex: print(ex) - connectToSelf = socket.socket(socket.AF_INET, socket.SOCK_STREAM) try: + connectToSelf = socket.socket(socket.AF_INET, socket.SOCK_STREAM) connectToSelf.connect(("127.0.0.1", self.port)) except Exception as ex: print(ex) finally: connectToSelf.close() - + connectToSelf = None self.join() + class SocksConnection(BaseConnection): def request(self, s): def decode(c): return ord(c) if sys.version_info[0] == 2 else c - data = s.recv(9) # Read the 9 bytes request + data = s.recv(9) # Read the 9 bytes request if not data or len(data) == 0: raise InvalidRequest @@ -171,13 +184,15 @@ class SocksConnection(BaseConnection): packet += encode(0) packet += encode(0) packet += encode(0) - return packet if sys.version_info[0] == 2 else bytes(packet,"ascii") + return packet if sys.version_info[0] == 2 else bytes(packet, "ascii") + class SocksProxy(BaseProxy): def createConnection(self, socket, peer): return SocksConnection(socket, peer) + class HttpConnection(BaseConnection): def request(self, s): @@ -205,10 +220,11 @@ class HttpConnection(BaseConnection): def response(self, success): if(success): - s = "HTTP/1.1 200 OK\r\nServer: CERN/3.0 libwww/2.17\r\n\r\n"; + s = "HTTP/1.1 200 OK\r\nServer: CERN/3.0 libwww/2.17\r\n\r\n" else: - s = "HTTP/1.1 404\r\n\r\n"; - return s if sys.version_info[0] == 2 else bytes(s,"ascii") + s = "HTTP/1.1 404\r\n\r\n" + return s if sys.version_info[0] == 2 else bytes(s, "ascii") + class HttpProxy(BaseProxy): diff --git a/scripts/Util.py b/scripts/Util.py index bdfc593e842..e078d44ab8e 100644 --- a/scripts/Util.py +++ b/scripts/Util.py @@ -219,6 +219,8 @@ class Platform(object): except: self.nugetPackageCache = None + self._hasNodeJS = None + def init(self, component): self.parseBuildVariables(component, { "supported-platforms" : ("supportedPlatforms", lambda s : s.split(" ")), @@ -228,6 +230,15 @@ class Platform(object): def hasDotNet(self): return self.nugetPackageCache != None + def hasNodeJS(self): + if self._hasNodeJS is None: + try: + run("node --version") + self._hasNodeJS = True + except: + self._hasNodeJS = False + return self._hasNodeJS + def parseBuildVariables(self, component, variables): # Run make to get the values of the given variables if os.path.exists(os.path.join(component.getSourceDir(), "Makefile")): # Top level makefile @@ -307,6 +318,13 @@ class AIX(Platform): def hasOpenSSL(self): return True + def _getLibDir(self, component, process, mapping, current): + installDir = component.getInstallDir(mapping, current) + return os.path.join(installDir, "lib32" if current.config.buildPlatform == "ppc" else "lib") + + def getDefaultBuildPlatform(self): + return "ppc64" + class Linux(Platform): def __init__(self): @@ -522,6 +540,7 @@ similar. class Mapping(object): mappings = OrderedDict() + disabled = OrderedDict() class Config(object): @@ -781,17 +800,29 @@ class Mapping(object): return mappings @classmethod - def add(self, name, mapping, component, path=None): + def add(self, name, mapping, component, path=None, enable=True): name = name.replace("\\", "/") - self.mappings[name] = mapping.init(name, component, path) + m = mapping.init(name, component, path) + if enable: + self.mappings[name] = m + else: + self.disabled[name] = m + + @classmethod + def disable(self, name): + m = self.mappings[name] + if m: + self.disabled[name] = m + del self.mappings[name] @classmethod def remove(self, name): del self.mappings[name] @classmethod - def getAll(self, driver=None): - return [m for m in self.mappings.values() if not driver or driver.matchLanguage(str(m))] + def getAll(self, driver=None, includeDisabled=False): + return [m for m in self.mappings.values() if not driver or driver.matchLanguage(str(m))] + \ + ([m for m in self.disabled.values() if not driver or driver.matchLanguage(str(m))] if includeDisabled else []) def __init__(self, path=None): self.name = None @@ -1357,6 +1388,9 @@ class ProcessFromBinDir: def isFromBinDir(self): return True + def getExe(self, current): + return self.exe + "_32" if current.config.buildPlatform == "ppc" else self.exe + # # Executables for processes inheriting this marker class are only provided # as a Release executble on Windows @@ -3118,6 +3152,11 @@ class CppMapping(Mapping): if not isinstance(platform, Darwin): libPaths.append(self.component.getLibDir(process, self, current)) + # On AIX we also need to add the lib directory for the TestCommon library + # when testing against a binary distribution + if isinstance(platform, AIX) and self.component.useBinDist(self, current): + libPaths.append(os.path.join(self.path, "lib32" if current.config.buildPlatform == "ppc" else "lib")) + # # Add the test suite library directories to the platform library path environment variable. # @@ -3259,6 +3298,16 @@ class JavaMapping(Mapping): class JavaCompatMapping(JavaMapping): + class Config(JavaMapping.Config): + + @classmethod + def usage(self): + print("") + print("Java Compat Mapping options:") + print("--android Run the Android tests.") + print("--device=<device-id> ID of the Android emulator or device used to run the tests.") + print("--avd=<name> Start specific Android Virtual Device.") + def getPluginEntryPoint(self, plugin, process, current): return { "IceSSL" : "IceSSL.PluginFactory", @@ -3789,6 +3838,23 @@ class TypeScriptMapping(JavaScriptMixin,Mapping): class Config(Mapping.Config): + @classmethod + def getSupportedArgs(self): + return ("", ["browser=", "worker"]) + + @classmethod + def usage(self): + print("") + print("TypeScript mapping options:") + print("--browser=<name> Run with the given browser.") + print("--worker Run with Web workers enabled.") + + def __init__(self, options=[]): + Mapping.Config.__init__(self, options) + + if self.browser and self.protocol == "tcp": + self.protocol = "ws" + def canRun(self, testId, current): return Mapping.Config.canRun(self, testId, current) and self.browser != "Ie" # IE doesn't support ES6 @@ -3915,7 +3981,7 @@ def runTests(mappings=None, drivers=None): try: options = [Driver.getSupportedArgs(), Mapping.Config.getSupportedArgs()] options += [driver.getSupportedArgs() for driver in drivers] - options += [mapping.Config.getSupportedArgs() for mapping in Mapping.getAll()] + options += [mapping.Config.getSupportedArgs() for mapping in Mapping.getAll(includeDisabled=True)] shortOptions = "h" longOptions = ["help"] for so, lo in options: diff --git a/scripts/tests/Ice/objects.py b/scripts/tests/Ice/objects.py index fe972e7d547..70ce1b8eba0 100644 --- a/scripts/tests/Ice/objects.py +++ b/scripts/tests/Ice/objects.py @@ -20,6 +20,13 @@ class ObjectClientServerTestCase(ClientServerTestCase): # test on arm64 devices with a debug Ice libraries which require lots of stack space. # props["Ice.ThreadPool.Server.StackSize"] = 768 * 1024 + elif current.config.buildPlatform == "ppc": + # + # The AIX ppc default stack size is too small + # + props["Ice.ThreadPool.Server.StackSize"] = 256 * 1024 + elif current.config.buildPlatform == "ppc64": + props["Ice.ThreadPool.Server.StackSize"] = 768 * 1024 return props testcases = [ diff --git a/scripts/tests/IceDiscovery/simple.py b/scripts/tests/IceDiscovery/simple.py index cac139890e7..c34907d0f9d 100644 --- a/scripts/tests/IceDiscovery/simple.py +++ b/scripts/tests/IceDiscovery/simple.py @@ -34,7 +34,13 @@ def suppressWarning(x): # Filter-out the warning about invalid lookup proxy outfilters = [ lambda x: suppressWarning(x) ] +options = None +if isinstance(platform,AIX): + # AIX test VMs only have IPv6 enabled on the loopback interface + # where multicast doesn't work + options = { "ipv6" : [False] } + TestSuite(__name__, [ ClientServerTestCase(client=Client(args=[3], props=props, outfilters=outfilters), servers=[Server(args=[i], readyCount=4, props=props) for i in range(0, 3)]) -], multihost=False) +], multihost=False, options=options) |