Skip to content

Commit

Permalink
[build] Add BenchmarkDotNet.Exporters.Plotting.Tests to unit-tests
Browse files Browse the repository at this point in the history
  • Loading branch information
AndreyAkinshin committed Jul 20, 2024
1 parent 834417a commit 15200d4
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 24 deletions.
3 changes: 3 additions & 0 deletions build/BenchmarkDotNet.Build/Folder.DotSettings
Original file line number Diff line number Diff line change
@@ -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>
46 changes: 22 additions & 24 deletions build/BenchmarkDotNet.Build/Runners/UnitTestRunner.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,28 +7,25 @@

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)
{
Expand Down Expand Up @@ -58,14 +55,15 @@ private void RunTests(FilePath projectFile, string alias, string tfm)
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);
}
Expand Down

0 comments on commit 15200d4

Please sign in to comment.