diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 65621055dc2..b27136cb595 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -83,7 +83,8 @@ jobs: test_flags: "--all-cross" - os: macos-15 config: "cross" - test_flags: "--all-cross" + # We want to test C++ and Swift only (in each direction) + test_flags: "--all-cross --filter cpp --filter swift" runs-on: ${{ matrix.os }} steps: diff --git a/cpp/test/Ice/ami/AllTests.cpp b/cpp/test/Ice/ami/AllTests.cpp index 3db828b8335..f61b3ece9fc 100644 --- a/cpp/test/Ice/ami/AllTests.cpp +++ b/cpp/test/Ice/ami/AllTests.cpp @@ -1258,26 +1258,31 @@ allTests(TestHelper* helper, bool collocated) if (p->ice_getConnection()) { - cout << "testing back pressure... " << flush; + if (p->supportsBackPressureTests()) { - // Keep the 3 server thread pool threads busy. - auto sleep1Future = p->sleepAsync(1000); - auto sleep2Future = p->sleepAsync(1000); - auto sleep3Future = p->sleepAsync(1000); - - auto onewayProxy = Ice::uncheckedCast(p->ice_oneway()); - - // Sending should block because the TCP send/receive buffer size on the server is set to 50KB. - Ice::ByteSeq seq; - seq.resize(768 * 1024); - auto future = onewayProxy->opWithPayloadAsync(seq); - - test(future.wait_for(200ms) == future_status::timeout && sleep1Future.wait_for(0s) != future_status::ready); - sleep1Future.wait(); - sleep2Future.wait(); - sleep3Future.wait(); + cout << "testing back pressure... " << flush; + { + // Keep the 3 server thread pool threads busy. + auto sleep1Future = p->sleepAsync(1000); + auto sleep2Future = p->sleepAsync(1000); + auto sleep3Future = p->sleepAsync(1000); + + auto onewayProxy = Ice::uncheckedCast(p->ice_oneway()); + + // Sending should block because the TCP send/receive buffer size on the server is set to 50KB. + Ice::ByteSeq seq; + seq.resize(768 * 1024); + auto future = onewayProxy->opWithPayloadAsync(seq); + + test( + future.wait_for(200ms) == future_status::timeout && + sleep1Future.wait_for(0s) != future_status::ready); + sleep1Future.wait(); + sleep2Future.wait(); + sleep3Future.wait(); + } + cout << "ok" << endl; } - cout << "ok" << endl; cout << "testing bi-dir... " << flush; auto adapter = communicator->createObjectAdapter(""); diff --git a/cpp/test/Ice/ami/Test.ice b/cpp/test/Ice/ami/Test.ice index 652ee536132..040f7675503 100644 --- a/cpp/test/Ice/ami/Test.ice +++ b/cpp/test/Ice/ami/Test.ice @@ -43,6 +43,7 @@ interface TestIntf bool supportsAMD(); bool supportsFunctionalTests(); + bool supportsBackPressureTests(); ["amd"] void pingBiDir(PingReply* reply); } diff --git a/cpp/test/Ice/ami/TestI.cpp b/cpp/test/Ice/ami/TestI.cpp index b19827ffe1e..c6c33b8686f 100644 --- a/cpp/test/Ice/ami/TestI.cpp +++ b/cpp/test/Ice/ami/TestI.cpp @@ -172,6 +172,12 @@ TestIntfI::supportsFunctionalTests(const Ice::Current&) return false; } +bool +TestIntfI::supportsBackPressureTests(const Ice::Current&) +{ + return true; +} + void TestIntfI::pingBiDirAsync( optional reply, diff --git a/cpp/test/Ice/ami/TestI.h b/cpp/test/Ice/ami/TestI.h index 315087e956e..89152b63b9b 100644 --- a/cpp/test/Ice/ami/TestI.h +++ b/cpp/test/Ice/ami/TestI.h @@ -46,6 +46,7 @@ class TestIntfI final : public Test::TestIntf bool supportsAMD(const Ice::Current&) final; bool supportsFunctionalTests(const Ice::Current&) final; + bool supportsBackPressureTests(const Ice::Current&) final; void pingBiDirAsync( std::optional, diff --git a/csharp/test/Ice/ami/AllTests.cs b/csharp/test/Ice/ami/AllTests.cs index f845076637b..fe09a80a165 100644 --- a/csharp/test/Ice/ami/AllTests.cs +++ b/csharp/test/Ice/ami/AllTests.cs @@ -97,22 +97,22 @@ private void switch (_t) { case ThrowType.LocalException: - { - throw new Ice.ObjectNotExistException(); - } + { + throw new Ice.ObjectNotExistException(); + } case ThrowType.UserException: - { - throw new Test.TestIntfException(); - } + { + throw new Test.TestIntfException(); + } case ThrowType.OtherException: - { - throw new System.Exception(); - } + { + throw new System.Exception(); + } default: - { - Debug.Assert(false); - break; - } + { + Debug.Assert(false); + break; + } } } @@ -896,34 +896,37 @@ public static async Task allTestsAsync(global::Test.TestHelper helper, bool coll } output.WriteLine("ok"); - output.Write("testing back pressure... "); - output.Flush(); + if (p.supportsBackPressureTests()) { - // Keep the 3 server thread pool threads busy. - Task sleep1Task = p.sleepAsync(1000); - Task sleep2Task = p.sleepAsync(1000); - Task sleep3Task = p.sleepAsync(1000); - bool canceled = false; - using var cts = new CancellationTokenSource(200); - try + output.Write("testing back pressure... "); + output.Flush(); { - var onewayProxy = (Test.TestIntfPrx)p.ice_oneway(); + // Keep the 3 server thread pool threads busy. + Task sleep1Task = p.sleepAsync(1000); + Task sleep2Task = p.sleepAsync(1000); + Task sleep3Task = p.sleepAsync(1000); + bool canceled = false; + using var cts = new CancellationTokenSource(200); + try + { + var onewayProxy = (Test.TestIntfPrx)p.ice_oneway(); - // Sending should be canceled because the TCP send/receive buffer size on the server is set - // to 50KB. Note: we don't use the cancel parameter of the operation here because the - // cancellation doesn't cancel the operation whose payload is being sent. - await onewayProxy.opWithPayloadAsync(new byte[768 * 1024]).WaitAsync(cts.Token); - } - catch (OperationCanceledException) - { - canceled = true; + // Sending should be canceled because the TCP send/receive buffer size on the server is set + // to 50KB. Note: we don't use the cancel parameter of the operation here because the + // cancellation doesn't cancel the operation whose payload is being sent. + await onewayProxy.opWithPayloadAsync(new byte[768 * 1024]).WaitAsync(cts.Token); + } + catch (OperationCanceledException) + { + canceled = true; + } + test(canceled && !sleep1Task.IsCompleted); + await sleep1Task; + await sleep2Task; + await sleep3Task; } - test(canceled && !sleep1Task.IsCompleted); - await sleep1Task; - await sleep2Task; - await sleep3Task; + output.WriteLine("ok"); } - output.WriteLine("ok"); p.shutdown(); } diff --git a/csharp/test/Ice/ami/Test.ice b/csharp/test/Ice/ami/Test.ice index 095f815b45c..4bafec2996e 100644 --- a/csharp/test/Ice/ami/Test.ice +++ b/csharp/test/Ice/ami/Test.ice @@ -40,6 +40,7 @@ interface TestIntf bool supportsAMD(); bool supportsFunctionalTests(); + bool supportsBackPressureTests(); ["amd"] void opAsyncDispatch(); ["amd"] int opWithResultAsyncDispatch(); diff --git a/csharp/test/Ice/ami/TestI.cs b/csharp/test/Ice/ami/TestI.cs index 2bd7825e29b..50a45f0ac92 100644 --- a/csharp/test/Ice/ami/TestI.cs +++ b/csharp/test/Ice/ami/TestI.cs @@ -121,6 +121,12 @@ public override bool return false; } + public override bool + supportsBackPressureTests(Ice.Current current) + { + return true; + } + public override async Task opAsyncDispatchAsync(Ice.Current current) { diff --git a/java/test/src/main/java/test/Ice/ami/AllTests.java b/java/test/src/main/java/test/Ice/ami/AllTests.java index c4b065391ae..db79a8e2511 100644 --- a/java/test/src/main/java/test/Ice/ami/AllTests.java +++ b/java/test/src/main/java/test/Ice/ami/AllTests.java @@ -1081,7 +1081,7 @@ public static void allTests(test.TestHelper helper, boolean collocated) { } out.println("ok"); - if (p.ice_getConnection() != null) { + if (p.ice_getConnection() != null && p.supportsBackPressureTests()) { out.print("testing back pressure... "); out.flush(); try { diff --git a/java/test/src/main/java/test/Ice/ami/Test.ice b/java/test/src/main/java/test/Ice/ami/Test.ice index aac507999fb..3b16ef126b8 100644 --- a/java/test/src/main/java/test/Ice/ami/Test.ice +++ b/java/test/src/main/java/test/Ice/ami/Test.ice @@ -39,6 +39,8 @@ interface TestIntf bool supportsAMD(); bool supportsFunctionalTests(); + bool supportsBackPressureTests(); + bool opBool(bool b); byte opByte(byte b); short opShort(short s); diff --git a/java/test/src/main/java/test/Ice/ami/TestI.java b/java/test/src/main/java/test/Ice/ami/TestI.java index 1822f17960c..1f175055a00 100644 --- a/java/test/src/main/java/test/Ice/ami/TestI.java +++ b/java/test/src/main/java/test/Ice/ami/TestI.java @@ -61,6 +61,11 @@ public boolean supportsFunctionalTests(com.zeroc.Ice.Current current) { return true; } + @Override + public boolean supportsBackPressureTests(com.zeroc.Ice.Current current) { + return true; + } + @Override public boolean opBool(boolean b, com.zeroc.Ice.Current current) { return b; diff --git a/python/test/Ice/ami/Test.ice b/python/test/Ice/ami/Test.ice index 2adfe72d791..7f01fa563f1 100644 --- a/python/test/Ice/ami/Test.ice +++ b/python/test/Ice/ami/Test.ice @@ -38,6 +38,7 @@ interface TestIntf bool supportsAMD(); bool supportsFunctionalTests(); + bool supportsBackPressureTests(); ["amd"] void pingBiDir(PingReply* reply); } diff --git a/python/test/Ice/ami/TestI.py b/python/test/Ice/ami/TestI.py index c226e11b9c4..bcfd9ee5909 100644 --- a/python/test/Ice/ami/TestI.py +++ b/python/test/Ice/ami/TestI.py @@ -90,6 +90,9 @@ def supportsAMD(self, current): def supportsFunctionalTests(self, current): return False + def supportsBackPressureTests(self, current): + return True + async def pingBiDir(self, reply, current): expectSuccess = "ONE" not in current.ctx try: @@ -100,6 +103,7 @@ async def pingBiDir(self, reply, current): if expectSuccess: raise Test.TestIntfException() + class TestIntfII(Test.Outer.Inner.TestIntf): def op(self, i, current): return (i, i) diff --git a/swift/test/Ice/ami/Test.ice b/swift/test/Ice/ami/Test.ice index 95a7f0b121d..ebbaaba9b6b 100644 --- a/swift/test/Ice/ami/Test.ice +++ b/swift/test/Ice/ami/Test.ice @@ -40,6 +40,7 @@ interface TestIntf bool supportsAMD(); bool supportsFunctionalTests(); + bool supportsBackPressureTests(); void pingBiDir(PingReply* reply); } diff --git a/swift/test/Ice/ami/TestI.swift b/swift/test/Ice/ami/TestI.swift index 7d34cabb9c3..bfb0daea134 100644 --- a/swift/test/Ice/ami/TestI.swift +++ b/swift/test/Ice/ami/TestI.swift @@ -172,6 +172,10 @@ class TestI: TestIntf { func supportsFunctionalTests(current _: Current) async throws -> Bool { return false } + + func supportsBackPressureTests(current _: Current) async throws -> Bool { + return false + } } class TestII: OuterInnerTestIntf {