diff --git a/TestAssets/TestProjects/PerformanceTestProjects/SingleTargetGraph/SingleTargetP0/Program.cs b/TestAssets/TestProjects/PerformanceTestProjects/SingleTargetGraph/SingleTargetP0/Program.cs index 9bfc3c72c..ca05ade7a 100644 --- a/TestAssets/TestProjects/PerformanceTestProjects/SingleTargetGraph/SingleTargetP0/Program.cs +++ b/TestAssets/TestProjects/PerformanceTestProjects/SingleTargetGraph/SingleTargetP0/Program.cs @@ -6,6 +6,7 @@ namespace ConsoleApplication { public static void Main() { + ConsoleLibrary.P1.Program.Main(); } } } diff --git a/TestAssets/TestProjects/PerformanceTestProjects/SingleTargetGraph/SingleTargetP1/Program.cs b/TestAssets/TestProjects/PerformanceTestProjects/SingleTargetGraph/SingleTargetP1/Program.cs index 9bfc3c72c..ea50de9e8 100644 --- a/TestAssets/TestProjects/PerformanceTestProjects/SingleTargetGraph/SingleTargetP1/Program.cs +++ b/TestAssets/TestProjects/PerformanceTestProjects/SingleTargetGraph/SingleTargetP1/Program.cs @@ -1,11 +1,12 @@ using System; -namespace ConsoleApplication +namespace ConsoleLibrary.P1 { public class Program { public static void Main() { + ConsoleLibrary.P2.Program.Main(); } } } diff --git a/TestAssets/TestProjects/PerformanceTestProjects/SingleTargetGraph/SingleTargetP1/project.json b/TestAssets/TestProjects/PerformanceTestProjects/SingleTargetGraph/SingleTargetP1/project.json index a6c2ff8b5..0f4fee5ad 100644 --- a/TestAssets/TestProjects/PerformanceTestProjects/SingleTargetGraph/SingleTargetP1/project.json +++ b/TestAssets/TestProjects/PerformanceTestProjects/SingleTargetGraph/SingleTargetP1/project.json @@ -1,8 +1,5 @@ { "version": "1.0.0-*", - "compilationOptions": { - "emitEntryPoint": true - }, "dependencies": { "SingleTargetP2" : { "target": "project" diff --git a/TestAssets/TestProjects/PerformanceTestProjects/SingleTargetGraph/SingleTargetP2/Program.cs b/TestAssets/TestProjects/PerformanceTestProjects/SingleTargetGraph/SingleTargetP2/Program.cs index 9bfc3c72c..0ae001811 100644 --- a/TestAssets/TestProjects/PerformanceTestProjects/SingleTargetGraph/SingleTargetP2/Program.cs +++ b/TestAssets/TestProjects/PerformanceTestProjects/SingleTargetGraph/SingleTargetP2/Program.cs @@ -1,6 +1,6 @@ using System; -namespace ConsoleApplication +namespace ConsoleLibrary.P2 { public class Program { diff --git a/TestAssets/TestProjects/PerformanceTestProjects/SingleTargetGraph/SingleTargetP2/project.json b/TestAssets/TestProjects/PerformanceTestProjects/SingleTargetGraph/SingleTargetP2/project.json index 89cf3a3bf..71ae27297 100644 --- a/TestAssets/TestProjects/PerformanceTestProjects/SingleTargetGraph/SingleTargetP2/project.json +++ b/TestAssets/TestProjects/PerformanceTestProjects/SingleTargetGraph/SingleTargetP2/project.json @@ -1,8 +1,5 @@ { "version": "1.0.0-*", - "compilationOptions": { - "emitEntryPoint": true - }, "dependencies": { "Microsoft.NETCore.App": { "type": "platform", diff --git a/TestAssets/TestProjects/PerformanceTestProjects/TwoTargetGraph/TwoTargetP0/Program.cs b/TestAssets/TestProjects/PerformanceTestProjects/TwoTargetGraph/TwoTargetP0/Program.cs index 9bfc3c72c..ca05ade7a 100644 --- a/TestAssets/TestProjects/PerformanceTestProjects/TwoTargetGraph/TwoTargetP0/Program.cs +++ b/TestAssets/TestProjects/PerformanceTestProjects/TwoTargetGraph/TwoTargetP0/Program.cs @@ -6,6 +6,7 @@ namespace ConsoleApplication { public static void Main() { + ConsoleLibrary.P1.Program.Main(); } } } diff --git a/TestAssets/TestProjects/PerformanceTestProjects/TwoTargetGraph/TwoTargetP1/Program.cs b/TestAssets/TestProjects/PerformanceTestProjects/TwoTargetGraph/TwoTargetP1/Program.cs index 9bfc3c72c..ea50de9e8 100644 --- a/TestAssets/TestProjects/PerformanceTestProjects/TwoTargetGraph/TwoTargetP1/Program.cs +++ b/TestAssets/TestProjects/PerformanceTestProjects/TwoTargetGraph/TwoTargetP1/Program.cs @@ -1,11 +1,12 @@ using System; -namespace ConsoleApplication +namespace ConsoleLibrary.P1 { public class Program { public static void Main() { + ConsoleLibrary.P2.Program.Main(); } } } diff --git a/TestAssets/TestProjects/PerformanceTestProjects/TwoTargetGraph/TwoTargetP1/project.json b/TestAssets/TestProjects/PerformanceTestProjects/TwoTargetGraph/TwoTargetP1/project.json index b9fbb9f8d..3e279184d 100644 --- a/TestAssets/TestProjects/PerformanceTestProjects/TwoTargetGraph/TwoTargetP1/project.json +++ b/TestAssets/TestProjects/PerformanceTestProjects/TwoTargetGraph/TwoTargetP1/project.json @@ -1,8 +1,5 @@ { "version": "1.0.0-*", - "compilationOptions": { - "emitEntryPoint": true - }, "dependencies": { "TwoTargetP2" : { "target": "project" diff --git a/TestAssets/TestProjects/PerformanceTestProjects/TwoTargetGraph/TwoTargetP2/Program.cs b/TestAssets/TestProjects/PerformanceTestProjects/TwoTargetGraph/TwoTargetP2/Program.cs index 9bfc3c72c..0ae001811 100644 --- a/TestAssets/TestProjects/PerformanceTestProjects/TwoTargetGraph/TwoTargetP2/Program.cs +++ b/TestAssets/TestProjects/PerformanceTestProjects/TwoTargetGraph/TwoTargetP2/Program.cs @@ -1,6 +1,6 @@ using System; -namespace ConsoleApplication +namespace ConsoleLibrary.P2 { public class Program { diff --git a/TestAssets/TestProjects/PerformanceTestProjects/TwoTargetGraph/TwoTargetP2/project.json b/TestAssets/TestProjects/PerformanceTestProjects/TwoTargetGraph/TwoTargetP2/project.json index 5ea926028..a1f979cc9 100644 --- a/TestAssets/TestProjects/PerformanceTestProjects/TwoTargetGraph/TwoTargetP2/project.json +++ b/TestAssets/TestProjects/PerformanceTestProjects/TwoTargetGraph/TwoTargetP2/project.json @@ -1,8 +1,5 @@ { "version": "1.0.0-*", - "compilationOptions": { - "emitEntryPoint": true - }, "dependencies": { "Microsoft.NETCore.App": { "type": "platform", diff --git a/TestAssets/TestProjects/PerformanceTestProjects/TwoTargetGraphLarge/TwoTargetLargeP0/Program.cs b/TestAssets/TestProjects/PerformanceTestProjects/TwoTargetGraphLarge/TwoTargetLargeP0/Program.cs index 9bfc3c72c..ca05ade7a 100644 --- a/TestAssets/TestProjects/PerformanceTestProjects/TwoTargetGraphLarge/TwoTargetLargeP0/Program.cs +++ b/TestAssets/TestProjects/PerformanceTestProjects/TwoTargetGraphLarge/TwoTargetLargeP0/Program.cs @@ -6,6 +6,7 @@ namespace ConsoleApplication { public static void Main() { + ConsoleLibrary.P1.Program.Main(); } } } diff --git a/TestAssets/TestProjects/PerformanceTestProjects/TwoTargetGraphLarge/TwoTargetLargeP1/Program.cs b/TestAssets/TestProjects/PerformanceTestProjects/TwoTargetGraphLarge/TwoTargetLargeP1/Program.cs index 9bfc3c72c..7b1284ad8 100644 --- a/TestAssets/TestProjects/PerformanceTestProjects/TwoTargetGraphLarge/TwoTargetLargeP1/Program.cs +++ b/TestAssets/TestProjects/PerformanceTestProjects/TwoTargetGraphLarge/TwoTargetLargeP1/Program.cs @@ -1,11 +1,13 @@ using System; -namespace ConsoleApplication +namespace ConsoleLibrary.P1 { public class Program { public static void Main() { + ConsoleLibrary.P2.Program.Main(); + ConsoleLibrary.P4.Program.Main(); } } } diff --git a/TestAssets/TestProjects/PerformanceTestProjects/TwoTargetGraphLarge/TwoTargetLargeP1/project.json b/TestAssets/TestProjects/PerformanceTestProjects/TwoTargetGraphLarge/TwoTargetLargeP1/project.json index 2e36f00eb..5b080a6f1 100644 --- a/TestAssets/TestProjects/PerformanceTestProjects/TwoTargetGraphLarge/TwoTargetLargeP1/project.json +++ b/TestAssets/TestProjects/PerformanceTestProjects/TwoTargetGraphLarge/TwoTargetLargeP1/project.json @@ -1,8 +1,5 @@ { "version": "1.0.0-*", - "compilationOptions": { - "emitEntryPoint": true - }, "dependencies": { "TwoTargetLargeP2" : { "target": "project" diff --git a/TestAssets/TestProjects/PerformanceTestProjects/TwoTargetGraphLarge/TwoTargetLargeP2/Program.cs b/TestAssets/TestProjects/PerformanceTestProjects/TwoTargetGraphLarge/TwoTargetLargeP2/Program.cs index 9bfc3c72c..121dbbfb7 100644 --- a/TestAssets/TestProjects/PerformanceTestProjects/TwoTargetGraphLarge/TwoTargetLargeP2/Program.cs +++ b/TestAssets/TestProjects/PerformanceTestProjects/TwoTargetGraphLarge/TwoTargetLargeP2/Program.cs @@ -1,11 +1,13 @@ using System; -namespace ConsoleApplication +namespace ConsoleLibrary.P2 { public class Program { public static void Main() { + ConsoleLibrary.P3.Program.Main(); + ConsoleLibrary.P4.Program.Main(); } } } diff --git a/TestAssets/TestProjects/PerformanceTestProjects/TwoTargetGraphLarge/TwoTargetLargeP2/project.json b/TestAssets/TestProjects/PerformanceTestProjects/TwoTargetGraphLarge/TwoTargetLargeP2/project.json index a6fdc9d7d..8b7d44b36 100644 --- a/TestAssets/TestProjects/PerformanceTestProjects/TwoTargetGraphLarge/TwoTargetLargeP2/project.json +++ b/TestAssets/TestProjects/PerformanceTestProjects/TwoTargetGraphLarge/TwoTargetLargeP2/project.json @@ -1,8 +1,5 @@ { "version": "1.0.0-*", - "compilationOptions": { - "emitEntryPoint": true - }, "dependencies": { "TwoTargetLargeP3" : { "target": "project" diff --git a/TestAssets/TestProjects/PerformanceTestProjects/TwoTargetGraphLarge/TwoTargetLargeP3/Program.cs b/TestAssets/TestProjects/PerformanceTestProjects/TwoTargetGraphLarge/TwoTargetLargeP3/Program.cs index 9bfc3c72c..2e779be39 100644 --- a/TestAssets/TestProjects/PerformanceTestProjects/TwoTargetGraphLarge/TwoTargetLargeP3/Program.cs +++ b/TestAssets/TestProjects/PerformanceTestProjects/TwoTargetGraphLarge/TwoTargetLargeP3/Program.cs @@ -1,11 +1,12 @@ using System; -namespace ConsoleApplication +namespace ConsoleLibrary.P3 { public class Program { public static void Main() { + ConsoleLibrary.P4.Program.Main(); } } } diff --git a/TestAssets/TestProjects/PerformanceTestProjects/TwoTargetGraphLarge/TwoTargetLargeP3/project.json b/TestAssets/TestProjects/PerformanceTestProjects/TwoTargetGraphLarge/TwoTargetLargeP3/project.json index 821a50a5f..e75856ac1 100644 --- a/TestAssets/TestProjects/PerformanceTestProjects/TwoTargetGraphLarge/TwoTargetLargeP3/project.json +++ b/TestAssets/TestProjects/PerformanceTestProjects/TwoTargetGraphLarge/TwoTargetLargeP3/project.json @@ -1,8 +1,5 @@ { "version": "1.0.0-*", - "compilationOptions": { - "emitEntryPoint": true - }, "dependencies": { "TwoTargetLargeP4" : { "target": "project" diff --git a/TestAssets/TestProjects/PerformanceTestProjects/TwoTargetGraphLarge/TwoTargetLargeP4/Program.cs b/TestAssets/TestProjects/PerformanceTestProjects/TwoTargetGraphLarge/TwoTargetLargeP4/Program.cs index 9bfc3c72c..71a2f4d72 100644 --- a/TestAssets/TestProjects/PerformanceTestProjects/TwoTargetGraphLarge/TwoTargetLargeP4/Program.cs +++ b/TestAssets/TestProjects/PerformanceTestProjects/TwoTargetGraphLarge/TwoTargetLargeP4/Program.cs @@ -1,11 +1,13 @@ using System; -namespace ConsoleApplication +namespace ConsoleLibrary.P4 { public class Program { public static void Main() { + ConsoleLibrary.P5.Program.Main(); + ConsoleLibrary.P6.Program.Main(); } } } diff --git a/TestAssets/TestProjects/PerformanceTestProjects/TwoTargetGraphLarge/TwoTargetLargeP4/project.json b/TestAssets/TestProjects/PerformanceTestProjects/TwoTargetGraphLarge/TwoTargetLargeP4/project.json index e0d6ab60c..ea7cad01d 100644 --- a/TestAssets/TestProjects/PerformanceTestProjects/TwoTargetGraphLarge/TwoTargetLargeP4/project.json +++ b/TestAssets/TestProjects/PerformanceTestProjects/TwoTargetGraphLarge/TwoTargetLargeP4/project.json @@ -1,8 +1,5 @@ { "version": "1.0.0-*", - "compilationOptions": { - "emitEntryPoint": true - }, "dependencies": { "TwoTargetLargeP5" : { "target": "project" diff --git a/TestAssets/TestProjects/PerformanceTestProjects/TwoTargetGraphLarge/TwoTargetLargeP5/Program.cs b/TestAssets/TestProjects/PerformanceTestProjects/TwoTargetGraphLarge/TwoTargetLargeP5/Program.cs index 9bfc3c72c..9fc92636d 100644 --- a/TestAssets/TestProjects/PerformanceTestProjects/TwoTargetGraphLarge/TwoTargetLargeP5/Program.cs +++ b/TestAssets/TestProjects/PerformanceTestProjects/TwoTargetGraphLarge/TwoTargetLargeP5/Program.cs @@ -1,6 +1,6 @@ using System; -namespace ConsoleApplication +namespace ConsoleLibrary.P5 { public class Program { diff --git a/TestAssets/TestProjects/PerformanceTestProjects/TwoTargetGraphLarge/TwoTargetLargeP5/project.json b/TestAssets/TestProjects/PerformanceTestProjects/TwoTargetGraphLarge/TwoTargetLargeP5/project.json index 5ea926028..a1f979cc9 100644 --- a/TestAssets/TestProjects/PerformanceTestProjects/TwoTargetGraphLarge/TwoTargetLargeP5/project.json +++ b/TestAssets/TestProjects/PerformanceTestProjects/TwoTargetGraphLarge/TwoTargetLargeP5/project.json @@ -1,8 +1,5 @@ { "version": "1.0.0-*", - "compilationOptions": { - "emitEntryPoint": true - }, "dependencies": { "Microsoft.NETCore.App": { "type": "platform", diff --git a/TestAssets/TestProjects/PerformanceTestProjects/TwoTargetGraphLarge/TwoTargetLargeP6/Program.cs b/TestAssets/TestProjects/PerformanceTestProjects/TwoTargetGraphLarge/TwoTargetLargeP6/Program.cs index 9bfc3c72c..ae467ffd4 100644 --- a/TestAssets/TestProjects/PerformanceTestProjects/TwoTargetGraphLarge/TwoTargetLargeP6/Program.cs +++ b/TestAssets/TestProjects/PerformanceTestProjects/TwoTargetGraphLarge/TwoTargetLargeP6/Program.cs @@ -1,6 +1,6 @@ using System; -namespace ConsoleApplication +namespace ConsoleLibrary.P6 { public class Program { diff --git a/TestAssets/TestProjects/PerformanceTestProjects/TwoTargetGraphLarge/TwoTargetLargeP6/project.json b/TestAssets/TestProjects/PerformanceTestProjects/TwoTargetGraphLarge/TwoTargetLargeP6/project.json index 5ea926028..a1f979cc9 100644 --- a/TestAssets/TestProjects/PerformanceTestProjects/TwoTargetGraphLarge/TwoTargetLargeP6/project.json +++ b/TestAssets/TestProjects/PerformanceTestProjects/TwoTargetGraphLarge/TwoTargetLargeP6/project.json @@ -1,8 +1,5 @@ { "version": "1.0.0-*", - "compilationOptions": { - "emitEntryPoint": true - }, "dependencies": { "Microsoft.NETCore.App": { "type": "platform", diff --git a/scripts/dotnet-cli-build/TestTargets.cs b/scripts/dotnet-cli-build/TestTargets.cs index a8e4eb6e0..f1b39d736 100644 --- a/scripts/dotnet-cli-build/TestTargets.cs +++ b/scripts/dotnet-cli-build/TestTargets.cs @@ -36,7 +36,8 @@ namespace Microsoft.DotNet.Cli.Build "Microsoft.DotNet.Cli.Utils.Tests", "Microsoft.DotNet.Compiler.Common.Tests", "Microsoft.DotNet.ProjectModel.Tests", - "Microsoft.Extensions.DependencyModel.Tests" + "Microsoft.Extensions.DependencyModel.Tests", + "Performance" }; public static readonly string[] WindowsTestProjects = new[] diff --git a/src/dotnet/commands/dotnet-compile/ManagedCompiler.cs b/src/dotnet/commands/dotnet-compile/ManagedCompiler.cs index f32266e18..70a2d4f9d 100644 --- a/src/dotnet/commands/dotnet-compile/ManagedCompiler.cs +++ b/src/dotnet/commands/dotnet-compile/ManagedCompiler.cs @@ -8,7 +8,6 @@ using System.IO; using System.Linq; using System.Runtime.InteropServices; using System.Text; -using System.Threading; using Microsoft.DotNet.Cli; using Microsoft.DotNet.Cli.Compiler.Common; using Microsoft.DotNet.Cli.Utils; diff --git a/test/dotnet-performance.Tests/BuildPerformanceTest.cs b/test/Performance/BuildPerformanceTest.cs similarity index 66% rename from test/dotnet-performance.Tests/BuildPerformanceTest.cs rename to test/Performance/BuildPerformanceTest.cs index c8b140d48..6b7e28a6b 100644 --- a/test/dotnet-performance.Tests/BuildPerformanceTest.cs +++ b/test/Performance/BuildPerformanceTest.cs @@ -5,10 +5,14 @@ using System.Linq; using Microsoft.DotNet.Tools.Test.Utilities; using Microsoft.Xunit.Performance; using Microsoft.DotNet.TestFramework; +using System.IO; +using System.Runtime.CompilerServices; +using System; +using System.Collections.Generic; namespace Microsoft.DotNet.Tools.Builder.Tests { - public class BuildPerformanceTest : PerformanceTestBase + public class BuildPerformanceTest : TestBase { private static string SingleTargetApp = "SingleTargetApp"; private static string TwoTargetApp = "TwoTargetApp"; @@ -47,11 +51,12 @@ namespace Microsoft.DotNet.Tools.Builder.Tests { foreach (var iteration in Benchmark.Iterations) { + var buildCommand = new BuildCommand(instance.TestRoot, buildProfile: false); using (iteration.StartMeasurement()) { - Build(instance.TestRoot); + buildCommand.Execute().Should().Pass(); } - RemoveBin(instance.TestRoot); + TouchSource(instance.TestRoot); } } @@ -62,13 +67,15 @@ namespace Microsoft.DotNet.Tools.Builder.Tests public void IncrementalSkipSingleProject(TestInstance instance) { - Build(instance.TestRoot); + new BuildCommand(instance.TestRoot, buildProfile: false) + .Execute().Should().Pass(); foreach (var iteration in Benchmark.Iterations) { + var buildCommand = new BuildCommand(instance.TestRoot, buildProfile: false); using (iteration.StartMeasurement()) { - Build(instance.TestRoot); + buildCommand.Execute().Should().Pass(); } } } @@ -86,13 +93,14 @@ namespace Microsoft.DotNet.Tools.Builder.Tests foreach (var iteration in Benchmark.Iterations) { + var buildCommand = new BuildCommand(instance.TestRoot, buildProfile: false); using (iteration.StartMeasurement()) { - Build(instance.TestRoot); + buildCommand.Execute().Should().Pass(); } foreach (var i in instances) { - RemoveBin(i.TestRoot); + TouchSource(i.TestRoot); } } } @@ -112,14 +120,15 @@ namespace Microsoft.DotNet.Tools.Builder.Tests public void IncrementalSkipAllInGraph(TestInstance[] instances) { var instance = instances[0]; - - Build(instance.TestRoot); + new BuildCommand(instance.TestRoot, buildProfile: false) + .Execute().Should().Pass(); foreach (var iteration in Benchmark.Iterations) { + var buildCommand = new BuildCommand(instance.TestRoot, buildProfile: false); using (iteration.StartMeasurement()) { - Build(instance.TestRoot); + buildCommand.Execute().Should().Pass(); } } } @@ -139,16 +148,17 @@ namespace Microsoft.DotNet.Tools.Builder.Tests public void IncrementalRebuildWithRootChangedInGraph(TestInstance[] instances) { var instance = instances[0]; - - Build(instance.TestRoot); + new BuildCommand(instance.TestRoot, buildProfile: false) + .Execute().Should().Pass(); foreach (var iteration in Benchmark.Iterations) { + var buildCommand = new BuildCommand(instance.TestRoot, buildProfile: false); using (iteration.StartMeasurement()) { - Build(instance.TestRoot); + buildCommand.Execute().Should().Pass(); } - RemoveBin(instance.TestRoot); + TouchSource(instance.TestRoot); } } @@ -167,16 +177,17 @@ namespace Microsoft.DotNet.Tools.Builder.Tests public void IncrementalRebuildWithLastChangedInGraph(TestInstance[] instances) { var instance = instances[0]; - - Build(instance.TestRoot); + new BuildCommand(instance.TestRoot, buildProfile: false) + .Execute().Should().Pass(); foreach (var iteration in Benchmark.Iterations) { + var buildCommand = new BuildCommand(instance.TestRoot, buildProfile: false); using (iteration.StartMeasurement()) { - Build(instance.TestRoot); + buildCommand.Execute().Should().Pass(); } - RemoveBin(instances.Last().TestRoot); + TouchSource(instances.Last().TestRoot); } } @@ -196,25 +207,30 @@ namespace Microsoft.DotNet.Tools.Builder.Tests public void IncrementalSkipAllNoDependenciesInGraph(TestInstance[] instances) { var instance = instances[0]; - - Build(instance.TestRoot); + new BuildCommand(instance.TestRoot, buildProfile: false) + .Execute().Should().Pass(); foreach (var iteration in Benchmark.Iterations) { + var commands = new List(); + foreach (var i in instances.Reverse()) + { + commands.Add(new BuildCommand(i.TestRoot, + framework: DefaultFramework, + noDependencies: true, + buildProfile: false)); + } using (iteration.StartMeasurement()) { - foreach (var i in instances) + foreach (var buildCommand in commands) { - Run(new BuildCommand(i.TestRoot, - framework: DefaultFramework, - noDependencies: true, - buildProfile: false)); + buildCommand.Execute().Should().Pass(); } } } } [Benchmark] - public void BuildAllNoDependenciesInGraphh_SingleTargetGraph() => + public void BuildAllNoDependenciesInGraph_SingleTargetGraph() => BuildAllNoDependenciesInGraph(CreateTestInstances(SingleTargetGraph)); [Benchmark] @@ -229,21 +245,50 @@ namespace Microsoft.DotNet.Tools.Builder.Tests { foreach (var iteration in Benchmark.Iterations) { + var commands = new List(); + foreach (var i in instances.Reverse()) + { + commands.Add(new BuildCommand(i.TestRoot, + framework: DefaultFramework, + noDependencies: true, + buildProfile: false)); + } using (iteration.StartMeasurement()) { - foreach (var i in instances.Reverse()) + foreach (var buildCommand in commands) { - Run(new BuildCommand(i.TestRoot, - framework: DefaultFramework, - noDependencies: true, - buildProfile: false)); + buildCommand.Execute().Should().Pass(); } } foreach (var instance in instances) { - RemoveBin(instance.TestRoot); + TouchSource(instance.TestRoot); } } } + + protected void TouchSource(string project) + { + var sourceFile = Directory.GetFiles(project, "*.cs").FirstOrDefault(); + if (sourceFile == null) + { + throw new InvalidOperationException($"'.cs' files not found in {project}"); + } + File.SetLastWriteTime(sourceFile, DateTime.Now); + } + + protected TestInstance[] CreateTestInstances(string[] testProjectNames, [CallerMemberName] string callingMethod = "") + { + return testProjectNames.Select(testProjectName => + { + return CreateTestInstance(testProjectName, callingMethod); + }).ToArray(); + } + + protected TestInstance CreateTestInstance(string testProjectName, [CallerMemberName] string callingMethod = "") + { + return TestAssetsManager.CreateTestInstance(Path.Combine("PerformanceTestProjects", testProjectName), callingMethod) + .WithLockFiles(); + } } } diff --git a/test/dotnet-performance.Tests/PerformanceTestBase.cs b/test/dotnet-performance.Tests/PerformanceTestBase.cs deleted file mode 100644 index 8ae23e8d7..000000000 --- a/test/dotnet-performance.Tests/PerformanceTestBase.cs +++ /dev/null @@ -1,40 +0,0 @@ -using System.IO; -using System.Linq; -using System.Runtime.CompilerServices; -using Microsoft.DotNet.Tools.Test.Utilities; -using Microsoft.DotNet.TestFramework; - -namespace Microsoft.DotNet.Tools.Builder.Tests -{ - public class PerformanceTestBase : TestBase - { - protected void Build(string project) - { - Run(new BuildCommand(project, buildProfile: false)); - } - - protected void Run(TestCommand command) - { - command.Execute().Should().Pass(); - } - - protected void RemoveBin(string project) - { - Directory.Delete(Path.Combine(project, "bin"), true); - } - - protected TestInstance[] CreateTestInstances(string[] testProjectNames, [CallerMemberName] string callingMethod = "") - { - return testProjectNames.Select(testProjectName => - { - return CreateTestInstance(testProjectName, callingMethod); - }).ToArray(); - } - - protected TestInstance CreateTestInstance(string testProjectName, [CallerMemberName] string callingMethod = "") - { - return TestAssetsManager.CreateTestInstance(Path.Combine("PerformanceTestProjects", testProjectName), callingMethod) - .WithLockFiles(); - } - } -} \ No newline at end of file diff --git a/test/dotnet-performance.Tests/dotnet-performance.Tests.xproj b/test/dotnet-performance.Tests/dotnet-performance.Tests.xproj deleted file mode 100644 index 4a6c22bc9..000000000 --- a/test/dotnet-performance.Tests/dotnet-performance.Tests.xproj +++ /dev/null @@ -1,19 +0,0 @@ - - - - 14.0.25123 - $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) - - - - 0ae3d045-c119-4ed7-bd0c-287029b7264a - dotnet-performance.Tests - ..\..\artifacts\obj\$(MSBuildProjectName) - ..\..\artifacts\ - - - - 2.0 - - - \ No newline at end of file diff --git a/test/dotnet-performance.Tests/project.json b/test/dotnet-performance.Tests/project.json deleted file mode 100644 index 87c1e90ae..000000000 --- a/test/dotnet-performance.Tests/project.json +++ /dev/null @@ -1,30 +0,0 @@ -{ - "version": "1.0.0-*", - "dependencies": { - "Microsoft.NETCore.App": "1.0.0-rc2-*", - "System.Runtime.Serialization.Primitives": "4.1.1-rc2-24022", - "Microsoft.DotNet.Tools.Tests.Utilities": { - "target": "project" - }, - "Microsoft.DotNet.Cli.Utils": { - "target": "project" - }, - "Newtonsoft.Json": "7.0.1", - "xunit": "2.1.0", - "dotnet-test-xunit": "1.0.0-dev-140469-38", - "Microsoft.DotNet.xunit.performance": "1.0.0-alpha-build0028" - }, - "frameworks": { - "netcoreapp1.0": { - "imports": [ - "dotnet5.4", - "portable-net451+win8" - ] - } - }, - "testRunner": "xunit", - "runtimes": - { - "win7-x64": {} - } -}