Skip to content

Commit a991e13

Browse files
authored
Make ObjectiveC tests in System.Runtime.InteropServices.Tests check exit code for remote execution (#63769)
1 parent 33179fa commit a991e13

File tree

2 files changed

+16
-2
lines changed

2 files changed

+16
-2
lines changed

src/libraries/System.Runtime.InteropServices/tests/System.Runtime.InteropServices.UnitTests/System/Runtime/InteropServices/ObjectiveC/MessageSendTests.cs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,11 @@ public void SetMessageSendCallback_AlreadySet()
7171
var (msgSend, func) = msgSendOverrides[0];
7272
ObjectiveCMarshal.SetMessageSendCallback(msgSend, func);
7373
Assert.Throws<InvalidOperationException>(() => ObjectiveCMarshal.SetMessageSendCallback(msgSend, func));
74+
75+
// TODO: Remove once https://github.com/dotnet/arcade/issues/5865 is resolved
76+
// RemoteExecutor currently only checks the expected exit code if the invoked function returns an int.
77+
// Check the exit code to ensure the test will fail if there was a crash that could not be caught by the executor.
78+
return RemoteExecutor.SuccessExitCode;
7479
}).Dispose();
7580
}
7681

@@ -97,6 +102,11 @@ public void SetMessageSendCallback(MessageSendFunction[] funcsToOverride)
97102
}
98103

99104
SetMessageSendCallbackImpl(msgSendArray);
105+
106+
// TODO: Remove once https://github.com/dotnet/arcade/issues/5865 is resolved
107+
// RemoteExecutor currently only checks the expected exit code if the invoked function returns an int.
108+
// Check the exit code to ensure the test will fail if there was a crash that could not be caught by the executor.
109+
return RemoteExecutor.SuccessExitCode;
100110
}, string.Join(';', funcsToOverride)).Dispose();
101111
}
102112

@@ -150,4 +160,3 @@ private static void SetMessageSendCallbackImpl(MessageSendFunction[] funcsToOver
150160
}
151161
}
152162
}
153-

src/libraries/System.Runtime.InteropServices/tests/System.Runtime.InteropServices.UnitTests/System/Runtime/InteropServices/ObjectiveC/PendingExceptionTests.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,11 @@ public void ValidateSetMessageSendPendingException(MessageSendFunction func)
5959
Assert.True(Enum.IsDefined<MessageSendFunction>(msgSend));
6060

6161
ValidateSetMessageSendPendingExceptionImpl(msgSend);
62+
63+
// TODO: Remove once https://github.com/dotnet/arcade/issues/5865 is resolved
64+
// RemoteExecutor currently only checks the expected exit code if the invoked function returns an int.
65+
// Check the exit code to ensure the test will fail if there was a crash that could not be caught by the executor.
66+
return RemoteExecutor.SuccessExitCode;
6267
}, func.ToString()).Dispose();
6368
}
6469

@@ -95,4 +100,4 @@ private static void ValidateSetMessageSendPendingExceptionImpl(MessageSendFuncti
95100
Assert.Equal(msgSend.ToString(), ex.Message);
96101
}
97102
}
98-
}
103+
}

0 commit comments

Comments
 (0)