Browse Source

Merge branch 'master' into sp/text-segment-initialization

pull/1133/head
James Jackson-South 6 years ago
committed by GitHub
parent
commit
719b5a3bde
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 3
      Directory.Build.props
  2. 8
      src/Directory.Build.props
  3. 20
      tests/ImageSharp.Benchmarks/ImageSharp.Benchmarks.csproj
  4. 6
      tests/ImageSharp.Tests/AssemblyInfo.cs
  5. 5
      tests/ImageSharp.Tests/Formats/Jpg/JpegDecoderTests.cs
  6. 1
      tests/ImageSharp.Tests/ImageSharp.Tests.csproj
  7. 5
      tests/ImageSharp.Tests/Memory/Allocators/ArrayPoolMemoryAllocatorTests.cs
  8. 5
      tests/ImageSharp.Tests/Processing/Processors/Convolution/BokehBlurTest.cs
  9. 7
      tests/ImageSharp.Tests/TestUtilities/Attributes/ImageDataAttributeBase.cs
  10. 32
      tests/ImageSharp.Tests/TestUtilities/TestEnvironment.cs

3
Directory.Build.props

@ -95,8 +95,9 @@
<!-- Contains RemoteExecutor. Taken from: https://github.com/dotnet/runtime/blob/master/NuGet.config --> <!-- Contains RemoteExecutor. Taken from: https://github.com/dotnet/runtime/blob/master/NuGet.config -->
https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-eng/nuget/v3/index.json; https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-eng/nuget/v3/index.json;
</RestoreSources> </RestoreSources>
<SixLaborsPublicKey>002400000c8000009400000006020000002400005253413100040000010001000147e6fe6766715eec6cfed61f1e7dcdbf69748a3e355c67e9d8dfd953acab1d5e012ba34b23308166fdc61ee1d0390d5f36d814a6091dd4b5ed9eda5a26afced924c683b4bfb4b3d64b0586a57eff9f02b1f84e3cb0ddd518bd1697f2c84dcbb97eb8bb5c7801be12112ed0ec86db934b0e9a5171e6bb1384b6d2f7d54dfa97</SixLaborsPublicKey> <SixLaborsPublicKey>00240000048000009400000006020000002400005253413100040000010001000147e6fe6766715eec6cfed61f1e7dcdbf69748a3e355c67e9d8dfd953acab1d5e012ba34b23308166fdc61ee1d0390d5f36d814a6091dd4b5ed9eda5a26afced924c683b4bfb4b3d64b0586a57eff9f02b1f84e3cb0ddd518bd1697f2c84dcbb97eb8bb5c7801be12112ed0ec86db934b0e9a5171e6bb1384b6d2f7d54dfa97</SixLaborsPublicKey>
<UseSharedCompilation>true</UseSharedCompilation> <UseSharedCompilation>true</UseSharedCompilation>
<SignAssembly>true</SignAssembly>
</PropertyGroup> </PropertyGroup>
<!-- Package references and additional files which are consumed by all projects --> <!-- Package references and additional files which are consumed by all projects -->

8
src/Directory.Build.props

@ -27,11 +27,11 @@
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<!-- DynamicProxyGenAssembly2 is needed so Moq can use our internals -->
<InternalsVisibleTo Include="DynamicProxyGenAssembly2" PublicKey="0024000004800000940000000602000000240000525341310004000001000100c547cac37abd99c8db225ef2f6c8a3602f3b3606cc9891605d02baa56104f4cfc0734aa39b93bf7852f7d9266654753cc297e7d2edfe0bac1cdcf9f717241550e0a7b191195b7667bb4f64bcb8e2121380fd1d9d46ad2d92d2d15605093924cceaf74c4861eff62abf69b9291ed0a340e113be11e6a7d3113e92484cf7045cc7" /> <InternalsVisibleTo Include="DynamicProxyGenAssembly2" PublicKey="0024000004800000940000000602000000240000525341310004000001000100c547cac37abd99c8db225ef2f6c8a3602f3b3606cc9891605d02baa56104f4cfc0734aa39b93bf7852f7d9266654753cc297e7d2edfe0bac1cdcf9f717241550e0a7b191195b7667bb4f64bcb8e2121380fd1d9d46ad2d92d2d15605093924cceaf74c4861eff62abf69b9291ed0a340e113be11e6a7d3113e92484cf7045cc7" />
<InternalsVisibleTo Include="DynamicProxyGenAssembly2, PublicKeyToken=null" /> <InternalsVisibleTo Include="ImageSharp.Benchmarks" PublicKey="$(SixLaborsPublicKey)" />
<InternalsVisibleTo Include="ImageSharp.Benchmarks" /> <InternalsVisibleTo Include="ImageSharp.Tests.ProfilingSandbox" PublicKey="$(SixLaborsPublicKey)" />
<InternalsVisibleTo Include="SixLabors.ImageSharp.Sandbox46" /> <InternalsVisibleTo Include="SixLabors.ImageSharp.Tests" PublicKey="$(SixLaborsPublicKey)" />
<InternalsVisibleTo Include="SixLabors.ImageSharp.Tests" />
</ItemGroup> </ItemGroup>
</Project> </Project>

