Browse Source

- Removed GetUnitTestingNames

- Removed ProfilerTestRunner.cs, made obsolete trough ProfilerProcessRunner.cs
- added missing X64Converter/app.config
pull/45/head
Tobias Ibounig 12 years ago
parent
commit
c35884e967
  1. 24
      SharpDevelop.sln
  2. 5
      src/AddIns/Analysis/MachineSpecifications/MachineSpecifications/src/MSpecTestClass.cs
  3. 5
      src/AddIns/Analysis/MachineSpecifications/MachineSpecifications/src/MSpecTestMember.cs
  4. 5
      src/AddIns/Analysis/MachineSpecifications/MachineSpecifications/src/MSpecTestProject.cs
  5. 1
      src/AddIns/Analysis/Profiler/Frontend/AddIn/Profiler.AddIn.csproj
  6. 2
      src/AddIns/Analysis/Profiler/Frontend/AddIn/Src/Commands/RunTestWithProfilerCommand.cs
  7. 164
      src/AddIns/Analysis/Profiler/Frontend/AddIn/Src/ProfilerTestRunner.cs
  8. 6
      src/AddIns/Analysis/Profiler/X64Converter/app.config
  9. 5
      src/AddIns/Analysis/UnitTesting/Model/ITest.cs
  10. 2
      src/AddIns/Analysis/UnitTesting/Model/TestBase.cs
  11. 8
      src/AddIns/Analysis/UnitTesting/Model/TestNamespace.cs
  12. 9
      src/AddIns/Analysis/UnitTesting/Model/TestSolution.cs
  13. 8
      src/AddIns/Analysis/UnitTesting/NUnit/NUnitTestClass.cs
  14. 9
      src/AddIns/Analysis/UnitTesting/NUnit/NUnitTestMethod.cs
  15. 8
      src/AddIns/Analysis/UnitTesting/NUnit/NUnitTestProject.cs

24
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}.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.ActiveCfg = Release|Any CPU
{D1DF9C2D-3A5E-4985-ACA4-648C604DB562}.Release|Any CPU.Build.0 = 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.ActiveCfg = Debug|Any CPU
{D788789A-4D43-42B9-B0F7-CB2CA761372B}.Debug|Any CPU.Build.0 = 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 {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}.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.ActiveCfg = Release|Any CPU
{B063078F-17D2-4B0C-A01C-DBF440F1C24D}.Release|Any CPU.Build.0 = 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 EndGlobalSection
GlobalSection(SolutionProperties) = preSolution GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE HideSolutionNode = FALSE

5
src/AddIns/Analysis/MachineSpecifications/MachineSpecifications/src/MSpecTestClass.cs

@ -95,10 +95,5 @@ namespace ICSharpCode.MachineSpecifications
IType type = compilation.MainAssembly.GetTypeDefinition(fullTypeName); IType type = compilation.MainAssembly.GetTypeDefinition(fullTypeName);
return type.GetDefinition(); return type.GetDefinition();
} }
public override IEnumerable<string> GetUnitTestNames()
{
return NestedTestCollection.SelectMany(t => t.GetUnitTestNames());
}
} }
} }

5
src/AddIns/Analysis/MachineSpecifications/MachineSpecifications/src/MSpecTestMember.cs

@ -68,10 +68,5 @@ namespace ICSharpCode.MachineSpecifications
{ {
return member.DeclaringTypeDefinition.FullName; return member.DeclaringTypeDefinition.FullName;
} }
public override System.Collections.Generic.IEnumerable<string> GetUnitTestNames()
{
yield return member.ReflectionName;
}
} }
} }

5
src/AddIns/Analysis/MachineSpecifications/MachineSpecifications/src/MSpecTestProject.cs

@ -135,10 +135,5 @@ namespace ICSharpCode.MachineSpecifications
return typeDefinition.Attributes.Any( return typeDefinition.Attributes.Any(
attribute => MSpecBehaviorsAttributeFQName.Equals(attribute.AttributeType.FullName)); attribute => MSpecBehaviorsAttributeFQName.Equals(attribute.AttributeType.FullName));
} }
public override IEnumerable<string> GetUnitTestNames()
{
return NestedTestCollection.SelectMany(c => c.GetUnitTestNames());
}
} }
} }

1
src/AddIns/Analysis/Profiler/Frontend/AddIn/Profiler.AddIn.csproj

@ -92,7 +92,6 @@
<Compile Include="Src\OptionPanels\OptionWrapper.cs" /> <Compile Include="Src\OptionPanels\OptionWrapper.cs" />
<Compile Include="Src\ProfilerProcessRunner.cs" /> <Compile Include="Src\ProfilerProcessRunner.cs" />
<Compile Include="Src\ProfilerRunner.cs" /> <Compile Include="Src\ProfilerRunner.cs" />
<Compile Include="Src\ProfilerTestRunner.cs" />
<Compile Include="Src\SharpDevelopTranslation.cs" /> <Compile Include="Src\SharpDevelopTranslation.cs" />
<Compile Include="Src\Views\ComparisonView.xaml.cs"> <Compile Include="Src\Views\ComparisonView.xaml.cs">
<DependentUpon>ComparisonView.xaml</DependentUpon> <DependentUpon>ComparisonView.xaml</DependentUpon>

2
src/AddIns/Analysis/Profiler/Frontend/AddIn/Src/Commands/RunTestWithProfilerCommand.cs

