Skip to content

Commit

Permalink
Fix test failures
Browse files Browse the repository at this point in the history
  • Loading branch information
pepone committed Jan 31, 2024
1 parent 3495ee6 commit f460e6a
Show file tree
Hide file tree
Showing 9 changed files with 394 additions and 69 deletions.
1 change: 0 additions & 1 deletion cpp/src/slice2cs/Gen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -732,7 +732,6 @@ Slice::CsVisitor::writeMarshaling(const ClassDefPtr& p)
other.push_back("::Ice::Value");
other.sort();
ids.merge(other);
ids.sort();
ids.unique();

assert(find(ids.begin(), ids.end(), scoped) != ids.end());
Expand Down
14 changes: 7 additions & 7 deletions csharp/test/Ice/background/AllTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -115,14 +115,14 @@ public static async Task<BackgroundPrx> allTests(Test.TestHelper helper)
Console.Write("testing connect... ");
Console.Out.Flush();
{
connectTests(configuration, background);
await connectTests(configuration, background);
}
Console.Out.WriteLine("ok");

Console.Write("testing initialization... ");
Console.Out.Flush();
{
initializeTests(configuration, background, backgroundController);
await initializeTests(configuration, background, backgroundController);
}
Console.Out.WriteLine("ok");

Expand All @@ -136,7 +136,7 @@ public static async Task<BackgroundPrx> allTests(Test.TestHelper helper)
Console.Write("testing read/write... ");
Console.Out.Flush();
{
readWriteTests(configuration, background, backgroundController);
await readWriteTests(configuration, background, backgroundController);
}
Console.Out.WriteLine("ok");

Expand Down Expand Up @@ -254,7 +254,7 @@ public static async Task<BackgroundPrx> allTests(Test.TestHelper helper)
return background;
}

private static async void connectTests(Configuration configuration, Test.BackgroundPrx background)
private static async Task connectTests(Configuration configuration, Test.BackgroundPrx background)
{
try
{
Expand Down Expand Up @@ -353,7 +353,7 @@ private static async void connectTests(Configuration configuration, Test.Backgro
}
}

private static async void initializeTests(
private static async Task initializeTests(
Configuration configuration,
BackgroundPrx background,
BackgroundControllerPrx ctl)
Expand Down Expand Up @@ -557,7 +557,7 @@ private static async Task validationTests(
configuration.readException(null);
}

if(!background.ice_getCommunicator().getProperties().getProperty("Ice.Default.Protocol").Equals("test-ssl") &&
if (!background.ice_getCommunicator().getProperties().getProperty("Ice.Default.Protocol").Equals("test-ssl") &&
!background.ice_getCommunicator().getProperties().getProperty("Ice.Default.Protocol").Equals("test-wss"))
{
try
Expand Down Expand Up @@ -718,7 +718,7 @@ private static async Task validationTests(
await closeConnection(backgroundBatchOneway);
}

private static async void readWriteTests(
private static async Task readWriteTests(
Configuration configuration,
BackgroundPrx background,
BackgroundControllerPrx ctl)
Expand Down
2 changes: 1 addition & 1 deletion csharp/test/Ice/background/Configuration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ static public Configuration getInstance()
private Ice.LocalException _connectException;
private Ice.LocalException _initializeException;
private int _readReadyCount;
private Ice.LocalException _readException;
public Ice.LocalException _readException;
private int _writeReadyCount;
private Ice.LocalException _writeException;
private bool _buffered;
Expand Down
20 changes: 18 additions & 2 deletions csharp/test/Ice/faultTolerance/AllTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,15 @@ public static async Task allTests(Test.TestHelper helper, List<int> ports)
{
output.Write("aborting server #" + i + " with AMI... ");
output.Flush();
await obj.abortAsync();
try
{
await obj.abortAsync();
test(false);
}
catch (Ice.Exception ex)
{
exceptAbortI(ex, output);
}
output.WriteLine("ok");
}
}
Expand Down Expand Up @@ -160,7 +168,15 @@ public static async Task allTests(Test.TestHelper helper, List<int> ports)
{
output.Write("aborting server #" + i + " and #" + (i + 1) + " with idempotent AMI call... ");
output.Flush();
await obj.idempotentAbortAsync();
try
{
await obj.idempotentAbortAsync();
test(false);
}
catch (Ice.Exception ex)
{
exceptAbortI(ex, output);
}
output.WriteLine("ok");
}
++i;
Expand Down
9 changes: 4 additions & 5 deletions csharp/test/Ice/hold/AllTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
//

using System;
using System.Collections.Generic;
using System.Threading.Tasks;

namespace Ice
Expand Down Expand Up @@ -126,14 +125,14 @@ public static async Task allTests(global::Test.TestHelper helper)
int expected = value;
var t = hold.setAsync(
++value, value < 500 ? rand.Next(5) : 0,
progress: new Progress<bool>(value => sentTcs.SetResult()));
progress: new Progress<bool>(value => sentTcs.TrySetResult()));
_ = Task.Run(
async () =>
{
var response = await t;
if(response != expected)
{
outOfOrderTcs.SetResult();
outOfOrderTcs.TrySetResult();
}
});
if(value % 100 == 0)
Expand Down Expand Up @@ -167,7 +166,7 @@ public static async Task allTests(global::Test.TestHelper helper)
_ = holdSerialized.setAsync(
++value,
0,
progress: new Progress<bool>(value => sentTcs.SetResult()));
progress: new Progress<bool>(value => sentTcs.TrySetResult()));
if(value % 100 == 0)
{
await sentTcs.Task;
Expand Down Expand Up @@ -203,7 +202,7 @@ public static async Task allTests(global::Test.TestHelper helper)
result = ((Test.HoldPrx)holdSerialized.ice_oneway()).setOnewayAsync(
value + 1,
value,
progress: new Progress<bool>(value => sentTcs.SetResult()));
progress: new Progress<bool>(value => sentTcs.TrySetResult()));
++value;
if((i % 100) == 0)
{
Expand Down
5 changes: 3 additions & 2 deletions csharp/test/Ice/location/AllTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ namespace location
{
public class AllTests : global::Test.AllTests
{
public static async void allTests(global::Test.TestHelper helper)
public static async Task allTests(global::Test.TestHelper helper)
{
Ice.Communicator communicator = helper.communicator();
var manager = Test.ServerManagerPrxHelper.checkedCast(
Expand Down Expand Up @@ -277,7 +277,7 @@ public static async void allTests(global::Test.TestHelper helper)
{
results.Add(hello.sayHelloAsync());
}
foreach(Task t in results)
foreach (Task t in results)
{
await t;
}
Expand All @@ -298,6 +298,7 @@ public static async void allTests(global::Test.TestHelper helper)
try
{
await t;
test(false);
}
catch (NotRegisteredException)
{
Expand Down
4 changes: 2 additions & 2 deletions csharp/test/Ice/location/Client.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@ namespace location
{
public class Client : TestHelper
{
public override void run(string[] args)
public override async Task runAsync(string[] args)
{
Ice.Properties properties = createTestProperties(ref args);
properties.setProperty("Ice.Default.Locator", "locator:" + getTestEndpoint(properties, 0));
using(var communicator = initialize(properties))
{
AllTests.allTests(this);
await AllTests.allTests(this);
}
}

Expand Down
Loading

0 comments on commit f460e6a

Please sign in to comment.