[build] Add BenchmarkDotNet.Exporters.Plotting.Tests to unit-tests

This commit is contained in:
Andrey Akinshin 2024-07-20 10:13:52 +02:00
Родитель 834417a7db
Коммит 15200d46a1
2 изменённых файлов: 25 добавлений и 24 удалений

Просмотреть файл

@ -1,4 +1,7 @@
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/PredefinedNamingRules/=PrivateInstanceFields/@EntryIndexedValue">&lt;Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" /&gt;</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/PredefinedNamingRules/=PrivateStaticFields/@EntryIndexedValue">&lt;Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" /&gt;</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/UserRules/=4a98fdf6_002D7d98_002D4f5a_002Dafeb_002Dea44ad98c70c/@EntryIndexedValue">&lt;Policy&gt;&lt;Descriptor Staticness="Instance" AccessRightKinds="Private" Description="Instance fields (private)"&gt;&lt;ElementKinds&gt;&lt;Kind Name="FIELD" /&gt;&lt;Kind Name="READONLY_FIELD" /&gt;&lt;/ElementKinds&gt;&lt;/Descriptor&gt;&lt;Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" /&gt;&lt;/Policy&gt;</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/UserRules/=f9fce829_002De6f4_002D4cb2_002D80f1_002D5497c44f51df/@EntryIndexedValue">&lt;Policy&gt;&lt;Descriptor Staticness="Static" AccessRightKinds="Private" Description="Static fields (private)"&gt;&lt;ElementKinds&gt;&lt;Kind Name="FIELD" /&gt;&lt;/ElementKinds&gt;&lt;/Descriptor&gt;&lt;Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" /&gt;&lt;/Policy&gt;</s:String>
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ESettingsUpgrade_002EPredefinedNamingRulesToUserRulesUpgrade/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Nupkg/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary>

Просмотреть файл

@ -7,28 +7,25 @@ using Cake.Core.IO;
namespace BenchmarkDotNet.Build.Runners;
public class UnitTestRunner
public class UnitTestRunner(BuildContext context)
{
private readonly BuildContext context;
private FilePath UnitTestsProjectFile { get; } = context.RootDirectory
.Combine("tests")
.Combine("BenchmarkDotNet.Tests")
.CombineWithFilePath("BenchmarkDotNet.Tests.csproj");
private FilePath UnitTestsProjectFile { get; }
private FilePath IntegrationTestsProjectFile { get; }
private DirectoryPath TestOutputDirectory { get; }
private FilePath ExporterTestsProjectFile { get; } = context.RootDirectory
.Combine("tests")
.Combine("BenchmarkDotNet.Exporters.Plotting.Tests")
.CombineWithFilePath("BenchmarkDotNet.Exporters.Plotting.Tests.csproj");
public UnitTestRunner(BuildContext context)
{
this.context = context;
UnitTestsProjectFile = context.RootDirectory
.Combine("tests")
.Combine("BenchmarkDotNet.Tests")
.CombineWithFilePath("BenchmarkDotNet.Tests.csproj");
IntegrationTestsProjectFile = context.RootDirectory
.Combine("tests")
.Combine("BenchmarkDotNet.IntegrationTests")
.CombineWithFilePath("BenchmarkDotNet.IntegrationTests.csproj");
TestOutputDirectory = context.RootDirectory
.Combine("TestResults");
}
private FilePath IntegrationTestsProjectFile { get; } = context.RootDirectory
.Combine("tests")
.Combine("BenchmarkDotNet.IntegrationTests")
.CombineWithFilePath("BenchmarkDotNet.IntegrationTests.csproj");
private DirectoryPath TestOutputDirectory { get; } = context.RootDirectory
.Combine("TestResults");
private DotNetTestSettings GetTestSettingsParameters(FilePath logFile, string tfm)
{
@ -58,14 +55,15 @@ public class UnitTestRunner
context.DotNetTest(projectFile.FullPath, settings);
}
private void RunUnitTests(string tfm) => RunTests(UnitTestsProjectFile, "unit", tfm);
private void RunUnitTests(string tfm)
{
RunTests(UnitTestsProjectFile, "unit", tfm);
RunTests(ExporterTestsProjectFile, "exporters", tfm);
}
public void RunUnitTests()
{
var targetFrameworks = context.IsRunningOnWindows()
? new[] { "net462", "net8.0" }
: new[] { "net8.0" };
string[] targetFrameworks = context.IsRunningOnWindows() ? ["net462", "net8.0"] : ["net8.0"];
foreach (var targetFramework in targetFrameworks)
RunUnitTests(targetFramework);
}