diff options
author | Benoit Foucher <benoit@zeroc.com> | 2019-09-25 17:26:36 +0200 |
---|---|---|
committer | Benoit Foucher <benoit@zeroc.com> | 2019-09-25 17:46:22 +0200 |
commit | 4058ada173f6e868e70a667078f5a770ae8efa7c (patch) | |
tree | 5ecc854afb72d695589e83df666a080a58681ad9 /python/test/Ice | |
parent | Update .NET Core default target framework to .netcoreapp3.0 (diff) | |
download | ice-4058ada173f6e868e70a667078f5a770ae8efa7c.tar.bz2 ice-4058ada173f6e868e70a667078f5a770ae8efa7c.tar.xz ice-4058ada173f6e868e70a667078f5a770ae8efa7c.zip |
Fixed Python bug related to invalid return parameters, fixes #550
Diffstat (limited to 'python/test/Ice')
-rw-r--r-- | python/test/Ice/exceptions/AllTests.py | 19 | ||||
-rwxr-xr-x | python/test/Ice/exceptions/ServerAMD.py | 6 | ||||
-rw-r--r-- | python/test/Ice/exceptions/Test.ice | 2 | ||||
-rw-r--r-- | python/test/Ice/exceptions/TestI.py | 6 | ||||
-rw-r--r-- | python/test/Ice/servantLocator/AllTests.py | 12 | ||||
-rw-r--r-- | python/test/Ice/servantLocator/TestAMDI.py | 6 | ||||
-rw-r--r-- | python/test/Ice/servantLocator/TestI.py | 6 |
7 files changed, 57 insertions, 0 deletions
diff --git a/python/test/Ice/exceptions/AllTests.py b/python/test/Ice/exceptions/AllTests.py index 3aa59ab16f4..762058d61ef 100644 --- a/python/test/Ice/exceptions/AllTests.py +++ b/python/test/Ice/exceptions/AllTests.py @@ -813,6 +813,25 @@ def allTests(helper, communicator): print("ok") + sys.stdout.write("catching unknown non-Ice exception with futures... ") + sys.stdout.flush() + try: + try: + thrower.throwMarshalException(context={"response":""}) + except Ice.UnknownLocalException as ex: + test("::Ice::MarshalException" in str(ex)) + try: + thrower.throwMarshalException(context={"param":""}) + except Ice.UnknownLocalException as ex: + test("::Ice::MarshalException" in str(ex)) + try: + thrower.throwMarshalException() + except Ice.UnknownLocalException as ex: + test("::Ice::MarshalException" in str(ex)) + except Ice.OperationNotExistException: + pass + print("ok") + sys.stdout.write("catching exact types with AMI mapping... ") sys.stdout.flush() diff --git a/python/test/Ice/exceptions/ServerAMD.py b/python/test/Ice/exceptions/ServerAMD.py index 8bd9a6f35a8..b9418e7e29d 100755 --- a/python/test/Ice/exceptions/ServerAMD.py +++ b/python/test/Ice/exceptions/ServerAMD.py @@ -136,6 +136,12 @@ class ThrowerI(Test.Thrower): f.set_exception(Test.A()) return f + def throwMarshalException(self, current): + if "return" in current.ctx: + return Ice.Future.completed(("", 0)) + if "param" in current.ctx: + return Ice.Future.completed((0, "")) + return Ice.Future.completed(None) class ServerAMD(TestHelper): diff --git a/python/test/Ice/exceptions/Test.ice b/python/test/Ice/exceptions/Test.ice index adbcdcf3c9c..c9513cfa3ec 100644 --- a/python/test/Ice/exceptions/Test.ice +++ b/python/test/Ice/exceptions/Test.ice @@ -71,6 +71,8 @@ interface Thrower void throwAfterResponse(); void throwAfterException() throws A; + + int throwMarshalException(out int p); } interface WrongOperation diff --git a/python/test/Ice/exceptions/TestI.py b/python/test/Ice/exceptions/TestI.py index d4ea54c5df1..65860b6cad6 100644 --- a/python/test/Ice/exceptions/TestI.py +++ b/python/test/Ice/exceptions/TestI.py @@ -101,3 +101,9 @@ class ThrowerI(Test.Thrower): # Only relevant for AMD. # raise Test.A() + + def throwMarshalException(self, current): + if "return" in current.ctx: + return ("", 0) + if "param" in current.ctx: + return (0, "") diff --git a/python/test/Ice/servantLocator/AllTests.py b/python/test/Ice/servantLocator/AllTests.py index 2aabd9103de..19bcf51e56f 100644 --- a/python/test/Ice/servantLocator/AllTests.py +++ b/python/test/Ice/servantLocator/AllTests.py @@ -217,4 +217,16 @@ def allTests(helper, communicator): test(False) print("ok") + sys.stdout.write("testing invalid locate return values ... ") + sys.stdout.flush() + try: + communicator.stringToProxy("invalidReturnValue:{0}".format(helper.getTestEndpoint())).ice_ping() + except Ice.ObjectNotExistException: + pass + try: + communicator.stringToProxy("invalidReturnType:{0}".format(helper.getTestEndpoint())).ice_ping() + except Ice.ObjectNotExistException: + pass + print ("ok") + return obj diff --git a/python/test/Ice/servantLocator/TestAMDI.py b/python/test/Ice/servantLocator/TestAMDI.py index 0fc254af645..dae02342251 100644 --- a/python/test/Ice/servantLocator/TestAMDI.py +++ b/python/test/Ice/servantLocator/TestAMDI.py @@ -101,6 +101,12 @@ class ServantLocatorI(Ice.ServantLocator): if current.id.name == "unknown": return None + if current.id.name == "invalidReturnValue": + return (45, 12) + + if current.id.name == "invalidReturnType": + return "invalid" + test(current.id.name == "locate" or current.id.name == "finished") if current.id.name == "locate": self.exception(current) diff --git a/python/test/Ice/servantLocator/TestI.py b/python/test/Ice/servantLocator/TestI.py index 9e2345b0fe9..0ffe602ea49 100644 --- a/python/test/Ice/servantLocator/TestI.py +++ b/python/test/Ice/servantLocator/TestI.py @@ -89,6 +89,12 @@ class ServantLocatorI(Ice.ServantLocator): if current.id.name == "unknown": return None + if current.id.name == "invalidReturnValue": + return (45, 12) + + if current.id.name == "invalidReturnType": + return "invalid" + test(current.id.name == "locate" or current.id.name == "finished") if current.id.name == "locate": self.exception(current) |