From b661c077447f3da483df345a61d11a73b418b8fa Mon Sep 17 00:00:00 2001 From: Stefan Nikolei Date: Sun, 5 Mar 2023 21:06:54 +0100 Subject: [PATCH] Remove mac specific skips --- .../Formats/Tiff/TiffDecoderTests.cs | 98 +++++++++---------- .../UniformUnmanagedMemoryPoolTests.Trim.cs | 5 +- .../UniformUnmanagedMemoryPoolTests.cs | 4 +- ...niformUnmanagedPoolMemoryAllocatorTests.cs | 40 ++++---- .../Processors/Transforms/ResizeTests.cs | 2 +- 5 files changed, 72 insertions(+), 77 deletions(-) diff --git a/tests/ImageSharp.Tests/Formats/Tiff/TiffDecoderTests.cs b/tests/ImageSharp.Tests/Formats/Tiff/TiffDecoderTests.cs index 8ba76193c5..0342d18cd1 100644 --- a/tests/ImageSharp.Tests/Formats/Tiff/TiffDecoderTests.cs +++ b/tests/ImageSharp.Tests/Formats/Tiff/TiffDecoderTests.cs @@ -202,13 +202,13 @@ public class TiffDecoderTests : TiffDecoderBaseTester public void TiffDecoder_CanDecode_12Bit_WithAssociatedAlpha(TestImageProvider provider) where TPixel : unmanaged, IPixel { - if (TestEnvironment.IsMacOS) - { - // Only debug save on OSX: For some reason the reference image has a difference of 50%. The imagesharp output file looks ok though. - using Image image = provider.GetImage(TiffDecoder.Instance); - image.DebugSave(provider); - return; - } + // if (TestEnvironment.IsMacOS) + // { + // // Only debug save on OSX: For some reason the reference image has a difference of 50%. The imagesharp output file looks ok though. + // using Image image = provider.GetImage(TiffDecoder.Instance); + // image.DebugSave(provider); + // return; + // } TestTiffDecoder(provider, useExactComparer: false, compareTolerance: 0.264F); } @@ -258,13 +258,13 @@ public class TiffDecoderTests : TiffDecoderBaseTester where TPixel : unmanaged, IPixel { - if (TestEnvironment.IsMacOS) - { - // Only debug save on OSX: For some reason the reference image has a difference of 50%. The imagesharp output file looks ok though. - using Image image = provider.GetImage(TiffDecoder.Instance); - image.DebugSave(provider); - return; - } + // if (TestEnvironment.IsMacOS) + // { + // // Only debug save on OSX: For some reason the reference image has a difference of 50%. The imagesharp output file looks ok though. + // using Image image = provider.GetImage(TiffDecoder.Instance); + // image.DebugSave(provider); + // return; + // } TestTiffDecoder(provider, useExactComparer: false, compareTolerance: 0.376F); } @@ -284,13 +284,13 @@ public class TiffDecoderTests : TiffDecoderBaseTester public void TiffDecoder_CanDecode_24Bit_WithAssociatedAlpha(TestImageProvider provider) where TPixel : unmanaged, IPixel { - if (TestEnvironment.IsMacOS) - { - // Only debug save on OSX: For some reason the reference image has a difference of 50%. The imagesharp output file looks ok though. - using Image image = provider.GetImage(TiffDecoder.Instance); - image.DebugSave(provider); - return; - } + // if (TestEnvironment.IsMacOS) + // { + // // Only debug save on OSX: For some reason the reference image has a difference of 50%. The imagesharp output file looks ok though. + // using Image image = provider.GetImage(TiffDecoder.Instance); + // image.DebugSave(provider); + // return; + // } TestTiffDecoder(provider, useExactComparer: false, compareTolerance: 0.405F); } @@ -385,13 +385,13 @@ public class TiffDecoderTests : TiffDecoderBaseTester public void TiffDecoder_CanDecode_32Bit_WithAssociatedAlpha(TestImageProvider provider) where TPixel : unmanaged, IPixel { - if (TestEnvironment.IsMacOS) - { - // Only debug save on OSX: For some reason the reference image has a difference of 50%. The imagesharp output file looks ok though. - using Image image = provider.GetImage(TiffDecoder.Instance); - image.DebugSave(provider); - return; - } + // if (TestEnvironment.IsMacOS) + // { + // // Only debug save on OSX: For some reason the reference image has a difference of 50%. The imagesharp output file looks ok though. + // using Image image = provider.GetImage(TiffDecoder.Instance); + // image.DebugSave(provider); + // return; + // } // Note: Using tolerant comparer here, because there is a small difference to the reference decoder probably due to floating point rounding issues. TestTiffDecoder(provider, useExactComparer: false, compareTolerance: 0.004F); @@ -425,13 +425,13 @@ public class TiffDecoderTests : TiffDecoderBaseTester public void TiffDecoder_CanDecode_40Bit_WithAssociatedAlpha(TestImageProvider provider) where TPixel : unmanaged, IPixel { - if (TestEnvironment.IsMacOS) - { - // Only debug save on OSX: For some reason the reference image has a difference of 50%. The imagesharp output file looks ok though. - using Image image = provider.GetImage(TiffDecoder.Instance); - image.DebugSave(provider); - return; - } + // if (TestEnvironment.IsMacOS) + // { + // // Only debug save on OSX: For some reason the reference image has a difference of 50%. The imagesharp output file looks ok though. + // using Image image = provider.GetImage(TiffDecoder.Instance); + // image.DebugSave(provider); + // return; + // } TestTiffDecoder(provider, useExactComparer: false, compareTolerance: 0.247F); } @@ -463,13 +463,13 @@ public class TiffDecoderTests : TiffDecoderBaseTester public void TiffDecoder_CanDecode_48Bit_WithAssociatedAlpha(TestImageProvider provider) where TPixel : unmanaged, IPixel { - if (TestEnvironment.IsMacOS) - { - // Only debug save on OSX: For some reason the reference image has a difference of 50%. The imagesharp output file looks ok though. - using Image image = provider.GetImage(TiffDecoder.Instance); - image.DebugSave(provider); - return; - } + // if (TestEnvironment.IsMacOS) + // { + // // Only debug save on OSX: For some reason the reference image has a difference of 50%. The imagesharp output file looks ok though. + // using Image image = provider.GetImage(TiffDecoder.Instance); + // image.DebugSave(provider); + // return; + // } TestTiffDecoder(provider, useExactComparer: false, compareTolerance: 0.118F); } @@ -492,13 +492,13 @@ public class TiffDecoderTests : TiffDecoderBaseTester public void TiffDecoder_CanDecode_56Bit_WithAssociatedAlpha(TestImageProvider provider) where TPixel : unmanaged, IPixel { - if (TestEnvironment.IsMacOS) - { - // Only debug save on OSX: For some reason the reference image has a difference of 50%. The imagesharp output file looks ok though. - using Image image = provider.GetImage(TiffDecoder.Instance); - image.DebugSave(provider); - return; - } + // if (TestEnvironment.IsMacOS) + // { + // // Only debug save on OSX: For some reason the reference image has a difference of 50%. The imagesharp output file looks ok though. + // using Image image = provider.GetImage(TiffDecoder.Instance); + // image.DebugSave(provider); + // return; + // } TestTiffDecoder(provider, useExactComparer: false, compareTolerance: 0.075F); } diff --git a/tests/ImageSharp.Tests/Memory/Allocators/UniformUnmanagedMemoryPoolTests.Trim.cs b/tests/ImageSharp.Tests/Memory/Allocators/UniformUnmanagedMemoryPoolTests.Trim.cs index 17f04795dc..08f6409e38 100644 --- a/tests/ImageSharp.Tests/Memory/Allocators/UniformUnmanagedMemoryPoolTests.Trim.cs +++ b/tests/ImageSharp.Tests/Memory/Allocators/UniformUnmanagedMemoryPoolTests.Trim.cs @@ -53,11 +53,12 @@ public partial class UniformUnmanagedMemoryPoolTests [Collection(nameof(NonParallelCollection))] public class NonParallel { - public static readonly bool IsNotMacOS = !TestEnvironment.IsMacOS; + // public static readonly bool IsNotMacOS = !TestEnvironment.IsMacOS; // TODO: Investigate failures on macOS. All handles are released after GC. // (It seems to happen more consistently on .NET 6.) - [ConditionalFact(nameof(IsNotMacOS))] + // [ConditionalFact(nameof(IsNotMacOS))] + [Fact] public void MultiplePoolInstances_TrimPeriodElapsed_AllAreTrimmed() { if (!TestEnvironment.RunsOnCI) diff --git a/tests/ImageSharp.Tests/Memory/Allocators/UniformUnmanagedMemoryPoolTests.cs b/tests/ImageSharp.Tests/Memory/Allocators/UniformUnmanagedMemoryPoolTests.cs index 69fc1a5f7d..4e7244d5fc 100644 --- a/tests/ImageSharp.Tests/Memory/Allocators/UniformUnmanagedMemoryPoolTests.cs +++ b/tests/ImageSharp.Tests/Memory/Allocators/UniformUnmanagedMemoryPoolTests.cs @@ -238,10 +238,10 @@ public partial class UniformUnmanagedMemoryPoolTests cleanup.Register(b1); } - public static readonly bool IsNotMacOS = !TestEnvironment.IsMacOS; + // public static readonly bool IsNotMacOS = !TestEnvironment.IsMacOS; // TODO: Investigate macOS failures - [ConditionalTheory(nameof(IsNotMacOS))] + // [ConditionalTheory(nameof(IsNotMacOS))] [InlineData(false)] [InlineData(true)] public void RentReturnRelease_SubsequentRentReturnsDifferentHandles(bool multiple) diff --git a/tests/ImageSharp.Tests/Memory/Allocators/UniformUnmanagedPoolMemoryAllocatorTests.cs b/tests/ImageSharp.Tests/Memory/Allocators/UniformUnmanagedPoolMemoryAllocatorTests.cs index 3403e3f17e..3eea8516af 100644 --- a/tests/ImageSharp.Tests/Memory/Allocators/UniformUnmanagedPoolMemoryAllocatorTests.cs +++ b/tests/ImageSharp.Tests/Memory/Allocators/UniformUnmanagedPoolMemoryAllocatorTests.cs @@ -255,11 +255,11 @@ public class UniformUnmanagedPoolMemoryAllocatorTests [InlineData(1200)] // Group of two UniformUnmanagedMemoryPool buffers public void AllocateMemoryGroup_Finalization_ReturnsToPool(int length) { - if (TestEnvironment.IsMacOS) - { - // Skip on macOS: https://github.com/SixLabors/ImageSharp/issues/1887 - return; - } + // if (TestEnvironment.IsMacOS) + // { + // // Skip on macOS: https://github.com/SixLabors/ImageSharp/issues/1887 + // return; + // } if (TestEnvironment.OSArchitecture == Architecture.Arm64) { @@ -267,12 +267,12 @@ public class UniformUnmanagedPoolMemoryAllocatorTests return; } - if (!TestEnvironment.RunsOnCI) - { - // This may fail in local runs resulting in high memory load. - // Remove the condition for local debugging! - return; - } + // if (!TestEnvironment.RunsOnCI) + // { + // // This may fail in local runs resulting in high memory load. + // // Remove the condition for local debugging! + // return; + // } // RunTest(length.ToString()); RemoteExecutor.Invoke(RunTest, length.ToString()).Dispose(); @@ -323,24 +323,18 @@ public class UniformUnmanagedPoolMemoryAllocatorTests [InlineData(600)] // Group of single UniformUnmanagedMemoryPool buffer public void AllocateSingleMemoryOwner_Finalization_ReturnsToPool(int length) { - if (TestEnvironment.IsMacOS) - { - // Skip on macOS: https://github.com/SixLabors/ImageSharp/issues/1887 - return; - } - if (TestEnvironment.OSArchitecture == Architecture.Arm64) { // Skip on ARM64: https://github.com/SixLabors/ImageSharp/issues/2342 return; } - if (!TestEnvironment.RunsOnCI) - { - // This may fail in local runs resulting in high memory load. - // Remove the condition for local debugging! - return; - } + // if (!TestEnvironment.RunsOnCI) + // { + // // This may fail in local runs resulting in high memory load. + // // Remove the condition for local debugging! + // return; + // } // RunTest(length.ToString()); RemoteExecutor.Invoke(RunTest, length.ToString()).Dispose(); diff --git a/tests/ImageSharp.Tests/Processing/Processors/Transforms/ResizeTests.cs b/tests/ImageSharp.Tests/Processing/Processors/Transforms/ResizeTests.cs index d8ce88dc3b..d1b005ee4e 100644 --- a/tests/ImageSharp.Tests/Processing/Processors/Transforms/ResizeTests.cs +++ b/tests/ImageSharp.Tests/Processing/Processors/Transforms/ResizeTests.cs @@ -31,7 +31,7 @@ public class ResizeTests }; private static readonly ImageComparer ValidatorComparer = - ImageComparer.TolerantPercentage(TestEnvironment.IsMacOS && TestEnvironment.RunsOnCI ? 0.26F : 0.07F); + ImageComparer.TolerantPercentage(0.07F); [Fact] public void Resize_PixelAgnostic()