From c35884e967f623218516f618c3e30a53947be947 Mon Sep 17 00:00:00 2001 From: Tobias Ibounig Date: Thu, 27 Jun 2013 21:41:01 +0200 Subject: [PATCH] - Removed GetUnitTestingNames - Removed ProfilerTestRunner.cs, made obsolete trough ProfilerProcessRunner.cs - added missing X64Converter/app.config --- SharpDevelop.sln | 24 +-- .../src/MSpecTestClass.cs | 5 - .../src/MSpecTestMember.cs | 5 - .../src/MSpecTestProject.cs | 5 - .../Frontend/AddIn/Profiler.AddIn.csproj | 1 - .../Commands/RunTestWithProfilerCommand.cs | 2 +- .../Frontend/AddIn/Src/ProfilerTestRunner.cs | 164 ------------------ .../Analysis/Profiler/X64Converter/app.config | 6 + .../Analysis/UnitTesting/Model/ITest.cs | 5 - .../Analysis/UnitTesting/Model/TestBase.cs | 2 - .../UnitTesting/Model/TestNamespace.cs | 8 - .../UnitTesting/Model/TestSolution.cs | 9 - .../UnitTesting/NUnit/NUnitTestClass.cs | 8 - .../UnitTesting/NUnit/NUnitTestMethod.cs | 9 - .../UnitTesting/NUnit/NUnitTestProject.cs | 8 - 15 files changed, 19 insertions(+), 242 deletions(-) delete mode 100644 src/AddIns/Analysis/Profiler/Frontend/AddIn/Src/ProfilerTestRunner.cs create mode 100644 src/AddIns/Analysis/Profiler/X64Converter/app.config diff --git a/SharpDevelop.sln b/SharpDevelop.sln index e62f738de6..2f2309491b 100644 --- a/SharpDevelop.sln +++ b/SharpDevelop.sln @@ -471,18 +471,6 @@ Global {D1DF9C2D-3A5E-4985-ACA4-648C604DB562}.Debug|Any CPU.Build.0 = Debug|Any CPU {D1DF9C2D-3A5E-4985-ACA4-648C604DB562}.Release|Any CPU.ActiveCfg = Release|Any CPU {D1DF9C2D-3A5E-4985-ACA4-648C604DB562}.Release|Any CPU.Build.0 = Release|Any CPU - {1D18D788-F7EE-4585-A23B-34DC8EC63CB8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {1D18D788-F7EE-4585-A23B-34DC8EC63CB8}.Debug|Any CPU.Build.0 = Debug|Any CPU - {1D18D788-F7EE-4585-A23B-34DC8EC63CB8}.Release|Any CPU.ActiveCfg = Release|Any CPU - {1D18D788-F7EE-4585-A23B-34DC8EC63CB8}.Release|Any CPU.Build.0 = Release|Any CPU - {EC06F96A-AEEC-49D6-B03D-AB87C6EB674C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {EC06F96A-AEEC-49D6-B03D-AB87C6EB674C}.Debug|Any CPU.Build.0 = Debug|Any CPU - {EC06F96A-AEEC-49D6-B03D-AB87C6EB674C}.Release|Any CPU.ActiveCfg = Release|Any CPU - {EC06F96A-AEEC-49D6-B03D-AB87C6EB674C}.Release|Any CPU.Build.0 = Release|Any CPU - {3DF4060F-5EE0-41CF-8096-F27355FD5511}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {3DF4060F-5EE0-41CF-8096-F27355FD5511}.Debug|Any CPU.Build.0 = Debug|Any CPU - {3DF4060F-5EE0-41CF-8096-F27355FD5511}.Release|Any CPU.ActiveCfg = Release|Any CPU - {3DF4060F-5EE0-41CF-8096-F27355FD5511}.Release|Any CPU.Build.0 = Release|Any CPU {D788789A-4D43-42B9-B0F7-CB2CA761372B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {D788789A-4D43-42B9-B0F7-CB2CA761372B}.Debug|Any CPU.Build.0 = Debug|Any CPU {D788789A-4D43-42B9-B0F7-CB2CA761372B}.Release|Any CPU.ActiveCfg = Release|Any CPU @@ -499,6 +487,18 @@ Global {B063078F-17D2-4B0C-A01C-DBF440F1C24D}.Debug|Any CPU.Build.0 = Debug|Any CPU {B063078F-17D2-4B0C-A01C-DBF440F1C24D}.Release|Any CPU.ActiveCfg = Release|Any CPU {B063078F-17D2-4B0C-A01C-DBF440F1C24D}.Release|Any CPU.Build.0 = Release|Any CPU + {1D18D788-F7EE-4585-A23B-34DC8EC63CB8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {1D18D788-F7EE-4585-A23B-34DC8EC63CB8}.Debug|Any CPU.Build.0 = Debug|Any CPU + {1D18D788-F7EE-4585-A23B-34DC8EC63CB8}.Release|Any CPU.ActiveCfg = Release|Any CPU + {1D18D788-F7EE-4585-A23B-34DC8EC63CB8}.Release|Any CPU.Build.0 = Release|Any CPU + {EC06F96A-AEEC-49D6-B03D-AB87C6EB674C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {EC06F96A-AEEC-49D6-B03D-AB87C6EB674C}.Debug|Any CPU.Build.0 = Debug|Any CPU + {EC06F96A-AEEC-49D6-B03D-AB87C6EB674C}.Release|Any CPU.ActiveCfg = Release|Any CPU + {EC06F96A-AEEC-49D6-B03D-AB87C6EB674C}.Release|Any CPU.Build.0 = Release|Any CPU + {3DF4060F-5EE0-41CF-8096-F27355FD5511}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {3DF4060F-5EE0-41CF-8096-F27355FD5511}.Debug|Any CPU.Build.0 = Debug|Any CPU + {3DF4060F-5EE0-41CF-8096-F27355FD5511}.Release|Any CPU.ActiveCfg = Release|Any CPU + {3DF4060F-5EE0-41CF-8096-F27355FD5511}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/src/AddIns/Analysis/MachineSpecifications/MachineSpecifications/src/MSpecTestClass.cs b/src/AddIns/Analysis/MachineSpecifications/MachineSpecifications/src/MSpecTestClass.cs index e6343020ff..0d7fa166fc 100644 --- a/src/AddIns/Analysis/MachineSpecifications/MachineSpecifications/src/MSpecTestClass.cs +++ b/src/AddIns/Analysis/MachineSpecifications/MachineSpecifications/src/MSpecTestClass.cs @@ -95,10 +95,5 @@ namespace ICSharpCode.MachineSpecifications IType type = compilation.MainAssembly.GetTypeDefinition(fullTypeName); return type.GetDefinition(); } - - public override IEnumerable GetUnitTestNames() - { - return NestedTestCollection.SelectMany(t => t.GetUnitTestNames()); - } } } diff --git a/src/AddIns/Analysis/MachineSpecifications/MachineSpecifications/src/MSpecTestMember.cs b/src/AddIns/Analysis/MachineSpecifications/MachineSpecifications/src/MSpecTestMember.cs index b8996c7a25..ab2a6b8ba2 100644 --- a/src/AddIns/Analysis/MachineSpecifications/MachineSpecifications/src/MSpecTestMember.cs +++ b/src/AddIns/Analysis/MachineSpecifications/MachineSpecifications/src/MSpecTestMember.cs @@ -68,10 +68,5 @@ namespace ICSharpCode.MachineSpecifications { return member.DeclaringTypeDefinition.FullName; } - - public override System.Collections.Generic.IEnumerable GetUnitTestNames() - { - yield return member.ReflectionName; - } } } diff --git a/src/AddIns/Analysis/MachineSpecifications/MachineSpecifications/src/MSpecTestProject.cs b/src/AddIns/Analysis/MachineSpecifications/MachineSpecifications/src/MSpecTestProject.cs index 2e6f9e91a3..a603f823c2 100644 --- a/src/AddIns/Analysis/MachineSpecifications/MachineSpecifications/src/MSpecTestProject.cs +++ b/src/AddIns/Analysis/MachineSpecifications/MachineSpecifications/src/MSpecTestProject.cs @@ -135,10 +135,5 @@ namespace ICSharpCode.MachineSpecifications return typeDefinition.Attributes.Any( attribute => MSpecBehaviorsAttributeFQName.Equals(attribute.AttributeType.FullName)); } - - public override IEnumerable GetUnitTestNames() - { - return NestedTestCollection.SelectMany(c => c.GetUnitTestNames()); - } } } diff --git a/src/AddIns/Analysis/Profiler/Frontend/AddIn/Profiler.AddIn.csproj b/src/AddIns/Analysis/Profiler/Frontend/AddIn/Profiler.AddIn.csproj index 11c739a60a..9725d27709 100644 --- a/src/AddIns/Analysis/Profiler/Frontend/AddIn/Profiler.AddIn.csproj +++ b/src/AddIns/Analysis/Profiler/Frontend/AddIn/Profiler.AddIn.csproj @@ -92,7 +92,6 @@ - ComparisonView.xaml diff --git a/src/AddIns/Analysis/Profiler/Frontend/AddIn/Src/Commands/RunTestWithProfilerCommand.cs b/src/AddIns/Analysis/Profiler/Frontend/AddIn/Src/Commands/RunTestWithProfilerCommand.cs index 2a49e11159..f41a540ef6 100644 --- a/src/AddIns/Analysis/Profiler/Frontend/AddIn/Src/Commands/RunTestWithProfilerCommand.cs +++ b/src/AddIns/Analysis/Profiler/Frontend/AddIn/Src/Commands/RunTestWithProfilerCommand.cs @@ -20,7 +20,7 @@ namespace ICSharpCode.Profiler.AddIn.Commands ITestService testService = SD.GetRequiredService(); IEnumerable tests = TestableCondition.GetTests(testService.OpenSolution, Owner); string path = tests.FirstOrDefault().ParentProject.Project.GetSessionFileName(); - testService.RunTestsAsync(tests, new TestExecutionOptions { ProcessRunner = new ProfilerProcessRunner(new UnitTestWriter(new ProfilingDataSQLiteWriter(path), tests.SelectMany(t => t.GetUnitTestNames()).ToArray()), new ProfilerOptions()) }).FireAndForget(); + testService.RunTestsAsync(tests, new TestExecutionOptions { ProcessRunner = new ProfilerProcessRunner(new ProfilingDataSQLiteWriter(path), new ProfilerOptions()) }).FireAndForget(); } } } diff --git a/src/AddIns/Analysis/Profiler/Frontend/AddIn/Src/ProfilerTestRunner.cs b/src/AddIns/Analysis/Profiler/Frontend/AddIn/Src/ProfilerTestRunner.cs deleted file mode 100644 index 9062e35d03..0000000000 --- a/src/AddIns/Analysis/Profiler/Frontend/AddIn/Src/ProfilerTestRunner.cs +++ /dev/null @@ -1,164 +0,0 @@ -// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt) -// This code is distributed under the GNU LGPL (for details please see \doc\license.txt) - -using System; -using System.Collections.Generic; -using System.Diagnostics; -using System.Linq; -using ICSharpCode.Core; -using ICSharpCode.NRefactory.TypeSystem; -using ICSharpCode.Profiler.AddIn; -using ICSharpCode.Profiler.Controller.Data; -using ICSharpCode.SharpDevelop; -using ICSharpCode.SharpDevelop.Parser; -using ICSharpCode.SharpDevelop.Dom; -using ICSharpCode.SharpDevelop.Gui; -using ICSharpCode.SharpDevelop.Project; -using ICSharpCode.UnitTesting; - -namespace ICSharpCode.Profiler.AddIn -{ - public class ProfilerTestRunner : TestRunnerBase - { - ProfilerRunner runner; - //UnitTestingOptions options = new UnitTestingOptions(); - TestResultsReader testResultsReader; - - public ProfilerTestRunner() - { - } - - public override void Start(IEnumerable selectedTests) - { - ProcessStartInfo startInfo = GetProcessStartInfo(selectedTests); - Start(startInfo, selectedTests); - } - - protected override ProcessStartInfo GetProcessStartInfo(IEnumerable selectedTests) - { - NUnitConsoleApplication app = new NUnitConsoleApplication(selectedTests, UnitTestingOptions.Instance); - testResultsReader = new TestResultsReader(); - app.ResultsPipe = testResultsReader.PipeName; - return app.GetProcessStartInfo(); - } - - void Start(ProcessStartInfo startInfo, IEnumerable selectedTests) - { - LogCommandLine(startInfo); - - string path = selectedTests.FirstOrDefault().ParentProject.Project.GetSessionFileName(); - - LoggingService.Info("starting profiler..."); - - runner = new ProfilerRunner(startInfo, true, new UnitTestWriter(new ProfilingDataSQLiteWriter(path), GetUnitTestNames(selectedTests).ToArray())); - - runner.RunFinished += delegate { - SD.MainThread.InvokeIfRequired(() => FileService.OpenFile(path)); - AfterFinish(selectedTests, path); - }; - - testResultsReader.TestFinished += OnTestFinished; - testResultsReader.Start(); - runner.Run(); - } - - IEnumerable GetUnitTestNames(IEnumerable selectedTests) - { - foreach (var project in selectedTests.Select(l => l.ParentProject)) { - foreach (var name in project.GetUnitTestNames()) { - yield return name; - } - } - /* - foreach (ITest test in selectedTests) { - IProject project = test.ParentProject.Project; - ICompilation compilation = SD.ParserService.GetCompilation(project); - compilation.FindType - } - IProjectContent content = selectedTests.FirstOrDefault().ParentProject.Project.ProjectContent; - IEnumerable selectedNunitTests = (IEnumerable) selectedTests; - if (selectedNunitTests.FirstOrDefault() == null) { - var testClasses = content.Classes - .Where(c => c.Attributes.Any(a => a.AttributeType.FullyQualifiedName == "NUnit.Framework.TestFixtureAttribute")); - return testClasses - .SelectMany(c2 => c2.Methods) - .Where(m => m.Attributes.Any(a2 => a2.AttributeType.FullyQualifiedName == "NUnit.Framework.TestAttribute")) - .Select(m2 => m2.FullyQualifiedName); - } - if (selectedTests.Member == null) { - return content.Classes.First(c => c.FullyQualifiedName == selectedNunitTests.FirstOrDefault().ClassName).Methods - .Where(m => m.Attributes.Any(a2 => a2.AttributeType.FullyQualifiedName == "NUnit.Framework.TestAttribute")) - .Select(m2 => m2.FullyQualifiedName); - } - return new[] { selectedTests.Class.DotNetName + "." + selectedTests.Member.Name };*/ - } - - void AfterFinish(IEnumerable selectedTests, string path) - { - selectedTests.FirstOrDefault().ParentProject.Project.AddSessionToProject(path); - OnAllTestsFinished(); - LoggingService.Info("shutting profiler down..."); - } - - /*public override void Stop() - { - if (this.runner != null && this.runner.Profiler.IsRunning) { - LoggingService.Info("stopping profiler..."); - runner.Stop(); - } - - if (testResultsReader != null) { - testResultsReader.Dispose(); - //testResultsReader.Stop(); - //testResultsReader.Read(); - testResultsReader = null; - } - } - - public override void Dispose() - { - Stop(); - }*/ - - protected override void OnAllTestsFinished() - { - testResultsReader.Join(); - base.OnAllTestsFinished(); - } - - public override void Stop() - { - if (this.runner != null && this.runner.Profiler.IsRunning) { - LoggingService.Info("stopping profiler..."); - runner.Stop(); - } - if (testResultsReader != null) { - testResultsReader.Dispose(); - testResultsReader = null; - } - } - - public override void Dispose() - { - testResultsReader.Dispose(); - testResultsReader.TestFinished -= OnTestFinished; - } - - public override int GetExpectedNumberOfTestResults(IEnumerable selectedTests) - { - return GetNumberOfTestMethods(selectedTests); - } - - public static int GetNumberOfTestMethods(IEnumerable selectedTests) - { - int count = 0; - foreach (ITest test in selectedTests) { - if (test is NUnitTestMethod) - count++; - else - count += GetNumberOfTestMethods(test.NestedTests); - } - return count; - } - } -} diff --git a/src/AddIns/Analysis/Profiler/X64Converter/app.config b/src/AddIns/Analysis/Profiler/X64Converter/app.config new file mode 100644 index 0000000000..9008dd2558 --- /dev/null +++ b/src/AddIns/Analysis/Profiler/X64Converter/app.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/src/AddIns/Analysis/UnitTesting/Model/ITest.cs b/src/AddIns/Analysis/UnitTesting/Model/ITest.cs index 22a04cc0af..42e3cd66b7 100644 --- a/src/AddIns/Analysis/UnitTesting/Model/ITest.cs +++ b/src/AddIns/Analysis/UnitTesting/Model/ITest.cs @@ -38,11 +38,6 @@ namespace ICSharpCode.UnitTesting /// string DisplayName { get; } - /// - /// Gets all the names of the unit tests contained in this node. - /// - IEnumerable GetUnitTestNames(); - /// /// Raised when the property changes. /// diff --git a/src/AddIns/Analysis/UnitTesting/Model/TestBase.cs b/src/AddIns/Analysis/UnitTesting/Model/TestBase.cs index 1d60b5b3e2..ef87aa8ed6 100644 --- a/src/AddIns/Analysis/UnitTesting/Model/TestBase.cs +++ b/src/AddIns/Analysis/UnitTesting/Model/TestBase.cs @@ -23,8 +23,6 @@ namespace ICSharpCode.UnitTesting public abstract ITestProject ParentProject { get; } - public abstract IEnumerable GetUnitTestNames(); - #region Result TestResultType result; bool useCompositeResultsOfNestedTests; diff --git a/src/AddIns/Analysis/UnitTesting/Model/TestNamespace.cs b/src/AddIns/Analysis/UnitTesting/Model/TestNamespace.cs index e06f38cd8c..bd5ec6be43 100644 --- a/src/AddIns/Analysis/UnitTesting/Model/TestNamespace.cs +++ b/src/AddIns/Analysis/UnitTesting/Model/TestNamespace.cs @@ -51,13 +51,5 @@ namespace ICSharpCode.UnitTesting get { return base.NestedTestCollection; } } - public override IEnumerable GetUnitTestNames() - { - foreach (var test in base.NestedTests) { - foreach (var name in test.ParentProject.GetUnitTestNames()) { - yield return name; - } - } - } } } diff --git a/src/AddIns/Analysis/UnitTesting/Model/TestSolution.cs b/src/AddIns/Analysis/UnitTesting/Model/TestSolution.cs index daf7e0684e..6d7b9f10e5 100644 --- a/src/AddIns/Analysis/UnitTesting/Model/TestSolution.cs +++ b/src/AddIns/Analysis/UnitTesting/Model/TestSolution.cs @@ -73,15 +73,6 @@ namespace ICSharpCode.UnitTesting return Enumerable.Empty(); } - public override IEnumerable GetUnitTestNames() - { - foreach (var project in changeListeners.Select(l => l.testProject)) { - foreach (var name in project.GetUnitTestNames()) { - yield return name; - } - } - } - /// /// Creates a TestProject for an IProject. /// This class takes care of changes in the test framework and will recreate the testProject diff --git a/src/AddIns/Analysis/UnitTesting/NUnit/NUnitTestClass.cs b/src/AddIns/Analysis/UnitTesting/NUnit/NUnitTestClass.cs index 984cea6921..4cdd67598c 100644 --- a/src/AddIns/Analysis/UnitTesting/NUnit/NUnitTestClass.cs +++ b/src/AddIns/Analysis/UnitTesting/NUnit/NUnitTestClass.cs @@ -223,13 +223,5 @@ namespace ICSharpCode.UnitTesting base.OnNestedTestsInitialized(); } - public override IEnumerable GetUnitTestNames() - { - foreach (var test in base.NestedTests) { - foreach (var name in test.ParentProject.GetUnitTestNames()) { - yield return name; - } - } - } } } diff --git a/src/AddIns/Analysis/UnitTesting/NUnit/NUnitTestMethod.cs b/src/AddIns/Analysis/UnitTesting/NUnit/NUnitTestMethod.cs index 1ad22ebf12..03031e4fb8 100644 --- a/src/AddIns/Analysis/UnitTesting/NUnit/NUnitTestMethod.cs +++ b/src/AddIns/Analysis/UnitTesting/NUnit/NUnitTestMethod.cs @@ -105,14 +105,5 @@ namespace ICSharpCode.UnitTesting } } - public override IEnumerable GetUnitTestNames() - { - foreach (var test in base.NestedTests) { - foreach (var name in test.ParentProject.GetUnitTestNames()) { - yield return name; - } - } - } - } } diff --git a/src/AddIns/Analysis/UnitTesting/NUnit/NUnitTestProject.cs b/src/AddIns/Analysis/UnitTesting/NUnit/NUnitTestProject.cs index 6846c8c195..bdcd3feacf 100644 --- a/src/AddIns/Analysis/UnitTesting/NUnit/NUnitTestProject.cs +++ b/src/AddIns/Analysis/UnitTesting/NUnit/NUnitTestProject.cs @@ -142,13 +142,5 @@ namespace ICSharpCode.UnitTesting } #endregion - public override IEnumerable GetUnitTestNames() - { - foreach (var test in base.NestedTests) { - foreach (var name in test.ParentProject.GetUnitTestNames()) { - yield return name; - } - } - } } }