Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enabling performance tests #1796

Merged
merged 11 commits into from
Jan 24, 2018
Merged

Conversation

johnbeisner
Copy link
Contributor

No description provided.

@johnbeisner johnbeisner self-assigned this Dec 5, 2017
@johnbeisner johnbeisner changed the title First draft enabling performance tests... WIP: First draft enabling performance tests... Dec 6, 2017
@johnbeisner johnbeisner mentioned this pull request Dec 8, 2017
@johnbeisner
Copy link
Contributor Author

@dsplaisted
Can I get a review of this please.

@nguerrera
Copy link
Contributor

Hard to see what changed from #1718. Why did you drop @dsplaisted's commits and attribution?

@@ -110,6 +110,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.NET.Build.Tests",
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.NET.Pack.Tests", "src\Tests\Microsoft.NET.Pack.Tests\Microsoft.NET.Pack.Tests.csproj", "{8746DC05-3035-4F24-9F2C-BAAAB5B50FD3}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.NET.Perf.Tests", "src\Tests\Microsoft.NET.Perf.Tests\Microsoft.NET.Perf.Tests.csproj", "{AFB72217-54A0-4E76-870A-42718B8E0AE5}"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we want the perf tests to run as part of the unit test switch, or do we want them to run separately (which, I believe, is what most of the other repos are doing)?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We want the perf tests to run with a single iteration during normal tests. That will ensure that they don't get functionally broken. When running in the perf lab, they should run with more iterations, but this will only happen automatically after a PR is merged (though it will be possible to request a perf run for an unmerged PR).

@johnbeisner
Copy link
Contributor Author

@nguerrera
SDK is now moved to repo-toolset - some of the files Daniel had changed no longer exist. Therefore, I started from the core perf tests and worked to enabled them using Daniel's changes as a guide.

<PackageReference Include="Microsoft.Diagnostics.Tracing.TraceEvent" Version="1.0.3-alpha-experimental" />
<PackageReference Include="Microsoft.DotNet.Cli.Utils" Version="$(MicrosoftDotNetCliUtilsVersion)" />
<PackageReference Include="FluentAssertions" Version="$(FluentAssertionsVersion)" />
<PackageReference Include="xunit.performance.api" Version="1.0.0-beta-build0011" />
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add a variable $(XUnitPerformanceApiVersion)

@@ -24,7 +24,9 @@ public BuildPerf(ITestOutputHelper log) : base(log)

// These tests are currently disabled for full framework MSBuild because the CI machines don't
// have an MSBuild that supports the /restore command-line argument
[CoreMSBuildOnlyTheory]
// Also, Microsoft.Xunit.Performance.Api.ProcessExitInfo doesn't handle non-Windows
// information gathering - disabling for non-Windows
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please file a bug for this in https://github.com/microsoft/xunit-performance/issues and link to that issue in this comment.

// These tests are currently disabled for full framework MSBuild because the CI machines don't
// have an MSBuild that supports the /restore command-line argument
// Also, Microsoft.Xunit.Performance.Api.ProcessExitInfo doesn't handle non-Windows
// information gathering - disabling for non-Windows
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

File a bug in https://github.com/Microsoft/xunit-performance for this, and link to it from this comment.

<Copy SourceFiles="@(_CopyDirectoryBuildTestDependenciesInput)"
DestinationFiles="@(_CopyDirectoryBuildTestDependenciesOutput)" />
<Target Name="_CopyDirectoryBuildTestDependencies" AfterTargets="Build" Inputs="@(_CopyDirectoryBuildTestDependenciesInput)" Outputs="@(_CopyDirectoryBuildTestDependenciesOutput)">
<Copy SourceFiles="@(_CopyDirectoryBuildTestDependenciesInput)" DestinationFiles="@(_CopyDirectoryBuildTestDependenciesOutput)" />
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks like it's just a formatting change (probably by Visual Studio). Revert this.

@johnbeisner johnbeisner changed the title WIP: First draft enabling performance tests... Enabling performance tests Jan 4, 2018

namespace Microsoft.NET.Perf.Tests
{
public class PerfTest
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought that both perf frameworks provided infrastructure for all this. Why are we writing our own?

TestName = TestName ?? callerName;

Stopwatch stopwatch = new Stopwatch();
TimeSpan[] executionTimes = new TimeSpan[NumberOfIterations];
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The stopwatch and executionTimes variables are left over from previous versions of the code and should now be deleted.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed...

@tannergooding
Copy link
Member

Overall it looks ok. However, I would like to see the following:

  1. Removal of all the unused variables/etc (after talking with @dsplaisted, many are leftover from previous prototypes of the code).
  2. Bugs logged against the perf framework we are using that track usability issues/improvements that are needed (we are currently doing a lot of manual setup/teardown and value initialization for things that should probably be part of the perf API).

@@ -88,6 +89,16 @@
<LayoutFile Include="@(PackFile)">
<TargetPath>..\NuGet.Build.Tasks.Pack\%(PackFile.RecursiveDir)%(PackFile.Filename)%(PackFile.Extension)</TargetPath>
</LayoutFile>

<!-- Include some of the Sdks from the Stage 0 CLI for performance tests-->
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are these the SDK files that the CLI requires that are not produced by dotnet/sdk?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These are SDK files that the Performance tests require that are not produced by dotnet/sdk

}

[CoreMSBuildOnlyTheory(Skip ="The code for these scenarios needs to be acquired during the test run (instead of relying on hard-coded local path)")]

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NIT: empty line here seems weird.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed...


var testAsset = _testAssetsManager.CreateTestProject(testProject, identifier: operation.ToString());

TestProject(testAsset.Path, ".NET Core 2 Console App", operation);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This name, TestProject, does it mean go run a test on the project or is it a more of a name to create TestProject, which happens to do things like build.

The name seems strange here. Does not read like an action. At least, I didn't read it as such at first.

{
string OriginalPath { get; set; }
string BackupPath { get; set; }

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NIT: there is an extra empty line here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed...


public static FolderSnapshot Create(string path)
{
FolderSnapshot ret = new FolderSnapshot();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why is this called ret?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed...

{
Directory.Delete(dest, true);
}
CopyDirectory(source, dest);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NIT: empty line after closing brackets. Check this in the rest of the files.

We should add this to our editorconfig.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed...

}

[Fact]
public void ShowToolsetPaths()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is this test doing?

}

protected override SdkCommandSpec CreateCommand(string[] args)
{
return new SdkCommandSpec()
var ret = new SdkCommandSpec()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ret? better name please.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed...

@johnbeisner johnbeisner merged commit 195044c into dotnet:release/2.0.0 Jan 24, 2018
johnbeisner pushed a commit that referenced this pull request Jan 30, 2018
* First draft enabling performance tests...

* Resolved BUG: microsoft/xunit-performance#248
johnbeisner pushed a commit that referenced this pull request Feb 7, 2018
* First draft enabling performance tests...

* Disabling tests for non-Windows...

* Updates...

* Missing "\"

* Set 'DefaultIterations' to "1"

* Resolved BUG: microsoft/xunit-performance#248

* Fixing typos...

* Formatting, variable names changes.

* Fixing a typo...
@johnbeisner johnbeisner deleted the PerfTests branch February 25, 2018 23:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants