v8/test/inspector/debugger/wasm-reset-context-group.js
Benedikt Meurer 6f448efbef [inspector] Make wasm tests fail rather than time out.
Consistently use InspectorTest.runAsyncTestSuite() in wasm inspector
tests to make tests easier to debug (they'll fail instead of timing
out in case of errors).

Bug: chromium:1162229, chromium:1071432
Change-Id: I7aada196f9e34071aa1bb059bb45f85f75226060
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2609414
Commit-Queue: Yang Guo <yangguo@chromium.org>
Auto-Submit: Benedikt Meurer <bmeurer@chromium.org>
Reviewed-by: Yang Guo <yangguo@chromium.org>
Cr-Commit-Position: refs/heads/master@{#71908}
2021-01-05 07:38:57 +00:00

51 lines
1.6 KiB
JavaScript

// Copyright 2018 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
utils.load('test/inspector/wasm-inspector-test.js');
InspectorTest.log('Checks resetting context group with wasm.');
var builder = new WasmModuleBuilder();
// wasm_B calls wasm_A <param0> times.
builder.addFunction('wasm_func', kSig_i_i)
.addBody([
// clang-format off
kExprLocalGet, 0,
kExprI32Const, 1,
kExprI32Sub,
// clang-format on
])
.exportAs('main');
var module_bytes = builder.toArray();
var contextGroup1 = new InspectorTest.ContextGroup();
var session1 = contextGroup1.connect();
session1.setupScriptMap();
let contextGroup2 = new InspectorTest.ContextGroup();
let session2 = contextGroup2.connect();
session2.setupScriptMap();
InspectorTest.runAsyncTestSuite([
async function test() {
await session1.Protocol.Debugger.enable();
await session2.Protocol.Debugger.enable();
session1.Protocol.Runtime.evaluate({
expression: `var instance = (${WasmInspectorTest.instantiateFromBuffer})(${JSON.stringify(module_bytes)})`});
session2.Protocol.Runtime.evaluate({
expression: `var instance = (${WasmInspectorTest.instantiateFromBuffer})(${JSON.stringify(module_bytes)})`});
contextGroup2.reset();
await session1.Protocol.Debugger.onceScriptParsed(2);
InspectorTest.logMessage(await session1.Protocol.Runtime.evaluate({expression: 'instance.exports.main(4)'}));
InspectorTest.logMessage(await session2.Protocol.Runtime.evaluate({expression: 'instance.exports.main(5)'}));
}
]);