From 21ad572ee65e8d46a29ef2e25ddca87c096b626f Mon Sep 17 00:00:00 2001 From: James Jackson-South Date: Fri, 17 Jan 2020 11:37:15 +1100 Subject: [PATCH] Speed up coverage and respond to comments --- ci-test.ps1 | 16 ++++++++-------- src/ImageSharp/Advanced/AotCompilerTools.cs | 2 ++ tests/Directory.Build.targets | 6 +++--- .../ImageSharp.Benchmarks.csproj | 1 + 4 files changed, 14 insertions(+), 11 deletions(-) diff --git a/ci-test.ps1 b/ci-test.ps1 index fe470a04b..c9cfc07a3 100644 --- a/ci-test.ps1 +++ b/ci-test.ps1 @@ -6,18 +6,18 @@ param( [Parameter(Mandatory, Position = 2)] [string]$platform, [Parameter(Mandatory, Position = 3)] - [string]$codecov + [string]$codecov, + [Parameter(Position = 4)] + [string]$codecovProfile = 'Release' ) - $netFxRegex = '^net\d+' +$netFxRegex = '^net\d+' if ($codecov -eq 'true') { - # xunit doesn't understand custom params so use dotnet test. - # Coverage tests are run in debug because the coverage tools are triggering a JIT error in filter processors - # that causes the blue component of transformed values to be corrupted. - dotnet clean -c Debug - dotnet test -c Debug -f $targetFramework /p:codecov=true + # Allow toggling of profile to workaround any potential JIT errors caused by code injection. + dotnet clean -c $codecovProfile + dotnet test -c $codecovProfile -f $targetFramework /p:codecov=true } elseif ($platform -eq '-x86' -and $targetFramework -match $netFxRegex) { @@ -31,7 +31,7 @@ elseif ($platform -eq '-x86' -and $targetFramework -match $netFxRegex) { Set-Location $PSScriptRoot } -else { +else { dotnet test --no-build -c Release -f $targetFramework } diff --git a/src/ImageSharp/Advanced/AotCompilerTools.cs b/src/ImageSharp/Advanced/AotCompilerTools.cs index 60c1f4178..bb4ddb7d0 100644 --- a/src/ImageSharp/Advanced/AotCompilerTools.cs +++ b/src/ImageSharp/Advanced/AotCompilerTools.cs @@ -1,6 +1,7 @@ // Copyright (c) Six Labors and contributors. // Licensed under the Apache License, Version 2.0. +using System.Diagnostics.CodeAnalysis; using System.Numerics; using System.Runtime.CompilerServices; using SixLabors.ImageSharp.Formats; @@ -19,6 +20,7 @@ namespace SixLabors.ImageSharp.Advanced /// None of the methods in this class should ever be called, the code only has to exist at compile-time to be picked up by the AoT compiler. /// (Very similar to the LinkerIncludes.cs technique used in Xamarin.Android projects.) /// + [ExcludeFromCodeCoverage] internal static class AotCompilerTools { static AotCompilerTools() diff --git a/tests/Directory.Build.targets b/tests/Directory.Build.targets index 40347763d..26baee07e 100644 --- a/tests/Directory.Build.targets +++ b/tests/Directory.Build.targets @@ -29,7 +29,7 @@ true true opencover - + $(MSBuildThisFileDirectory)..\coverage.xml @@ -40,8 +40,8 @@ - - + + diff --git a/tests/ImageSharp.Benchmarks/ImageSharp.Benchmarks.csproj b/tests/ImageSharp.Benchmarks/ImageSharp.Benchmarks.csproj index 34f517500..edadf711d 100644 --- a/tests/ImageSharp.Benchmarks/ImageSharp.Benchmarks.csproj +++ b/tests/ImageSharp.Benchmarks/ImageSharp.Benchmarks.csproj @@ -8,6 +8,7 @@ netcoreapp3.1;netcoreapp2.1;net472 false + false