Skip to content

Commit

Permalink
[wasm][debugger] Remove non-deterministic signals from debugger tests. (
Browse files Browse the repository at this point in the history
#77038)

* Easy fix.

* Non wasm page loading detection.

* This is a good test, Sleep was redundant.

* This comment can be removed.

* Applied radical's idea to simplify the logic.
  • Loading branch information
ilonatommy authored Oct 20, 2022
1 parent 9674537 commit a17d3d2
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -505,7 +505,7 @@ public async Task CreateGoodBreakpointAndHitGoToNonWasmPageComeBackAndHitAgain(s
expression = "window.setTimeout(function() { " + func_name + "(); }, 1);"
});
await cli.SendCommand("Runtime.evaluate", run_method, token);
await Task.Delay(1000, token);
await WaitForEventAsync("Runtime.executionContextCreated");

run_method = JObject.FromObject(new
{
Expand Down
10 changes: 5 additions & 5 deletions src/mono/wasm/debugger/DebuggerTestSuite/DebuggerTestBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1465,17 +1465,17 @@ internal async Task<JObject> LoadAssemblyAndTestHotReload(string asm_file, strin
return await WaitFor(Inspector.PAUSE);
}

public async Task<JObject> WaitForBreakpointResolvedEvent()
public Task<JObject> WaitForBreakpointResolvedEvent() => WaitForEventAsync("Debugger.breakpointResolved");

public async Task<JObject> WaitForEventAsync(string eventName)
{
try
{
var res = await insp.WaitForEvent("Debugger.breakpointResolved");
_testOutput.WriteLine ($"breakpoint resolved to {res}");
return res;
return await insp.WaitForEvent(eventName);
}
catch (TaskCanceledException)
{
throw new XunitException($"Timed out waiting for Debugger.breakpointResolved event");
throw new XunitException($"Timed out waiting for {eventName} event");
}
}

Expand Down
7 changes: 3 additions & 4 deletions src/mono/wasm/debugger/DebuggerTestSuite/ExceptionTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ await SendCommand("Page.reload", JObject.FromObject(new
{
ignoreCache = true
}));
Thread.Sleep(1000);
await insp.WaitFor(Inspector.APP_READY);

var eval_expr = "window.setTimeout(function() { invoke_static_method (" +
$"'{entry_method_name}'" +
Expand Down Expand Up @@ -278,10 +278,9 @@ public async Task ExceptionTestAllWithReload(string entry_method_name, string cl
var pause_location = await SendCommandAndCheck(JObject.FromObject(new
{
ignoreCache = true
}), "Page.reload",null, 0, 0, null);
Thread.Sleep(1000);
}), "Page.reload", null, 0, 0, null);

// Hit resume to skip
// Hit resume to skip
int count = 0;
while(true)
{
Expand Down

0 comments on commit a17d3d2

Please sign in to comment.