From 97ab49cf527d4e5c606c32c08da18ee3745b9c2a Mon Sep 17 00:00:00 2001 From: Adam Sitnik Date: Tue, 5 Sep 2017 08:37:08 +0200 Subject: [PATCH] target .NET Core 2.0 to take full advantage of the new API, fixes #539 --- build/common.props | 2 +- .../BenchmarkDotNet.Samples.csproj | 4 +-- .../Framework/Framework_SelectVsConvertAll.cs | 2 +- .../Framework_StackFrameVsStackTrace.cs | 2 +- .../BenchmarkDotNet.Core.csproj | 4 +-- .../Code/CodeGenerator.cs | 2 +- .../Diagnosers/WindowsDisassembler.cs | 2 +- src/BenchmarkDotNet.Core/Engines/GcStats.cs | 4 ++- .../Extensions/CommonExtensions.cs | 2 ++ .../Extensions/ProcessExtensions.cs | 2 +- .../Extensions/ThreadExtensions.cs | 2 +- .../Portability/StreamWriter.cs | 2 +- .../Portability/StringExtensions.cs | 2 +- src/BenchmarkDotNet.Core/Reports/Summary.cs | 2 +- .../Reports/SummaryTableExtensions.cs | 2 -- .../CsProj/CsProjClassicNetToolchain.cs | 4 ++- .../Toolchains/CsProj/CsProjCoreToolchain.cs | 5 +++- .../DotNetCli/NetCoreAppSettings.cs | 9 ++++-- .../Toolchains/InProcess/InProcessExecutor.cs | 8 ++--- .../Program.cs | 3 ++ src/BenchmarkDotNet/BenchmarkDotNet.csproj | 2 +- .../BenchmarkDotNet.IntegrationTests.csproj | 4 +-- .../EnvironmentVariablesTests.cs | 6 ++-- .../ExtraAttributesForEntryMethodTests.cs | 12 ++++---- .../BenchmarkDotNet.Tests.csproj | 4 +-- .../Validators/CompilationValidatorTests.cs | 5 ++-- tests/runCoreTests.cmd | 30 ++++++++++++++++--- 27 files changed, 82 insertions(+), 46 deletions(-) diff --git a/build/common.props b/build/common.props index 4e4cdd0ff6..96e88a814b 100644 --- a/build/common.props +++ b/build/common.props @@ -19,7 +19,7 @@ $(DefineConstants);CLASSIC - + $(DefineConstants);CORE diff --git a/samples/BenchmarkDotNet.Samples/BenchmarkDotNet.Samples.csproj b/samples/BenchmarkDotNet.Samples/BenchmarkDotNet.Samples.csproj index 94dbedc327..4e5c83449c 100644 --- a/samples/BenchmarkDotNet.Samples/BenchmarkDotNet.Samples.csproj +++ b/samples/BenchmarkDotNet.Samples/BenchmarkDotNet.Samples.csproj @@ -2,7 +2,7 @@ BenchmarkDotNet.Samples - netcoreapp1.1;net46 + netcoreapp1.1;net46;netcoreapp2.0 win7-x64;win7-x86;osx.10.10-x64;osx.10.11-x64;ubuntu.14.04-x64;ubuntu.16.04-x64;centos.7-x64;rhel.7.2-x64;debian.8-x64;fedora.23-x64;opensuse.13.2-x64 win7-x86 true @@ -21,7 +21,7 @@ - + \ No newline at end of file diff --git a/samples/BenchmarkDotNet.Samples/Framework/Framework_SelectVsConvertAll.cs b/samples/BenchmarkDotNet.Samples/Framework/Framework_SelectVsConvertAll.cs index afe17533f5..cce73aeb83 100644 --- a/samples/BenchmarkDotNet.Samples/Framework/Framework_SelectVsConvertAll.cs +++ b/samples/BenchmarkDotNet.Samples/Framework/Framework_SelectVsConvertAll.cs @@ -1,4 +1,4 @@ -#if !CORE +#if !NETCOREAPP1_1 using System.Collections.Generic; using System.Linq; using BenchmarkDotNet.Attributes; diff --git a/samples/BenchmarkDotNet.Samples/Framework/Framework_StackFrameVsStackTrace.cs b/samples/BenchmarkDotNet.Samples/Framework/Framework_StackFrameVsStackTrace.cs index 6b48a32dca..a27ed06bc5 100644 --- a/samples/BenchmarkDotNet.Samples/Framework/Framework_StackFrameVsStackTrace.cs +++ b/samples/BenchmarkDotNet.Samples/Framework/Framework_StackFrameVsStackTrace.cs @@ -1,4 +1,4 @@ -#if !CORE +#if !NETCOREAPP1_1 using System.Diagnostics; using BenchmarkDotNet.Attributes; diff --git a/src/BenchmarkDotNet.Core/BenchmarkDotNet.Core.csproj b/src/BenchmarkDotNet.Core/BenchmarkDotNet.Core.csproj index 4324ebe74d..293cabdd25 100644 --- a/src/BenchmarkDotNet.Core/BenchmarkDotNet.Core.csproj +++ b/src/BenchmarkDotNet.Core/BenchmarkDotNet.Core.csproj @@ -2,7 +2,7 @@ BenchmarkDotNet.Core - net46;netcoreapp1.1 + net46;netcoreapp1.1;netcoreapp2.0 $(NoWarn);1591 BenchmarkDotNet.Core BenchmarkDotNet.Core @@ -23,7 +23,7 @@ - + diff --git a/src/BenchmarkDotNet.Core/Code/CodeGenerator.cs b/src/BenchmarkDotNet.Core/Code/CodeGenerator.cs index 9b972d4211..576dd3611c 100644 --- a/src/BenchmarkDotNet.Core/Code/CodeGenerator.cs +++ b/src/BenchmarkDotNet.Core/Code/CodeGenerator.cs @@ -146,7 +146,7 @@ private static string GetParamsContent(Benchmark benchmark) private static string GetExtraAttributes(Target target) { -#if !CORE +#if !NETCOREAPP1_1 if (target.Method.GetCustomAttributes(false).OfType().Any()) { return "[System.STAThreadAttribute]"; diff --git a/src/BenchmarkDotNet.Core/Diagnosers/WindowsDisassembler.cs b/src/BenchmarkDotNet.Core/Diagnosers/WindowsDisassembler.cs index accbfade66..999e624006 100644 --- a/src/BenchmarkDotNet.Core/Diagnosers/WindowsDisassembler.cs +++ b/src/BenchmarkDotNet.Core/Diagnosers/WindowsDisassembler.cs @@ -141,7 +141,7 @@ public static bool Is64Bit(Process process) if (Environment.GetEnvironmentVariable("PROCESSOR_ARCHITECTURE") == "x86") return false; -#if !CORE +#if !NETCOREAPP1_1 bool isWow64; if (!IsWow64Process(process.Handle, out isWow64)) throw new Exception("Not Windows"); diff --git a/src/BenchmarkDotNet.Core/Engines/GcStats.cs b/src/BenchmarkDotNet.Core/Engines/GcStats.cs index 79e0c113d7..c28272194d 100644 --- a/src/BenchmarkDotNet.Core/Engines/GcStats.cs +++ b/src/BenchmarkDotNet.Core/Engines/GcStats.cs @@ -128,8 +128,10 @@ private static long GetAllocatedBytes(bool isDiagnosticsEnabled) // AppDomain. The number is accurate as of the last garbage collection." - CLR via C# // so we enforce GC.Collect here just to make sure we get accurate results GC.Collect(); -#if CORE +#if NETCOREAPP1_1 return GetAllocatedBytesForCurrentThreadDelegate.Invoke(); +#elif NETCOREAPP2_0 + return GC.GetAllocatedBytesForCurrentThread(); #elif CLASSIC return AppDomain.CurrentDomain.MonitoringTotalAllocatedMemorySize; #endif diff --git a/src/BenchmarkDotNet.Core/Extensions/CommonExtensions.cs b/src/BenchmarkDotNet.Core/Extensions/CommonExtensions.cs index a8e1f519a6..d79b089167 100644 --- a/src/BenchmarkDotNet.Core/Extensions/CommonExtensions.cs +++ b/src/BenchmarkDotNet.Core/Extensions/CommonExtensions.cs @@ -88,8 +88,10 @@ public static string GetColumnTitle(this IColumn column, ISummaryStyle style) public static bool IsOneOf(this T value, params T[] values) => values.Contains(value); +#if !NETCOREAPP2_0 // this method was added to the .NET Core 2.0 framework itself ;) public static TValue GetValueOrDefault(this IDictionary dictionary, TKey key) => dictionary.TryGetValue(key, out TValue value) ? value : default(TValue); +#endif public static double Sqr(this double x) => x * x; public static double Pow(this double x, double k) => Math.Pow(x, k); diff --git a/src/BenchmarkDotNet.Core/Extensions/ProcessExtensions.cs b/src/BenchmarkDotNet.Core/Extensions/ProcessExtensions.cs index ccb81d18dd..9f4e0cf509 100644 --- a/src/BenchmarkDotNet.Core/Extensions/ProcessExtensions.cs +++ b/src/BenchmarkDotNet.Core/Extensions/ProcessExtensions.cs @@ -100,7 +100,7 @@ private static IntPtr FixAffinity(IntPtr processorAffinity) internal static void SetEnvironmentVariables(this ProcessStartInfo start, Benchmark benchmark, IResolver resolver) { -#if !CORE // ProcessStartInfo.EnvironmentVariables is avaialable for .NET Core 2.0+ +#if !NETCOREAPP1_1 // ProcessStartInfo.EnvironmentVariables is avaialable for .NET Core 2.0+ if (!benchmark.Job.HasValue(InfrastructureMode.EnvironmentVariablesCharacteristic)) return; diff --git a/src/BenchmarkDotNet.Core/Extensions/ThreadExtensions.cs b/src/BenchmarkDotNet.Core/Extensions/ThreadExtensions.cs index 5a0556f190..59cd642a53 100644 --- a/src/BenchmarkDotNet.Core/Extensions/ThreadExtensions.cs +++ b/src/BenchmarkDotNet.Core/Extensions/ThreadExtensions.cs @@ -1,4 +1,4 @@ -#if CLASSIC +#if !NETCOREAPP1_1 using System; using System.Threading; diff --git a/src/BenchmarkDotNet.Core/Portability/StreamWriter.cs b/src/BenchmarkDotNet.Core/Portability/StreamWriter.cs index c3cd4d5c41..fb6a8547b8 100644 --- a/src/BenchmarkDotNet.Core/Portability/StreamWriter.cs +++ b/src/BenchmarkDotNet.Core/Portability/StreamWriter.cs @@ -4,7 +4,7 @@ internal static class StreamWriter { internal static System.IO.StreamWriter FromPath(string path, bool append = false) { -#if !CORE +#if !NETCOREAPP1_1 return new System.IO.StreamWriter(path, append); #else return new System.IO.StreamWriter(System.IO.File.OpenWrite(path)); diff --git a/src/BenchmarkDotNet.Core/Portability/StringExtensions.cs b/src/BenchmarkDotNet.Core/Portability/StringExtensions.cs index a45942c007..f9520c6c8a 100644 --- a/src/BenchmarkDotNet.Core/Portability/StringExtensions.cs +++ b/src/BenchmarkDotNet.Core/Portability/StringExtensions.cs @@ -18,7 +18,7 @@ private static StringComparison IgnoreCaseStringComparison { get { -#if !CORE +#if !NETCOREAPP1_1 return StringComparison.InvariantCultureIgnoreCase; #else // http://stackoverflow.com/questions/14600694/where-has-stringcomparison-invariantcultureignorecase-gone diff --git a/src/BenchmarkDotNet.Core/Reports/Summary.cs b/src/BenchmarkDotNet.Core/Reports/Summary.cs index 71bd2f837d..29d50dfeb3 100644 --- a/src/BenchmarkDotNet.Core/Reports/Summary.cs +++ b/src/BenchmarkDotNet.Core/Reports/Summary.cs @@ -28,7 +28,7 @@ public class Summary private readonly Dictionary shortInfos; private readonly Lazy jobs; - private readonly IDictionary reportMap = new Dictionary(); + private readonly Dictionary reportMap = new Dictionary(); public bool HasReport(Benchmark benchmark) => reportMap.ContainsKey(benchmark); diff --git a/src/BenchmarkDotNet.Core/Reports/SummaryTableExtensions.cs b/src/BenchmarkDotNet.Core/Reports/SummaryTableExtensions.cs index eb723c1724..2627173d4f 100644 --- a/src/BenchmarkDotNet.Core/Reports/SummaryTableExtensions.cs +++ b/src/BenchmarkDotNet.Core/Reports/SummaryTableExtensions.cs @@ -108,9 +108,7 @@ private static StringBuilder GetClearBuffer() return __buffer; } -#if !NET40 [MethodImpl(MethodImplOptions.AggressiveInlining)] -#endif private static void PadLeft(SummaryTable table, string[] line, string leftDel, string rightDel, int columnIndex, StringBuilder buffer) { const char space = ' '; diff --git a/src/BenchmarkDotNet.Core/Toolchains/CsProj/CsProjClassicNetToolchain.cs b/src/BenchmarkDotNet.Core/Toolchains/CsProj/CsProjClassicNetToolchain.cs index 12681834a8..487d714d5a 100644 --- a/src/BenchmarkDotNet.Core/Toolchains/CsProj/CsProjClassicNetToolchain.cs +++ b/src/BenchmarkDotNet.Core/Toolchains/CsProj/CsProjClassicNetToolchain.cs @@ -65,11 +65,13 @@ public override bool IsSupported(Benchmark benchmark, ILogger logger, IResolver return false; } - if (!RuntimeInformation.IsClassic() && benchmark.Job.HasValue(InfrastructureMode.EnvironmentVariablesCharacteristic)) +#if NETCOREAPP1_1 + if (benchmark.Job.HasValue(InfrastructureMode.EnvironmentVariablesCharacteristic)) { logger.WriteLineError($"ProcessStartInfo.EnvironmentVariables is avaialable for .NET Core 2.0, benchmark '{benchmark.DisplayInfo}' will not be executed"); return false; } +#endif return true; } diff --git a/src/BenchmarkDotNet.Core/Toolchains/CsProj/CsProjCoreToolchain.cs b/src/BenchmarkDotNet.Core/Toolchains/CsProj/CsProjCoreToolchain.cs index 11da79ef0b..3498e8b74e 100644 --- a/src/BenchmarkDotNet.Core/Toolchains/CsProj/CsProjCoreToolchain.cs +++ b/src/BenchmarkDotNet.Core/Toolchains/CsProj/CsProjCoreToolchain.cs @@ -68,11 +68,14 @@ public override bool IsSupported(Benchmark benchmark, ILogger logger, IResolver logger.WriteLineError($"Currently project.json does not support gcAllowVeryLargeObjects (app.config does), benchmark '{benchmark.DisplayInfo}' will not be executed"); return false; } - if (!RuntimeInformation.IsClassic() && benchmark.Job.HasValue(InfrastructureMode.EnvironmentVariablesCharacteristic)) + +#if NETCOREAPP1_1 + if (benchmark.Job.HasValue(InfrastructureMode.EnvironmentVariablesCharacteristic)) { logger.WriteLineError($"ProcessStartInfo.EnvironmentVariables is avaialable for .NET Core 2.0, benchmark '{benchmark.DisplayInfo}' will not be executed"); return false; } +#endif return true; } diff --git a/src/BenchmarkDotNet.Core/Toolchains/DotNetCli/NetCoreAppSettings.cs b/src/BenchmarkDotNet.Core/Toolchains/DotNetCli/NetCoreAppSettings.cs index e1d0fac063..f8db379a02 100644 --- a/src/BenchmarkDotNet.Core/Toolchains/DotNetCli/NetCoreAppSettings.cs +++ b/src/BenchmarkDotNet.Core/Toolchains/DotNetCli/NetCoreAppSettings.cs @@ -13,7 +13,12 @@ public class NetCoreAppSettings [PublicAPI] public static readonly NetCoreAppSettings NetCoreApp12 = new NetCoreAppSettings("netcoreapp1.2", null, ".NET Core 1.0"); [PublicAPI] public static readonly NetCoreAppSettings NetCoreApp20 = new NetCoreAppSettings("netcoreapp2.0", null, ".NET Core 2.0"); - private static NetCoreAppSettings Default => NetCoreApp11; + private static NetCoreAppSettings Default => +#if NETCOREAPP2_0 + NetCoreApp20; +#else + NetCoreApp11; +#endif /// /// @@ -37,7 +42,7 @@ public class NetCoreAppSettings } /// - /// sample values: netcoreapp1.1, netcoreapp1.2, netcoreapp2.0 + /// sample values: netcoreapp1.1, netcoreapp2.0, netcoreapp2.1 /// public string TargetFrameworkMoniker { get; } diff --git a/src/BenchmarkDotNet.Core/Toolchains/InProcess/InProcessExecutor.cs b/src/BenchmarkDotNet.Core/Toolchains/InProcess/InProcessExecutor.cs index e83d6d6bca..20b68d37b3 100644 --- a/src/BenchmarkDotNet.Core/Toolchains/InProcess/InProcessExecutor.cs +++ b/src/BenchmarkDotNet.Core/Toolchains/InProcess/InProcessExecutor.cs @@ -67,7 +67,7 @@ public ExecuteResult Execute(ExecuteParameters executeParameters) int exitCode = -1; var runThread = new Thread(() => exitCode = ExecuteCore(host, executeParameters.Benchmark, executeParameters.Logger)); -#if CLASSIC +#if !NETCOREAPP1_1 if (executeParameters.Benchmark.Target.Method.GetCustomAttributes(false).Any()) { runThread.SetApartmentState(ApartmentState.STA); @@ -93,7 +93,7 @@ private int ExecuteCore(IHost host, Benchmark benchmark, ILogger logger) var process = Process.GetCurrentProcess(); var oldPriority = process.PriorityClass; var oldAffinity = process.TryGetAffinity(); -#if CLASSIC +#if !NETCOREAPP1_1 var thread = Thread.CurrentThread; var oldThreadPriority = thread.Priority; #endif @@ -102,7 +102,7 @@ private int ExecuteCore(IHost host, Benchmark benchmark, ILogger logger) try { process.TrySetPriority(ProcessPriorityClass.High, logger); -#if CLASSIC +#if !NETCOREAPP1_1 thread.TrySetPriority(ThreadPriority.Highest, logger); #endif if (affinity != null) @@ -119,7 +119,7 @@ private int ExecuteCore(IHost host, Benchmark benchmark, ILogger logger) finally { process.TrySetPriority(oldPriority, logger); -#if CLASSIC +#if !NETCOREAPP1_1 thread.TrySetPriority(oldThreadPriority, logger); #endif if (affinity != null && oldAffinity != null) diff --git a/src/BenchmarkDotNet.Disassembler.x64/Program.cs b/src/BenchmarkDotNet.Disassembler.x64/Program.cs index 665768600a..bbae195d8f 100644 --- a/src/BenchmarkDotNet.Disassembler.x64/Program.cs +++ b/src/BenchmarkDotNet.Disassembler.x64/Program.cs @@ -287,6 +287,9 @@ static string ReadSourceLine(string file, int line) string[] contents; if (!SourceFileCache.TryGetValue(file, out contents)) { + if (!File.Exists(file)) // sometimes the symbols report some disk location from MS CI machine like "E:\A\_work\308\s\src\mscorlib\shared\System\Random.cs" for .NET Core 2.0 + return null; + contents = File.ReadAllLines(file); SourceFileCache.Add(file, contents); } diff --git a/src/BenchmarkDotNet/BenchmarkDotNet.csproj b/src/BenchmarkDotNet/BenchmarkDotNet.csproj index 43b4c96563..a6d9b78d1c 100644 --- a/src/BenchmarkDotNet/BenchmarkDotNet.csproj +++ b/src/BenchmarkDotNet/BenchmarkDotNet.csproj @@ -2,7 +2,7 @@ BenchmarkDotNet - net46;netcoreapp1.1 + net46;netcoreapp1.1;netcoreapp2.0 $(NoWarn);1591 BenchmarkDotNet BenchmarkDotNet diff --git a/tests/BenchmarkDotNet.IntegrationTests/BenchmarkDotNet.IntegrationTests.csproj b/tests/BenchmarkDotNet.IntegrationTests/BenchmarkDotNet.IntegrationTests.csproj index d2c5857bd6..ce2fc21990 100644 --- a/tests/BenchmarkDotNet.IntegrationTests/BenchmarkDotNet.IntegrationTests.csproj +++ b/tests/BenchmarkDotNet.IntegrationTests/BenchmarkDotNet.IntegrationTests.csproj @@ -2,7 +2,7 @@ BenchmarkDotNet.IntegrationTests - netcoreapp1.1;net46 + netcoreapp1.1;net46;netcoreapp2.0 true BenchmarkDotNet.IntegrationTests BenchmarkDotNet.IntegrationTests @@ -31,7 +31,7 @@ - + diff --git a/tests/BenchmarkDotNet.IntegrationTests/EnvironmentVariablesTests.cs b/tests/BenchmarkDotNet.IntegrationTests/EnvironmentVariablesTests.cs index f376bf63d0..46eea397ff 100644 --- a/tests/BenchmarkDotNet.IntegrationTests/EnvironmentVariablesTests.cs +++ b/tests/BenchmarkDotNet.IntegrationTests/EnvironmentVariablesTests.cs @@ -1,8 +1,8 @@ using System; using System.Collections.Generic; using BenchmarkDotNet.Attributes; -using BenchmarkDotNet.IntegrationTests.Xunit; using BenchmarkDotNet.Jobs; +using Xunit; using Xunit.Abstractions; namespace BenchmarkDotNet.IntegrationTests @@ -16,7 +16,9 @@ public EnvironmentVariablesTests(ITestOutputHelper output) : base(output) { } - [FactClassicDotNetOnly("ProcessStartInfo.EnvironmentVariables is avaialable for .NET Core 2.0+")] +#if !NETCOREAPP1_1 // ProcessStartInfo.EnvironmentVariables is avaialable for .NET Core 2.0+ + [Fact] +#endif public void UserCanSpecifyEnvironmentVariables() { var variables = new [] { new EnvironmentVariable(Key, Value) }; diff --git a/tests/BenchmarkDotNet.IntegrationTests/ExtraAttributesForEntryMethodTests.cs b/tests/BenchmarkDotNet.IntegrationTests/ExtraAttributesForEntryMethodTests.cs index ca76053033..304e3809b2 100644 --- a/tests/BenchmarkDotNet.IntegrationTests/ExtraAttributesForEntryMethodTests.cs +++ b/tests/BenchmarkDotNet.IntegrationTests/ExtraAttributesForEntryMethodTests.cs @@ -1,6 +1,7 @@ -using System.Threading; +#if !NETCOREAPP1_1 +using System.Threading; using BenchmarkDotNet.Attributes; -#if !CORE +using BenchmarkDotNet.IntegrationTests.Xunit; using Xunit; using Xunit.Abstractions; @@ -12,11 +13,8 @@ public ExtraAttributesForEntryMethodTests(ITestOutputHelper output) : base(outpu { } - [Fact] - public void UserCanMarkBenchmarkAsRequiringSTA() - { - CanExecute(); - } + [FactClassicDotNetOnly("STAThread attribute is not respected in netcoreapp https://github.com/dotnet/coreclr/issues/13688")] + public void UserCanMarkBenchmarkAsRequiringSTA() => CanExecute(); public class RequiresSTA { diff --git a/tests/BenchmarkDotNet.Tests/BenchmarkDotNet.Tests.csproj b/tests/BenchmarkDotNet.Tests/BenchmarkDotNet.Tests.csproj index a460b40e36..d9dd5a2b37 100644 --- a/tests/BenchmarkDotNet.Tests/BenchmarkDotNet.Tests.csproj +++ b/tests/BenchmarkDotNet.Tests/BenchmarkDotNet.Tests.csproj @@ -2,7 +2,7 @@ BenchmarkDotNet.Tests - netcoreapp1.1;net46 + netcoreapp1.1;net46;netcoreapp2.0 BenchmarkDotNet.Tests BenchmarkDotNet.Tests true @@ -19,7 +19,7 @@ - + diff --git a/tests/BenchmarkDotNet.Tests/Validators/CompilationValidatorTests.cs b/tests/BenchmarkDotNet.Tests/Validators/CompilationValidatorTests.cs index 7c09394ab8..8f195a7fc0 100644 --- a/tests/BenchmarkDotNet.Tests/Validators/CompilationValidatorTests.cs +++ b/tests/BenchmarkDotNet.Tests/Validators/CompilationValidatorTests.cs @@ -1,10 +1,9 @@ -#if CLASSIC +#if !NETCOREAPP1_1 using System; using System.Linq; using System.Reflection.Emit; using BenchmarkDotNet.Configs; using BenchmarkDotNet.Jobs; -using BenchmarkDotNet.Parameters; using BenchmarkDotNet.Running; using BenchmarkDotNet.Validators; using Xunit; @@ -19,7 +18,7 @@ public void BenchmarkedMethodNameMustNotContainWhitespaces() Delegate method = BuildDummyMethod("Has Some Whitespaces"); var parameters = new ValidationParameters( - new Benchmark[1] + new[] { new Benchmark( new Target( diff --git a/tests/runCoreTests.cmd b/tests/runCoreTests.cmd index 0ebd9730d8..86f772a818 100644 --- a/tests/runCoreTests.cmd +++ b/tests/runCoreTests.cmd @@ -12,25 +12,47 @@ if NOT %ERRORLEVEL% == 0 ( ) echo ----------------------------- -echo Running Core Unit tests +echo Running Core 1.1 Unit tests echo ----------------------------- call dotnet test "BenchmarkDotNet.Tests\BenchmarkDotNet.Tests.csproj" --configuration Release --framework netcoreapp1.1 if NOT %ERRORLEVEL% == 0 ( - echo CORE Unit tests has failed + echo CORE 1.1 Unit tests has failed + goto end +) + +echo ----------------------------- +echo Running Core 2.0 Unit tests +echo ----------------------------- + +call dotnet test "BenchmarkDotNet.Tests\BenchmarkDotNet.Tests.csproj" --configuration Release --framework netcoreapp2.0 + +if NOT %ERRORLEVEL% == 0 ( + echo CORE 2.0 Unit tests has failed goto end ) echo ----------------------------- -echo Running Core Integration tests +echo Running Core 1.1 Integration tests echo ----------------------------- call dotnet test "BenchmarkDotNet.IntegrationTests\BenchmarkDotNet.IntegrationTests.csproj" --configuration Release --framework netcoreapp1.1 if NOT %ERRORLEVEL% == 0 ( - echo CORE Integration tests has failed + echo CORE 1.1 Integration tests has failed + goto end +) + +echo ----------------------------- +echo Running Core 2.0 Integration tests +echo ----------------------------- + +call dotnet test "BenchmarkDotNet.IntegrationTests\BenchmarkDotNet.IntegrationTests.csproj" --configuration Release --framework netcoreapp2.0 + +if NOT %ERRORLEVEL% == 0 ( + echo CORE 2.0 Integration tests has failed goto end )