Skip to content

Commit 3a77a6d

Browse files
authored
[wasm][debugger] Fix some flaky tests (#64652)
1 parent 012711f commit 3a77a6d

2 files changed

Lines changed: 2 additions & 57 deletions

File tree

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

Lines changed: 1 addition & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -551,14 +551,12 @@ await CompareObjectPropertiesFor(frame_locals, "this",
551551
label: "this#0");
552552
}
553553

554-
#if false // https://github.com/dotnet/runtime/issues/63560
555554
[Fact]
556555
public async Task InvalidArrayId() => await CheckInspectLocalsAtBreakpointSite(
557556
"DebuggerTests.Container", "PlaceholderMethod", 1, "PlaceholderMethod",
558557
"window.setTimeout(function() { invoke_static_method ('[debugger-test] DebuggerTests.ArrayTestsClass:ObjectArrayMembers'); }, 1);",
559558
wait_for_event_fn: async (pause_location) =>
560559
{
561-
562560
int frame_idx = 1;
563561
var frame_locals = await GetProperties(pause_location["callFrames"][frame_idx]["callFrameId"].Value<string>());
564562
var c_obj = GetAndAssertObjectWithName(frame_locals, "c");
@@ -568,56 +566,12 @@ public async Task InvalidArrayId() => await CheckInspectLocalsAtBreakpointSite(
568566
// Invalid format
569567
await GetProperties("dotnet:array:4123", expect_ok: false);
570568

571-
// Invalid object id
572-
await GetProperties("dotnet:array:{ \"arrayId\": 234980 }", expect_ok: false);
573-
574569
// Trying to access object as an array
575570
if (!DotnetObjectId.TryParse(c_obj_id, out var id) || id.Scheme != "object")
576571
Assert.True(false, "Unexpected object id format. Maybe this test is out of sync with the object id format in dotnet.cjs.lib.js?");
577572

578-
if (!int.TryParse(id.Value, out var idNum))
579-
Assert.True(false, "Expected a numeric value part of the object id: {c_obj_id}");
580-
await GetProperties($"dotnet:array:{{\"arrayId\":{idNum}}}", expect_ok: false);
581-
});
582-
583-
[Fact]
584-
public async Task InvalidValueTypeArrayIndex() => await CheckInspectLocalsAtBreakpointSite(
585-
"DebuggerTests.Container", "PlaceholderMethod", 1, "PlaceholderMethod",
586-
"window.setTimeout(function() { invoke_static_method ('[debugger-test] DebuggerTests.ArrayTestsClass:ObjectArrayMembers'); }, 1);",
587-
locals_fn: async (locals) =>
588-
{
589-
var this_obj = GetAndAssertObjectWithName(locals, "this");
590-
var c_obj = GetAndAssertObjectWithName(await GetProperties(this_obj["value"]["objectId"].Value<string>()), "c");
591-
var c_obj_id = c_obj["value"]?["objectId"]?.Value<string>();
592-
Assert.NotNull(c_obj_id);
593-
594-
var c_props = await GetProperties(c_obj_id);
595-
596-
var pf_arr = GetAndAssertObjectWithName(c_props, "PointsField");
597-
var pf_arr_elems = await GetProperties(pf_arr["value"]["objectId"].Value<string>());
598-
599-
if (!DotnetObjectId.TryParse(pf_arr_elems[0]["value"]?["objectId"]?.Value<string>(), out var id))
600-
Assert.True(false, "Couldn't parse objectId for PointsFields' elements");
601-
602-
AssertEqual("valuetype", id.Scheme, "Expected a valuetype id");
603-
var id_args = id.ValueAsJson;
604-
Assert.True(id_args["arrayId"] != null, "ObjectId format for array seems to have changed. Expected to find 'arrayId' in the value. Update this test");
605-
Assert.True(id_args != null, "Expected to get a json as the value part of {id}");
606-
607-
// Try one valid query, to confirm that the id format hasn't changed!
608-
id_args["arrayIdx"] = 0;
609-
await GetProperties($"dotnet:valuetype:{id_args.ToString(Newtonsoft.Json.Formatting.None)}", expect_ok: true);
610-
611-
id_args["arrayIdx"] = 12399;
612-
await GetProperties($"dotnet:valuetype:{id_args.ToString(Newtonsoft.Json.Formatting.None)}", expect_ok: false);
613-
614-
id_args["arrayIdx"] = -1;
615-
await GetProperties($"dotnet:valuetype:{id_args.ToString(Newtonsoft.Json.Formatting.None)}", expect_ok: false);
616-
617-
id_args["arrayIdx"] = "qwe";
618-
await GetProperties($"dotnet:valuetype:{id_args.ToString(Newtonsoft.Json.Formatting.None)}", expect_ok: false);
573+
await GetProperties($"dotnet:array:{id.Value}", expect_ok: false);
619574
});
620-
#endif
621575

622576
[Fact]
623577
public async Task InvalidAccessors() => await CheckInspectLocalsAtBreakpointSite(

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

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -27,23 +27,14 @@ public async Task TimedOutWaitingForInvalidBreakpoint()
2727
public async Task ExceptionThrown()
2828
{
2929
var ae = await Assert.ThrowsAsync<ArgumentException>(
30-
async () => await EvaluateAndCheck("window.setTimeout(function() { non_existant_fn(); }, 1);", null, -1, -1, null));
30+
async () => await EvaluateAndCheck("window.setTimeout(function() { non_existant_fn(); }, 3000);", null, -1, -1, null));
3131
Assert.Contains("non_existant_fn is not defined", ae.Message);
3232
}
3333

3434
[Fact]
3535
public async Task BrowserCrash() => await Assert.ThrowsAsync<WebSocketException>(async () =>
3636
await SendCommandAndCheck(null, "Browser.crash", null, -1, -1, null));
3737

38-
[Fact]
39-
public async Task BrowserClose()
40-
{
41-
ArgumentException ae = await Assert.ThrowsAsync<ArgumentException>(async () =>
42-
await SendCommandAndCheck(null, "Browser.close", null, -1, -1, null));
43-
Assert.Contains("Inspector.detached", ae.Message);
44-
Assert.Contains("target_close", ae.Message);
45-
}
46-
4738
[Fact]
4839
public async Task InspectorWaitForAfterMessageAlreadyReceived()
4940
{

0 commit comments

Comments
 (0)