20
tests/ImageSharp.Benchmarks/ImageSharp.Benchmarks.csproj

@ -9,6 +9,9 @@
<GenerateProgramFile>false</GenerateProgramFile> <GenerateProgramFile>false</GenerateProgramFile>
<!--Used to hide test project from dotnet test--> <!--Used to hide test project from dotnet test-->
<IsTestProject>false</IsTestProject> <IsTestProject>false</IsTestProject>
<!-- Uncomment this to run benchmarks depending on Colorful or Pfim (colorspaces and TGA): -->
<!--<SignAssembly>false</SignAssembly>-->
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
@ -25,4 +28,21 @@
<PackageReference Include="System.Drawing.Common" /> <PackageReference Include="System.Drawing.Common" />
</ItemGroup> </ItemGroup>
<!-- Exclude benchmarks using internals, in case of unsigned benchmark execution: -->
<ItemGroup Condition="'$(SignAssembly)' == 'false'">
<Compile Remove="Codecs\Jpeg\BlockOperations\**" />
<Compile Remove="Codecs\Jpeg\DoubleBufferedStreams.cs" />
<Compile Remove="Codecs\Jpeg\YCbCrColorConversion.cs" />
<Compile Remove="Codecs\Jpeg\DecodeJpegParseStreamOnly.cs" />
<Compile Remove="Color\Bulk\**" />
<Compile Remove="Color\RgbToYCbCr.cs" />
<Compile Remove="Color\YCbCrToRgb.cs" />
<Compile Remove="General\Vectorization\**" />
<Compile Remove="General\PixelConversion\**" />
<Compile Remove="General\BasicMath\ModuloPowerOfTwoConstant.cs" />
<Compile Remove="General\BasicMath\ModuloPowerOfTwoVariable.cs" />
<Compile Remove="PixelBlenders\**" />
<Compile Remove="Samplers\Resize.cs" />
</ItemGroup>
</Project> </Project>

6
tests/ImageSharp.Tests/AssemblyInfo.cs

@ -1,6 +0,0 @@
// Copyright (c) Six Labors and contributors.
// Licensed under the Apache License, Version 2.0.
using System.Runtime.CompilerServices;
[assembly:InternalsVisibleTo("ImageSharp.Tests.ProfilingSandbox")]

5
tests/ImageSharp.Tests/Formats/Jpg/JpegDecoderTests.cs

