Skip to content

Commit

Permalink
Pipeline: Skip some OutOfMemoryException tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mee-ironsoftware committed Jun 13, 2024
1 parent 2742fbe commit 189cf07
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -69,5 +69,18 @@ protected static bool IsUnix()
{
return RuntimeInformation.IsOSPlatform(OSPlatform.Linux) || RuntimeInformation.IsOSPlatform(OSPlatform.OSX);
}

/// <summary>
/// Get current processor architecture/bittiness string
/// </summary>
/// <returns>String representing architecture of the current process</returns>
public static string GetArchitecture()
{
return RuntimeInformation.ProcessArchitecture == Architecture.Arm64
? "arm64"
: Environment.Is64BitProcess
? "x64"
: "x86";
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -875,7 +875,7 @@ public void LoadImage_TiffImage_ShouldLoadWithoutThumbnail()
bitmap.FrameCount.Should().Be(1);
}


#if !NET7_0
[FactWithAutomaticDisplayName]
public void CastAnyBitmap_from_SixLabors()
{
Expand All @@ -890,9 +890,10 @@ public void CastAnyBitmap_from_SixLabors()

AssertLargeImageAreEqual("expected.bmp", "result.bmp", true);
}
#endif


[FactWithAutomaticDisplayName]
[IgnoreOnAzureDevopsX86Fact]
public void Load_TiffImage_ShouldNotIncreaseFileSize()
{
// Arrange
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
using System;
using IronSoftware.Drawing.Common.Tests;
using Xunit;

public sealed class IgnoreOnAzureDevopsX86FactAttribute : FactWithAutomaticDisplayNameAttribute
{
/// <summary>
/// This class using for Skip test on Azure Devops and x86 architect
/// <para>Regarding to OcrWizardTests.RunningWizardShouldFindBetterResult always failed on Devops x86 tested</para>
/// </summary>
public IgnoreOnAzureDevopsX86FactAttribute()
{
if (!(IsRunningOnAzureDevOps() && IsRunningOnX86()))
{
return;
}

Skip = "Ignored on Azure DevOps";
}

/// <summary>Determine if runtime is Azure DevOps.</summary>
/// <returns>True if being executed in Azure DevOps, false otherwise.</returns>
public static bool IsRunningOnAzureDevOps()
{
return Environment.GetEnvironmentVariable("SYSTEM_DEFINITIONID") != null;
}

// <summary>Determine if runtime is x86 architect.</summary>
/// <returns>True if being executed in x86 architect, false otherwise.</returns>
public static bool IsRunningOnX86()
{
return TestsBase.GetArchitecture() == "x86";
}
}

0 comments on commit 189cf07

Please sign in to comment.