@ -20,7 +20,7 @@ namespace ICSharpCode.Profiler.AddIn.Commands
ITestService testService = SD.GetRequiredService<ITestService>(); ITestService testService = SD.GetRequiredService<ITestService>();
IEnumerable<ITest> tests = TestableCondition.GetTests(testService.OpenSolution, Owner); IEnumerable<ITest> tests = TestableCondition.GetTests(testService.OpenSolution, Owner);
string path = tests.FirstOrDefault().ParentProject.Project.GetSessionFileName(); 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();
} }
} }
} }

164
src/AddIns/Analysis/Profiler/Frontend/AddIn/Src/ProfilerTestRunner.cs

@ -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<ITest> selectedTests)
{
ProcessStartInfo startInfo = GetProcessStartInfo(selectedTests);
Start(startInfo, selectedTests);
}
protected override ProcessStartInfo GetProcessStartInfo(IEnumerable<ITest> selectedTests)
{
NUnitConsoleApplication app = new NUnitConsoleApplication(selectedTests, UnitTestingOptions.Instance);
testResultsReader = new TestResultsReader();
app.ResultsPipe = testResultsReader.PipeName;
return app.GetProcessStartInfo();
}
void Start(ProcessStartInfo startInfo, IEnumerable<ITest> 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<string> GetUnitTestNames(IEnumerable<ITest> 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<NUnitTestClass> selectedNunitTests = (IEnumerable<NUnitTestClass>) 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<ITest> 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<ITest> selectedTests)
{
return GetNumberOfTestMethods(selectedTests);
}
public static int GetNumberOfTestMethods(IEnumerable<ITest> selectedTests)
{
int count = 0;
foreach (ITest test in selectedTests) {
if (test is NUnitTestMethod)
count++;
else
count += GetNumberOfTestMethods(test.NestedTests);
}
return count;
}
}
}

6
src/AddIns/Analysis/Profiler/X64Converter/app.config

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
</startup>
</configuration>

5
src/AddIns/Analysis/UnitTesting/Model/ITest.cs

@ -38,11 +38,6 @@ namespace ICSharpCode.UnitTesting
/// </summary> /// </summary>
string DisplayName { get; } string DisplayName { get; }
/// <summary>
/// Gets all the names of the unit tests contained in this node.
/// </summary>
IEnumerable<string> GetUnitTestNames();
/// <summary> /// <summary>
/// Raised when the <see cref="Name"/> property changes. /// Raised when the <see cref="Name"/> property changes.
/// </summary> /// </summary>

2
src/AddIns/Analysis/UnitTesting/Model/TestBase.cs

@ -23,8 +23,6 @@ namespace ICSharpCode.UnitTesting
public abstract ITestProject ParentProject { get; } public abstract ITestProject ParentProject { get; }
public abstract IEnumerable<string> GetUnitTestNames();
#region Result #region Result
TestResultType result; TestResultType result;
bool useCompositeResultsOfNestedTests; bool useCompositeResultsOfNestedTests;

8
src/AddIns/Analysis/UnitTesting/Model/TestNamespace.cs

@ -51,13 +51,5 @@ namespace ICSharpCode.UnitTesting
get { return base.NestedTestCollection; } get { return base.NestedTestCollection; }
} }
public override IEnumerable<string> GetUnitTestNames()
{
foreach (var test in base.NestedTests) {
foreach (var name in test.ParentProject.GetUnitTestNames()) {
yield return name;
}
}
}
} }
} }

9
src/AddIns/Analysis/UnitTesting/Model/TestSolution.cs

@ -73,15 +73,6 @@ namespace ICSharpCode.UnitTesting
return Enumerable.Empty<ITest>(); return Enumerable.Empty<ITest>();
} }
public override IEnumerable<string> GetUnitTestNames()
{
foreach (var project in changeListeners.Select(l => l.testProject)) {
foreach (var name in project.GetUnitTestNames()) {
yield return name;
}
}
}
/// <summary> /// <summary>
/// Creates a TestProject for an IProject. /// Creates a TestProject for an IProject.
/// This class takes care of changes in the test framework and will recreate the testProject /// This class takes care of changes in the test framework and will recreate the testProject

8
src/AddIns/Analysis/UnitTesting/NUnit/NUnitTestClass.cs

@ -223,13 +223,5 @@ namespace ICSharpCode.UnitTesting
base.OnNestedTestsInitialized(); base.OnNestedTestsInitialized();
} }
public override IEnumerable<string> GetUnitTestNames()
{
foreach (var test in base.NestedTests) {
foreach (var name in test.ParentProject.GetUnitTestNames()) {
yield return name;
}
}
}
} }
} }

9
src/AddIns/Analysis/UnitTesting/NUnit/NUnitTestMethod.cs

@ -105,14 +105,5 @@ namespace ICSharpCode.UnitTesting
} }
} }
public override IEnumerable<string> GetUnitTestNames()
{
foreach (var test in base.NestedTests) {
foreach (var name in test.ParentProject.GetUnitTestNames()) {
yield return name;
}
}
}
} }
} }

8
src/AddIns/Analysis/UnitTesting/NUnit/NUnitTestProject.cs

@ -142,13 +142,5 @@ namespace ICSharpCode.UnitTesting
} }
#endregion #endregion
public override IEnumerable<string> GetUnitTestNames()
{
foreach (var test in base.NestedTests) {
foreach (var name in test.ParentProject.GetUnitTestNames()) {
yield return name;
}
}
}
} }
} }

Loading…
Cancel
Save