Skip to content

Commit

Permalink
SecureMemoryTests.cs: Exclude macOS from this test.
Browse files Browse the repository at this point in the history
No idea what the limit is. I thought it was 256 MiB by default but doesn't seem to be.
  • Loading branch information
samuel-lucas6 committed Dec 8, 2024
1 parent a60213e commit d95c5bd
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/Geralt.Tests/SecureMemoryTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -99,9 +99,12 @@ public void LockMemory_UnlockAndZeroMemory_Invalid(int bufferSize)
[TestMethod]
public void LockMemory_UnlockAndZeroMemory_InvalidOperation()
{
var b = new byte[SecureMemory.PageSize * 81920];
var b = new byte[SecureMemory.PageSize * 65536];

Assert.ThrowsException<OutOfMemoryException>(() => SecureMemory.LockMemory(b));
// This test fails on macOS - it apparently allows large amounts of memory to be locked
if (!OperatingSystem.IsMacOS()) {
Assert.ThrowsException<OutOfMemoryException>(() => SecureMemory.LockMemory(b));
}
// This test fails on Linux/macOS - munlock() must not return an error despite no locking taking place
if (OperatingSystem.IsWindows()) {
Assert.ThrowsException<InvalidOperationException>(() => SecureMemory.UnlockAndZeroMemory(b));
Expand Down

0 comments on commit d95c5bd

Please sign in to comment.