@ -27,11 +27,6 @@ namespace SixLabors.ImageSharp.Tests.Formats.Jpg
private const float ProgressiveTolerance = 0.2F / 100; private const float ProgressiveTolerance = 0.2F / 100;
static JpegDecoderTests()
{
TestEnvironment.PrepareRemoteExecutor();
}
private static ImageComparer GetImageComparer<TPixel>(TestImageProvider<TPixel> provider) private static ImageComparer GetImageComparer<TPixel>(TestImageProvider<TPixel> provider)
where TPixel : unmanaged, IPixel<TPixel> where TPixel : unmanaged, IPixel<TPixel>
{ {

1
tests/ImageSharp.Tests/ImageSharp.Tests.csproj

@ -14,6 +14,7 @@
<ItemGroup> <ItemGroup>
<DotNetCliToolReference Include="dotnet-xunit" /> <DotNetCliToolReference Include="dotnet-xunit" />
<InternalsVisibleTo Include="ImageSharp.Tests.ProfilingSandbox" PublicKey="$(SixLaborsPublicKey)" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>

5
tests/ImageSharp.Tests/Memory/Allocators/ArrayPoolMemoryAllocatorTests.cs

@ -28,11 +28,6 @@ namespace SixLabors.ImageSharp.Tests.Memory.Allocators
/// </summary> /// </summary>
private static MemoryAllocatorFixture StaticFixture { get; } = new MemoryAllocatorFixture(); private static MemoryAllocatorFixture StaticFixture { get; } = new MemoryAllocatorFixture();
static ArrayPoolMemoryAllocatorTests()
{
TestEnvironment.PrepareRemoteExecutor();
}
public class BufferTests : BufferTestSuite public class BufferTests : BufferTestSuite
{ {
public BufferTests() public BufferTests()

5
tests/ImageSharp.Tests/Processing/Processors/Convolution/BokehBlurTest.cs

@ -19,11 +19,6 @@ namespace SixLabors.ImageSharp.Tests.Processing.Processors.Convolution
{ {
public class BokehBlurTest public class BokehBlurTest
{ {
static BokehBlurTest()
{
TestEnvironment.PrepareRemoteExecutor();
}
private static readonly string Components10x2 = @" private static readonly string Components10x2 = @"
[[ 0.00451261+0.0165137j 0.02161237-0.00299122j 0.00387479-0.02682816j [[ 0.00451261+0.0165137j 0.02161237-0.00299122j 0.00387479-0.02682816j
-0.02752798-0.01788438j -0.03553877+0.0154543j -0.01428268+0.04224722j -0.02752798-0.01788438j -0.03553877+0.0154543j -0.01428268+0.04224722j

7
tests/ImageSharp.Tests/TestUtilities/Attributes/ImageDataAttributeBase.cs

@ -18,6 +18,13 @@ namespace SixLabors.ImageSharp.Tests
protected readonly PixelTypes PixelTypes; protected readonly PixelTypes PixelTypes;
static ImageDataAttributeBase()
{
// ImageDataAttributes are used in almost all tests, thus a good place to enforce the execution of
// TestEnvironment static constructor before anything else is done.
TestEnvironment.EnsureSharedInitializersDone();
}
/// <summary> /// <summary>
/// Initializes a new instance of the <see cref="ImageDataAttributeBase"/> class. /// Initializes a new instance of the <see cref="ImageDataAttributeBase"/> class.
/// </summary> /// </summary>

32
tests/ImageSharp.Tests/TestUtilities/TestEnvironment.cs

@ -34,6 +34,11 @@ namespace SixLabors.ImageSharp.Tests
private static readonly Lazy<string> NetCoreVersionLazy = new Lazy<string>(GetNetCoreVersion); private static readonly Lazy<string> NetCoreVersionLazy = new Lazy<string>(GetNetCoreVersion);
static TestEnvironment()
{
PrepareRemoteExecutor();
}
/// <summary> /// <summary>
/// Gets the .NET Core version, if running on .NET Core, otherwise returns an empty string. /// Gets the .NET Core version, if running on .NET Core, otherwise returns an empty string.
/// </summary> /// </summary>
@ -111,6 +116,13 @@ namespace SixLabors.ImageSharp.Tests
internal static bool IsFramework => string.IsNullOrEmpty(NetCoreVersion); internal static bool IsFramework => string.IsNullOrEmpty(NetCoreVersion);
/// <summary>
/// A dummy operation to enforce the execution of the static constructor.
/// </summary>
internal static void EnsureSharedInitializersDone()
{
}
/// <summary> /// <summary>
/// Creates the image output directory. /// Creates the image output directory.
/// </summary> /// </summary>
@ -141,7 +153,7 @@ namespace SixLabors.ImageSharp.Tests
/// When running in 32 bits, enforces 32 bit execution of Microsoft.DotNet.RemoteExecutor.exe /// When running in 32 bits, enforces 32 bit execution of Microsoft.DotNet.RemoteExecutor.exe
/// with the help of CorFlags.exe found in Windows SDK. /// with the help of CorFlags.exe found in Windows SDK.
/// </summary> /// </summary>
internal static void PrepareRemoteExecutor() private static void PrepareRemoteExecutor()
{ {
if (!IsFramework) if (!IsFramework)
{ {
@ -153,12 +165,11 @@ namespace SixLabors.ImageSharp.Tests
if (File.Exists(remoteExecutorConfigPath)) if (File.Exists(remoteExecutorConfigPath))
{ {
// already prepared // Already initialized
return; return;
} }
string testProjectConfigPath = TestAssemblyFile.FullName + ".config"; string testProjectConfigPath = TestAssemblyFile.FullName + ".config";
File.Copy(testProjectConfigPath, remoteExecutorConfigPath); File.Copy(testProjectConfigPath, remoteExecutorConfigPath);
if (Is64BitProcess) if (Is64BitProcess)
@ -184,7 +195,17 @@ namespace SixLabors.ImageSharp.Tests
string remoteExecutorPath = Path.Combine(TestAssemblyFile.DirectoryName, "Microsoft.DotNet.RemoteExecutor.exe"); string remoteExecutorPath = Path.Combine(TestAssemblyFile.DirectoryName, "Microsoft.DotNet.RemoteExecutor.exe");
string args = $"{remoteExecutorPath} /32Bit+ /Force"; string remoteExecutorTmpPath = $"{remoteExecutorPath}._tmp";
if (File.Exists(remoteExecutorTmpPath))
{
// Already initialized
return;
}
File.Copy(remoteExecutorPath, remoteExecutorTmpPath);
string args = $"{remoteExecutorTmpPath} /32Bit+ /Force";
var si = new ProcessStartInfo() var si = new ProcessStartInfo()
{ {
@ -206,6 +227,9 @@ namespace SixLabors.ImageSharp.Tests
$@"Failed to run {si.FileName} {si.Arguments}:\n STDOUT: {standardOutput}\n STDERR: {standardError}"); $@"Failed to run {si.FileName} {si.Arguments}:\n STDOUT: {standardOutput}\n STDERR: {standardError}");
} }
File.Delete(remoteExecutorPath);
File.Copy(remoteExecutorTmpPath, remoteExecutorPath);
static FileInfo Find(DirectoryInfo root, string name) static FileInfo Find(DirectoryInfo root, string name)
{ {
FileInfo fi = root.EnumerateFiles(name).FirstOrDefault(); FileInfo fi = root.EnumerateFiles(name).FirstOrDefault();

Loading…
Cancel
Save