From a1b16e39aab5f3c597f355ae93c3656f40f68f6d Mon Sep 17 00:00:00 2001 From: Anton Firszov Date: Sun, 13 Jun 2021 13:06:08 +0200 Subject: [PATCH 1/6] add failing test --- .../TestUtilities/Tests/TestEnvironmentTests.cs | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/tests/ImageSharp.Tests/TestUtilities/Tests/TestEnvironmentTests.cs b/tests/ImageSharp.Tests/TestUtilities/Tests/TestEnvironmentTests.cs index 84b929729..aae5cd684 100644 --- a/tests/ImageSharp.Tests/TestUtilities/Tests/TestEnvironmentTests.cs +++ b/tests/ImageSharp.Tests/TestUtilities/Tests/TestEnvironmentTests.cs @@ -3,7 +3,7 @@ using System; using System.IO; - +using Microsoft.DotNet.RemoteExecutor; using SixLabors.ImageSharp.Formats; using SixLabors.ImageSharp.Formats.Bmp; using SixLabors.ImageSharp.Formats.Gif; @@ -114,5 +114,16 @@ namespace SixLabors.ImageSharp.Tests IImageDecoder decoder = TestEnvironment.GetReferenceDecoder(fileName); Assert.IsType(expectedDecoderType, decoder); } + + [Fact] + public void RemoteExecutor_FailingRemoteTestShouldFailLocalTest() + { + static void FailingCode() + { + Assert.False(true); + } + + Assert.ThrowsAny(() => RemoteExecutor.Invoke(FailingCode).Dispose()); + } } } From cee9140e75dff38172f53a2d01125fad14380382 Mon Sep 17 00:00:00 2001 From: Anton Firszov Date: Sun, 13 Jun 2021 13:20:31 +0200 Subject: [PATCH 2/6] update Microsoft.DotNet.RemoteExecutor & XUnitExtensions --- tests/Directory.Build.targets | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/Directory.Build.targets b/tests/Directory.Build.targets index af86f49b0..9c1788145 100644 --- a/tests/Directory.Build.targets +++ b/tests/Directory.Build.targets @@ -22,8 +22,8 @@ - - + + From 488b486d3ecd21d773f3c1c0374f4475b08a98ea Mon Sep 17 00:00:00 2001 From: Anton Firszov Date: Sun, 13 Jun 2021 16:01:17 +0200 Subject: [PATCH 3/6] fix BokehBlurFilterProcessor_Bounded --- .../Processing/Processors/Convolution/BokehBlurTest.cs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/tests/ImageSharp.Tests/Processing/Processors/Convolution/BokehBlurTest.cs b/tests/ImageSharp.Tests/Processing/Processors/Convolution/BokehBlurTest.cs index 2351cbb91..4ab053a31 100644 --- a/tests/ImageSharp.Tests/Processing/Processors/Convolution/BokehBlurTest.cs +++ b/tests/ImageSharp.Tests/Processing/Processors/Convolution/BokehBlurTest.cs @@ -11,6 +11,7 @@ using SixLabors.ImageSharp.PixelFormats; using SixLabors.ImageSharp.Processing; using SixLabors.ImageSharp.Processing.Processors.Convolution; using SixLabors.ImageSharp.Tests.TestUtilities; +using SixLabors.ImageSharp.Tests.TestUtilities.ImageComparison; using Xunit; using Xunit.Abstractions; @@ -154,8 +155,9 @@ namespace SixLabors.ImageSharp.Tests.Processing.Processors.Convolution appendSourceFileOrDescription: false); [Theory] - [WithFileCollection(nameof(TestFiles), nameof(BokehBlurValues), PixelTypes.Rgba32)] - public void BokehBlurFilterProcessor_Bounded(TestImageProvider provider, BokehBlurInfo value) + [WithFileCollection(nameof(TestFiles), nameof(BokehBlurValues), PixelTypes.Rgba32, HwIntrinsics.AllowAll)] + [WithFileCollection(nameof(TestFiles), nameof(BokehBlurValues), PixelTypes.Rgba32, HwIntrinsics.DisableSSE41)] + public void BokehBlurFilterProcessor_Bounded(TestImageProvider provider, BokehBlurInfo value, HwIntrinsics intrinsicsFilter) { static void RunTest(string arg1, string arg2) { @@ -173,12 +175,13 @@ namespace SixLabors.ImageSharp.Tests.Processing.Processors.Convolution x.BokehBlur(value.Radius, value.Components, value.Gamma, bounds); }, testOutputDetails: value.ToString(), + ImageComparer.TolerantPercentage(0.05f), appendPixelTypeToFileName: false); } FeatureTestRunner.RunWithHwIntrinsicsFeature( RunTest, - HwIntrinsics.DisableSSE41, + intrinsicsFilter, provider, value); } From 73d273d4257df5db6890f0372cea5a2fa1f1b3d0 Mon Sep 17 00:00:00 2001 From: Anton Firszov Date: Sun, 13 Jun 2021 16:37:47 +0200 Subject: [PATCH 4/6] skip RemoteExecutor_FailingRemoteTestShouldFailLocalTest on 32 bit Framework --- .../TestUtilities/Tests/TestEnvironmentTests.cs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tests/ImageSharp.Tests/TestUtilities/Tests/TestEnvironmentTests.cs b/tests/ImageSharp.Tests/TestUtilities/Tests/TestEnvironmentTests.cs index aae5cd684..0645b7996 100644 --- a/tests/ImageSharp.Tests/TestUtilities/Tests/TestEnvironmentTests.cs +++ b/tests/ImageSharp.Tests/TestUtilities/Tests/TestEnvironmentTests.cs @@ -118,6 +118,14 @@ namespace SixLabors.ImageSharp.Tests [Fact] public void RemoteExecutor_FailingRemoteTestShouldFailLocalTest() { + if (TestEnvironment.IsFramework && !TestEnvironment.Is64BitProcess) + { + // The RemoteExecutor fix does not work well with the "dotnet xunit" call + // we use with Framework on 32 bit: + // https://github.com/SixLabors/ImageSharp/blob/381dff8640b721a34b1227c970fcf6ad6c5e3e72/ci-test.ps1#L30 + return; + } + static void FailingCode() { Assert.False(true); From 816a379218bd4e0e24cac2adfff3501d392fb8db Mon Sep 17 00:00:00 2001 From: Anton Firszov Date: Sun, 13 Jun 2021 16:40:58 +0200 Subject: [PATCH 5/6] use ConditionalFact to skip the test --- .../TestUtilities/Tests/TestEnvironmentTests.cs | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/tests/ImageSharp.Tests/TestUtilities/Tests/TestEnvironmentTests.cs b/tests/ImageSharp.Tests/TestUtilities/Tests/TestEnvironmentTests.cs index 0645b7996..60f4101cc 100644 --- a/tests/ImageSharp.Tests/TestUtilities/Tests/TestEnvironmentTests.cs +++ b/tests/ImageSharp.Tests/TestUtilities/Tests/TestEnvironmentTests.cs @@ -115,17 +115,14 @@ namespace SixLabors.ImageSharp.Tests Assert.IsType(expectedDecoderType, decoder); } - [Fact] + // The RemoteExecutor fix does not work well with the "dotnet xunit" call + // we use with Framework on 32 bit: + // https://github.com/SixLabors/ImageSharp/blob/381dff8640b721a34b1227c970fcf6ad6c5e3e72/ci-test.ps1#L30 + public static bool IsNot32BitNetFramework = !TestEnvironment.IsFramework || TestEnvironment.Is64BitProcess; + + [ConditionalFact(nameof(IsNot32BitNetFramework))] public void RemoteExecutor_FailingRemoteTestShouldFailLocalTest() { - if (TestEnvironment.IsFramework && !TestEnvironment.Is64BitProcess) - { - // The RemoteExecutor fix does not work well with the "dotnet xunit" call - // we use with Framework on 32 bit: - // https://github.com/SixLabors/ImageSharp/blob/381dff8640b721a34b1227c970fcf6ad6c5e3e72/ci-test.ps1#L30 - return; - } - static void FailingCode() { Assert.False(true); From 255802cd9b1e0e72b5c3399b8b19070971dd5328 Mon Sep 17 00:00:00 2001 From: Anton Firszov Date: Sun, 13 Jun 2021 17:07:15 +0200 Subject: [PATCH 6/6] improve comment --- .../TestUtilities/Tests/TestEnvironmentTests.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tests/ImageSharp.Tests/TestUtilities/Tests/TestEnvironmentTests.cs b/tests/ImageSharp.Tests/TestUtilities/Tests/TestEnvironmentTests.cs index 60f4101cc..05f4f032b 100644 --- a/tests/ImageSharp.Tests/TestUtilities/Tests/TestEnvironmentTests.cs +++ b/tests/ImageSharp.Tests/TestUtilities/Tests/TestEnvironmentTests.cs @@ -115,8 +115,7 @@ namespace SixLabors.ImageSharp.Tests Assert.IsType(expectedDecoderType, decoder); } - // The RemoteExecutor fix does not work well with the "dotnet xunit" call - // we use with Framework on 32 bit: + // RemoteExecutor does not work with "dotnet xunit" used to run tests on 32 bit .NET Framework: // https://github.com/SixLabors/ImageSharp/blob/381dff8640b721a34b1227c970fcf6ad6c5e3e72/ci-test.ps1#L30 public static bool IsNot32BitNetFramework = !TestEnvironment.IsFramework || TestEnvironment.Is64BitProcess;