Skip to content

[tests] update MSBuild performance tests #9231

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

Merged
merged 1 commit into from
Sep 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
65 changes: 2 additions & 63 deletions tests/MSBuildDeviceIntegration/Tests/PerformanceTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,6 @@ void Profile (ProjectBuilder builder, Action<ProjectBuilder> action, [CallerMemb
Assert.Fail ($"No timeout value found for a key of {caller}");
}

//TODO: Update baselines in MSBuildDeviceIntegration.csv, there is currently a slight performance regression in .NET 6
expected += 500;

action (builder);
var actual = GetDurationFromBinLog (builder);
TestContext.Out.WriteLine($"expected: {expected}ms, actual: {actual}ms");
Expand Down Expand Up @@ -203,27 +200,6 @@ public void Build_AndroidAsset_Change ()
}
}

[Test]
[Retry (Retry)]
public void Build_Designer_Change ()
{
var proj = CreateApplicationProject ();
using (var builder = CreateBuilderWithoutLogFile ()) {
builder.Target = "Build";
builder.Build (proj);
builder.AutomaticNuGetRestore = false;

// Change AndroidResource & run SetupDependenciesForDesigner
proj.LayoutMain += $"{Environment.NewLine}<!--comment-->";
proj.Touch ("Resources\\layout\\Main.axml");
var parameters = new [] { "DesignTimeBuild=True", "AndroidUseManagedDesignTimeResourceGenerator=False" };
builder.RunTarget (proj, "SetupDependenciesForDesigner", parameters: parameters);

// Profile AndroidResource change
Profile (builder, b => b.Build (proj));
}
}

[Test]
[Retry (Retry)]
public void Build_JLO_Change ()
Expand Down Expand Up @@ -263,43 +239,9 @@ public void Build_AndroidManifest_Change ()
}

[Test]
[Retry (Retry)]
public void Build_CSProj_Change ()
{
var proj = CreateApplicationProject ();
using (var builder = CreateBuilderWithoutLogFile ()) {
builder.Target = "Build";
builder.Build (proj);
builder.AutomaticNuGetRestore = false;

// Profile .csproj change
proj.Sources.Add (new BuildItem ("None", "Foo.txt") {
TextContent = () => "Bar",
});
Profile (builder, b => b.Build (proj));
}
}

static object [] XAML_Change = new object [] {
new object [] {
/* produceReferenceAssembly */ false,
/* install */ false,
},
new object [] {
/* produceReferenceAssembly */ true,
/* install */ false,
},
new object [] {
/* produceReferenceAssembly */ true,
/* install */ true,
},
};

[Test]
[TestCaseSource (nameof (XAML_Change))]
[Category ("UsesDevice")]
[Retry (Retry)]
public void Build_XAML_Change (bool produceReferenceAssembly, bool install)
public void Build_XAML_Change ([Values (true, false)] bool install)
{
if (install) {
AssertCommercialBuild (); // This test will fail without Fast Deployment
Expand All @@ -315,8 +257,6 @@ public void Build_XAML_Change (bool produceReferenceAssembly, bool install)
var caller = nameof (Build_XAML_Change);
if (install) {
caller = caller.Replace ("Build", "Install");
} else if (produceReferenceAssembly) {
caller += "_RefAssembly";
}
var app = CreateApplicationProject ();
app.ProjectName = "MyApp";
Expand All @@ -332,7 +272,7 @@ public void Build_XAML_Change (bool produceReferenceAssembly, bool install)
var lib = new DotNetStandard {
ProjectName = "MyLibrary",
Sdk = "Microsoft.NET.Sdk",
TargetFramework = "netstandard2.0",
TargetFramework = "net8.0", // Vanilla project
Sources = {
new BuildItem.Source ("Bar.cs") {
TextContent = () => "public class Bar { public Bar () { System.Console.WriteLine (" + count++ + "); } }"
Expand All @@ -345,7 +285,6 @@ public void Build_XAML_Change (bool produceReferenceAssembly, bool install)
KnownPackages.XamarinForms,
}
};
lib.SetProperty ("ProduceReferenceAssembly", produceReferenceAssembly.ToString ());
app.References.Add (new BuildItem.ProjectReference ($"..\\{lib.ProjectName}\\{lib.ProjectName}.csproj", lib.ProjectName, lib.ProjectGuid));

using (var libBuilder = CreateBuilderWithoutLogFile (Path.Combine (path, lib.ProjectName), isApp: false))
Expand Down
19 changes: 8 additions & 11 deletions tests/msbuild-times-reference/MSBuildDeviceIntegration.csv
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,12 @@
Test Name,Time in ms (int)
# Data
Build_From_Clean_DontIncludeRestore,13000
Build_No_Changes,2500
Build_CSharp_Change,4000
Build_AndroidResource_Change,3250
Build_AndroidAsset_Change,10000
Build_No_Changes,2250
Build_CSharp_Change,3500
Build_AndroidResource_Change,2250
Build_AndroidAsset_Change,6500
Build_AndroidManifest_Change,4500
Build_Designer_Change,3000
Build_JLO_Change,10000
Build_CSProj_Change,12500
Build_XAML_Change,7400
Build_XAML_Change_RefAssembly,4000
Install_CSharp_Change,4500
Install_XAML_Change,5000
Build_JLO_Change,4500
Build_XAML_Change,3000
Install_CSharp_Change,4000
Install_XAML_Change,3750
Loading