Skip to content

Commit 2ec5530

Browse files
committed
Merge branch 'debuggerSplitTests' of ../../../../monodevelop_temp into debuggerSplitTests
2 parents 916a1ec + 55887a1 commit 2ec5530

21 files changed

+6744
-0
lines changed
Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<PropertyGroup>
4+
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
5+
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
6+
<ProductVersion>8.0.30703</ProductVersion>
7+
<SchemaVersion>2.0</SchemaVersion>
8+
<ProjectGuid>{174E6044-DD3A-49AB-9A5C-2A1F341B7B4F}</ProjectGuid>
9+
<OutputType>Library</OutputType>
10+
<RootNamespace>MonoDevelop.Debugger.Tests</RootNamespace>
11+
<AssemblyName>MonoDevelop.Debugger.Tests</AssemblyName>
12+
<TestRunnerCommand>..\..\..\..\build\bin\mdtool.exe</TestRunnerCommand>
13+
<TestRunnerArgs>run-md-tests</TestRunnerArgs>
14+
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
15+
</PropertyGroup>
16+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
17+
<DebugSymbols>True</DebugSymbols>
18+
<DebugType>full</DebugType>
19+
<Optimize>False</Optimize>
20+
<OutputPath>..\..\..\..\build\tests</OutputPath>
21+
<DefineConstants>DEBUG</DefineConstants>
22+
<ErrorReport>prompt</ErrorReport>
23+
<WarningLevel>4</WarningLevel>
24+
<NoWarn>1591;1573</NoWarn>
25+
</PropertyGroup>
26+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
27+
<DebugType>pdbonly</DebugType>
28+
<Optimize>true</Optimize>
29+
<OutputPath>..\..\..\..\build\tests</OutputPath>
30+
<ErrorReport>prompt</ErrorReport>
31+
<WarningLevel>4</WarningLevel>
32+
<DebugSymbols>true</DebugSymbols>
33+
<NoWarn>1591;1573</NoWarn>
34+
</PropertyGroup>
35+
<ItemGroup>
36+
<Reference Include="System" />
37+
<Reference Include="System.Core" />
38+
</ItemGroup>
39+
<ItemGroup>
40+
<Compile Include="DebugTests.cs" />
41+
<Compile Include="DebugTests.MonoDevelop.cs" />
42+
<Compile Include="SdbEvaluationTests.cs" />
43+
<Compile Include="EvaluationTests.cs" />
44+
<Compile Include="StackFrameTests.cs" />
45+
<Compile Include="SdbStackFrameTests.cs" />
46+
<Compile Include="CorEvaluationTests.cs" />
47+
<Compile Include="CorStackFrameTests.cs" />
48+
<Compile Include="BreakpointsAndSteppingTests.cs" />
49+
<Compile Include="CorBreakpointsAndSteppingTests.cs" />
50+
<Compile Include="SdbBreakpointsAndSteppingTests.cs" />
51+
<Compile Include="AdvancedEvaluationTests.cs" />
52+
<Compile Include="TextFile.cs" />
53+
<Compile Include="TextFile.MonoDevelop.cs" />
54+
</ItemGroup>
55+
<ItemGroup>
56+
<ProjectReference Include="..\MonoDevelop.Debugger.csproj">
57+
<Project>{2357AABD-08C7-4808-A495-8FF2D3CDFDB0}</Project>
58+
<Name>MonoDevelop.Debugger</Name>
59+
<Private>False</Private>
60+
</ProjectReference>
61+
<ProjectReference Include="..\..\..\core\MonoDevelop.Core\MonoDevelop.Core.csproj">
62+
<Project>{7525BB88-6142-4A26-93B9-A30C6983390A}</Project>
63+
<Name>MonoDevelop.Core</Name>
64+
<Private>False</Private>
65+
</ProjectReference>
66+
<ProjectReference Include="..\..\..\core\MonoDevelop.Ide\MonoDevelop.Ide.csproj">
67+
<Project>{27096E7F-C91C-4AC6-B289-6897A701DF21}</Project>
68+
<Name>MonoDevelop.Ide</Name>
69+
<Private>False</Private>
70+
</ProjectReference>
71+
<ProjectReference Include="..\MonoDevelop.Debugger.Tests.TestApp\MonoDevelop.Debugger.Tests.TestApp.csproj">
72+
<Project>{05EDFE55-C8D1-47E4-BB61-0BC809CD82E2}</Project>
73+
<Name>MonoDevelop.Debugger.Tests.TestApp</Name>
74+
<Private>False</Private>
75+
</ProjectReference>
76+
<ProjectReference Include="..\..\..\..\external\nrefactory\ICSharpCode.NRefactory\ICSharpCode.NRefactory.csproj">
77+
<Project>{3B2A5653-EC97-4001-BB9B-D90F1AF2C371}</Project>
78+
<Name>ICSharpCode.NRefactory</Name>
79+
<Private>False</Private>
80+
</ProjectReference>
81+
<ProjectReference Include="..\..\..\..\external\mono-addins\Mono.Addins\Mono.Addins.csproj">
82+
<Project>{91DD5A2D-9FE3-4C3C-9253-876141874DAD}</Project>
83+
<Name>Mono.Addins</Name>
84+
<Private>False</Private>
85+
</ProjectReference>
86+
<ProjectReference Include="..\..\..\..\external\debugger-libs\Mono.Debugging\Mono.Debugging.csproj">
87+
<Project>{90C99ADB-7D4B-4EB4-98C2-40BD1B14C7D2}</Project>
88+
<Name>Mono.Debugging</Name>
89+
<Private>False</Private>
90+
</ProjectReference>
91+
<ProjectReference Include="..\..\..\..\external\guiunit\src\framework\GuiUnit_NET_4_5.csproj">
92+
<Project>{D12F0F7B-8DE3-43EC-BA49-41052D065A9B}</Project>
93+
<Name>GuiUnit_NET_4_5</Name>
94+
</ProjectReference>
95+
<ProjectReference Include="..\..\..\..\external\debugger-libs\Mono.Debugging.Soft\Mono.Debugging.Soft.csproj">
96+
<Project>{DE40756E-57F6-4AF2-B155-55E3A88CCED8}</Project>
97+
<Name>Mono.Debugging.Soft</Name>
98+
</ProjectReference>
99+
</ItemGroup>
100+
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
101+
</Project>
Lines changed: 204 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,204 @@
1+
//
2+
// AdvancedEvaluationTests.cs
3+
//
4+
// Author:
5+
// David Karlaš <[email protected]>
6+
//
7+
// Copyright (c) 2015 Xamarin Inc. (http://xamarin.com)
8+
//
9+
// Permission is hereby granted, free of charge, to any person obtaining a copy
10+
// of this software and associated documentation files (the "Software"), to deal
11+
// in the Software without restriction, including without limitation the rights
12+
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13+
// copies of the Software, and to permit persons to whom the Software is
14+
// furnished to do so, subject to the following conditions:
15+
//
16+
// The above copyright notice and this permission notice shall be included in
17+
// all copies or substantial portions of the Software.
18+
//
19+
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20+
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21+
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22+
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23+
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24+
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
25+
// THE SOFTWARE.
26+
using System;
27+
using NUnit.Framework;
28+
29+
namespace MonoDevelop.Debugger.Tests
30+
{
31+
namespace Soft
32+
{
33+
[TestFixture]
34+
public class SdbAdvancedEvaluationAllowTargetInvokesTests : AdvancedEvaluationTests
35+
{
36+
public SdbAdvancedEvaluationAllowTargetInvokesTests () : base ("Mono.Debugger.Soft", true)
37+
{
38+
}
39+
}
40+
41+
[TestFixture]
42+
public class SdbAdvancedEvaluationNoTargetInvokesTests : AdvancedEvaluationTests
43+
{
44+
public SdbAdvancedEvaluationNoTargetInvokesTests () : base ("Mono.Debugger.Soft", false)
45+
{
46+
}
47+
}
48+
}
49+
50+
namespace Win32
51+
{
52+
[TestFixture]
53+
[Platform(Include = "Win")]
54+
public class CorAdvancedEvaluationAllowTargetInvokesTests : AdvancedEvaluationTests
55+
{
56+
public CorAdvancedEvaluationAllowTargetInvokesTests () : base ("MonoDevelop.Debugger.Win32", true)
57+
{
58+
}
59+
}
60+
61+
[TestFixture]
62+
[Platform(Include = "Win")]
63+
public class CorAdvancedEvaluationNoTargetInvokesTests : AdvancedEvaluationTests
64+
{
65+
public CorAdvancedEvaluationNoTargetInvokesTests () : base ("MonoDevelop.Debugger.Win32", false)
66+
{
67+
}
68+
}
69+
}
70+
71+
[TestFixture]
72+
public abstract class AdvancedEvaluationTests : DebugTests
73+
{
74+
protected AdvancedEvaluationTests (string de, bool allowTargetInvokes) : base (de)
75+
{
76+
AllowTargetInvokes = allowTargetInvokes;
77+
}
78+
79+
[TestFixtureSetUp]
80+
public override void SetUp ()
81+
{
82+
base.SetUp ();
83+
Start ("AdvancedEvaluation");
84+
}
85+
86+
[Test]
87+
public void Bug24998 ()
88+
{
89+
InitializeTest ();
90+
AddBreakpoint ("cc622137-a162-4b91-a85c-88241e68c3ea");
91+
StartTest ("Bug24998Test");
92+
CheckPosition ("cc622137-a162-4b91-a85c-88241e68c3ea");
93+
var val = Eval ("someField");
94+
Assert.AreEqual ("\"das\"", val.Value);
95+
Assert.AreEqual ("string", val.TypeName);
96+
97+
val = Eval ("someVariable");
98+
Assert.AreEqual ("System.Collections.ArrayList", val.TypeName);
99+
var children = val.GetAllChildrenSync ();
100+
Assert.AreEqual (2, children.Length);
101+
Assert.AreEqual ("[0]", children [0].ChildSelector);
102+
Assert.AreEqual ("1", children [0].Value);
103+
Assert.AreEqual ("int", children [0].TypeName);
104+
105+
val = Eval ("action");
106+
Assert.AreEqual ("System.Action", val.TypeName);
107+
}
108+
109+
110+
[Test]
111+
public void YieldMethodTest ()
112+
{
113+
InitializeTest ();
114+
AddBreakpoint ("0b1212f8-9035-43dc-bf01-73efd078d680");
115+
StartTest ("YieldMethodTest");
116+
CheckPosition ("0b1212f8-9035-43dc-bf01-73efd078d680");
117+
118+
var val = Eval ("someVariable");
119+
Assert.AreEqual ("System.Collections.ArrayList", val.TypeName);
120+
Assert.AreEqual (1, val.GetAllChildrenSync ().Length);
121+
122+
AddBreakpoint ("e96b28bb-59bf-445d-b71f-316726ba4c52");
123+
Continue ("e96b28bb-59bf-445d-b71f-316726ba4c52");
124+
125+
val = Eval ("someField");
126+
Assert.AreEqual ("\"das1\"", val.Value);
127+
Assert.AreEqual ("string", val.TypeName);
128+
val = Eval ("someVariable");
129+
Assert.AreEqual ("System.Collections.ArrayList", val.TypeName);
130+
Assert.AreEqual (2, val.GetAllChildrenSync ().Length);
131+
132+
AddBreakpoint ("760feb92-176a-43d7-b5c9-116c4a3c6a6c");
133+
Continue ("760feb92-176a-43d7-b5c9-116c4a3c6a6c");
134+
135+
val = Eval ("someField");
136+
Assert.AreEqual ("\"das2\"", val.Value);
137+
Assert.AreEqual ("string", val.TypeName);
138+
val = Eval ("someVariable");
139+
Assert.AreEqual ("System.Collections.ArrayList", val.TypeName);
140+
Assert.AreEqual (3, val.GetAllChildrenSync ().Length);
141+
142+
AddBreakpoint ("a9a9aa9d-6b8b-4724-9741-2a3e1fb435e8");
143+
Continue ("a9a9aa9d-6b8b-4724-9741-2a3e1fb435e8");
144+
145+
val = Eval ("someField");
146+
Assert.AreEqual ("\"das2\"", val.Value);
147+
Assert.AreEqual ("string", val.TypeName);
148+
val = Eval ("someVariable");
149+
Assert.AreEqual ("System.Collections.ArrayList", val.TypeName);
150+
Assert.AreEqual (3, val.GetAllChildrenSync ().Length);
151+
152+
}
153+
154+
[Test]
155+
public void InvocationsCountDuringExpandingTest ()
156+
{
157+
InitializeTest ();
158+
AddBreakpoint ("8865cace-6b57-42cc-ad55-68a2c12dd3d7");
159+
StartTest ("InvocationsCountDuringExpandingTest");
160+
CheckPosition ("8865cace-6b57-42cc-ad55-68a2c12dd3d7");
161+
var options = Session.EvaluationOptions.Clone ();
162+
options.GroupPrivateMembers = false; // to access private fields (else there are in Private subgroup)
163+
var value = Eval ("mutableFieldClass");
164+
var sharedX = value.GetChildSync ("sharedX", options);
165+
Assert.NotNull (sharedX);
166+
167+
var prop1 = value.GetChildSync("Prop1", options);
168+
Assert.NotNull (prop1);
169+
Assert.AreEqual ("MonoDevelop.Debugger.Tests.TestApp.AdvancedEvaluation.MutableField", prop1.TypeName);
170+
var prop1X = prop1.GetChildSync ("x", options);
171+
Assert.NotNull (prop1X);
172+
Assert.AreEqual ("0", prop1X.Value); // before CorValRef optimization this field evaluated to 2,
173+
// because every value to the root object was recalculated - this was wrong behavior
174+
175+
var prop2 = value.GetChildSync ("Prop2", options);
176+
Assert.NotNull (prop2);
177+
var prop2X = prop2.GetChildSync("x", options);
178+
Assert.NotNull (prop2X);
179+
Assert.AreEqual ("1", prop2X.Value);
180+
181+
Assert.AreEqual ("2", sharedX.Value);
182+
}
183+
184+
[Test]
185+
public void MethodWithTypeGenericArgsEval ()
186+
{
187+
InitializeTest ();
188+
AddBreakpoint ("ba6350e5-7149-4cc2-a4cf-8a54c635eb38");
189+
StartTest ("MethodWithTypeGenericArgsEval");
190+
CheckPosition ("ba6350e5-7149-4cc2-a4cf-8a54c635eb38");
191+
192+
var baseMethodEval = Eval ("genericClass.BaseMethodWithClassTArg (wrappedA)");
193+
Assert.NotNull (baseMethodEval);
194+
Assert.AreEqual ("{Wrapper(wrappedA)}", baseMethodEval.Value);
195+
196+
var thisMethodEval = Eval ("genericClass.RetMethodWithClassTArg (a)");
197+
Assert.NotNull (thisMethodEval);
198+
Assert.AreEqual ("{Just A}", thisMethodEval.Value);
199+
}
200+
201+
202+
}
203+
}
204+

0 commit comments

Comments
 (0)