Skip to content

Commit 647c258

Browse files
authored
[wasm] Fix debugger tests (#49206)
* [wasm][debugger] Correctly skip static properties when iterating type .. members. * [wasm][debugger][tests] cleanup * [wasm][debugger][tests] Use SingleLine for the logger
1 parent 60dc59b commit 647c258

File tree

7 files changed

+19
-11
lines changed

7 files changed

+19
-11
lines changed

src/mono/mono/mini/mini-wasm-debugger.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1272,6 +1272,9 @@ describe_object_properties_for_klass (void *obj, MonoClass *klass, gboolean isAs
12721272
continue;
12731273
}
12741274

1275+
if (p->get->flags & METHOD_ATTRIBUTE_STATIC)
1276+
continue;
1277+
12751278
EM_ASM ({
12761279
MONO.mono_wasm_add_properties_var ($0, { field_offset: $1, is_own: $2, attr: $3, owner_class: $4 });
12771280
}, p->name, pnum, is_own, p->attrs, klass_name);

src/mono/wasm/debugger/BrowserDebugHost/Startup.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -153,8 +153,10 @@ async Task ConnectProxy(HttpContext context)
153153
var endpoint = new Uri($"ws://{devToolsHost.Authority}{context.Request.Path}");
154154
try
155155
{
156-
using ILoggerFactory loggerFactory = LoggerFactory.Create(
157-
builder => builder.AddConsole().AddFilter(null, LogLevel.Information));
156+
using ILoggerFactory loggerFactory = LoggerFactory.Create(builder =>
157+
builder.AddSimpleConsole(options => options.SingleLine = true)
158+
.AddFilter(null, LogLevel.Information)
159+
);
158160

159161
context.Request.Query.TryGetValue("urlSymbolServer", out StringValues urlSymbolServerList);
160162
var proxy = new DebuggerProxy(loggerFactory, urlSymbolServerList.ToList());

src/mono/wasm/debugger/DebuggerTestSuite/DebuggerTestBase.cs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,9 @@
55
using System.Collections.Generic;
66
using System.IO;
77
using System.Linq;
8-
using System.Net.WebSockets;
98
using System.Reflection;
10-
using System.Text;
11-
using System.Text.RegularExpressions;
129
using System.Threading;
1310
using System.Threading.Tasks;
14-
using Microsoft.Extensions.Logging;
1511
using Microsoft.WebAssembly.Diagnostics;
1612
using Newtonsoft.Json;
1713
using Newtonsoft.Json.Linq;
@@ -430,7 +426,6 @@ internal async Task<JObject> SendCommandAndCheck(JObject args, string method, st
430426
AssertEqual(function_name, wait_res["callFrames"]?[0]?["functionName"]?.Value<string>(), top_frame?.ToString());
431427
}
432428

433-
Console.WriteLine(top_frame);
434429
if (script_loc != null && line >= 0)
435430
CheckLocation(script_loc, line, column, scripts, top_frame["location"]);
436431

src/mono/wasm/debugger/DebuggerTestSuite/Inspector.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,9 @@ public Inspector()
4141
_cancellationTokenSource = new CancellationTokenSource();
4242
Token = _cancellationTokenSource.Token;
4343

44-
_loggerFactory = LoggerFactory.Create(
45-
builder => builder.AddConsole().AddFilter(null, LogLevel.Trace));
44+
_loggerFactory = LoggerFactory.Create(builder =>
45+
builder.AddSimpleConsole(options => options.SingleLine = true)
46+
.AddFilter(null, LogLevel.Trace));
4647

4748
Client = new InspectorClient(_loggerFactory.CreateLogger<InspectorClient>());
4849
_logger = _loggerFactory.CreateLogger<Inspector>();

src/mono/wasm/debugger/DebuggerTestSuite/TestHarnessProxy.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,8 @@ public static Task Start(string chromePath, string appPath, string pagePath)
3838
})
3939
.ConfigureLogging(logging =>
4040
{
41-
logging.AddConsole();
41+
logging.AddSimpleConsole(options => options.SingleLine = true)
42+
.AddFilter(null, LogLevel.Information);
4243
})
4344
.ConfigureServices((ctx, services) =>
4445
{

src/mono/wasm/debugger/DebuggerTestSuite/Tests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -718,7 +718,7 @@ await CompareObjectPropertiesFor(frame_locals, "dto",
718718
Day = TNumber(2),
719719
Year = TNumber(2020),
720720
DayOfWeek = TEnum("System.DayOfWeek", "Thursday")
721-
}, "dto_props", num_fields: 22);
721+
}, "dto_props", num_fields: 20);
722722

723723
var DT = new DateTime(2004, 10, 15, 1, 2, 3);
724724
var DTO = new DateTimeOffset(dt0, new TimeSpan(2, 14, 0));

src/mono/wasm/debugger/tests/debugger-test/debugger-cfo-test.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,9 @@ class ClassWithProperties
5858
public DateTime[] DTArray { get { return new DateTime[] { new DateTime(6, 7, 8, 9, 10, 11), new DateTime(1, 2, 3, 4, 5, 6) }; } }
5959
public DateTime DTAutoProperty { get; set; }
6060
public string StringField;
61+
62+
private static DateTime PrivateStaticDTProp => new DateTime(6, 5, 4, 3, 2, 1);
63+
public static DateTime PublicStaticDTProp => new DateTime(3, 6, 1, 7, 9, 4);
6164
}
6265

6366
struct StructWithProperties
@@ -71,5 +74,8 @@ struct StructWithProperties
7174
public DateTime[] DTArray { get { return new DateTime[] { new DateTime(6, 7, 8, 9, 10, 11), new DateTime(1, 2, 3, 4, 5, 6) }; } }
7275
public DateTime DTAutoProperty { get; set; }
7376
public string StringField;
77+
78+
private static DateTime PrivateStaticDTProp => new DateTime(6, 5, 4, 3, 2, 1);
79+
public static DateTime PublicStaticDTProp => new DateTime(3, 6, 1, 7, 9, 4);
7480
}
7581
}

0 commit comments

Comments
 (0)