Commit cad99884 authored by Benedikt Meurer's avatar Benedikt Meurer Committed by Commit Bot

[inspector][wasm] Stop relying on `//# sourceURL` annotation.

These tests unnecessarily rely on the `//# sourceURL` annotation. This
is preparatory work to eventually move the treatment of `sourceURL` to
the DevTools front-end.

Bug: chromium:1183990
Change-Id: I934eb1580f503b7b9f8d97c250b7c798bc67e268
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2814568
Commit-Queue: Benedikt Meurer <bmeurer@chromium.org>
Commit-Queue: Yang Guo <yangguo@chromium.org>
Auto-Submit: Benedikt Meurer <bmeurer@chromium.org>
Reviewed-by: 's avatarYang Guo <yangguo@chromium.org>
Cr-Commit-Position: refs/heads/master@{#73878}
parent a3c143f4
......@@ -20,6 +20,7 @@ Protocol.Debugger.onPaused(async msg => {
InspectorTest.runAsyncTestSuite([
async function test() {
await Protocol.Runtime.enable();
await Protocol.Debugger.enable();
InspectorTest.log('Instantiating.');
// Spawn asynchronously:
......
......@@ -50,6 +50,7 @@ Protocol.Debugger.onPaused(async msg => {
InspectorTest.runAsyncTestSuite([
async function test() {
await Protocol.Runtime.enable();
await Protocol.Debugger.enable();
InspectorTest.log('Instantiating.');
// Spawn asynchronously:
......
......@@ -47,6 +47,7 @@ InspectorTest.runAsyncTestSuite([
async function test() {
breakCount = 0;
breakpointId = 0;
await Protocol.Runtime.enable();
await Protocol.Debugger.enable();
WasmInspectorTest.instantiate(module_bytes);
await waitForWasmScript();
......
......@@ -196,6 +196,7 @@ Protocol.Debugger.onPaused(async msg => {
InspectorTest.runAsyncTestSuite([
async function test() {
await Protocol.Runtime.enable();
await Protocol.Debugger.enable();
InspectorTest.log('Instantiating.');
// Spawn asynchronously:
......
......@@ -6,5 +6,7 @@ GC triggered
Debugger.resume
Hello World (v8://test/instantiate:11:36)
at bar (v8://test/instantiate:11:36)
at wasm_A (wasm://wasm/38e28046:1:54)
at test (test.js:4:20)
at (anonymous function) (:1:1)
exports.main returned!
......@@ -36,11 +36,11 @@ contextGroup.addScript(`
function test() {
debug(instance.exports.main);
instance.exports.main({val: "Hello World"});
}
//# sourceURL=test.js`);
}`, 0, 0, 'test.js');
InspectorTest.runAsyncTestSuite([async function test() {
utils.setLogConsoleApiMessageCalls(true);
await Protocol.Runtime.enable();
await Protocol.Debugger.enable();
await WasmInspectorTest.instantiate(
module_bytes, 'instance', '{foo: {bar: (x) => console.log(x.val)}}');
......
......@@ -32,6 +32,7 @@ builder.addFunction('main', kSig_v_i)
var module_bytes = builder.toArray();
Protocol.Runtime.enable();
Protocol.Debugger.enable();
Protocol.Debugger.onScriptParsed(handleScriptParsed);
......
......@@ -39,7 +39,8 @@ function instantiate(bytes, imp) {
session.setupScriptMap();
// Main promise chain:
Protocol.Debugger.enable()
Protocol.Runtime.enable()
.then(() => Protocol.Debugger.enable())
.then(() => InspectorTest.log('Installing code and global variable.'))
.then(
() => WasmInspectorTest.evalWithUrl(
......
......@@ -98,6 +98,7 @@ async function testConfig(config) {
InspectorTest.runAsyncTestSuite([
async function test() {
await Protocol.Runtime.enable();
await Protocol.Debugger.enable();
for (let config in configs) {
await testConfig(config);
......
......@@ -24,6 +24,7 @@ InspectorTest.runAsyncTestSuite([
const start_fn = builder.addFunction('start', kSig_v_v).addBody([kExprNop]);
builder.addStart(start_fn.index);
await Protocol.Runtime.enable();
await Protocol.Debugger.enable();
InspectorTest.log('Setting instrumentation breakpoint');
InspectorTest.logMessage(
......@@ -40,6 +41,7 @@ InspectorTest.runAsyncTestSuite([
'new WebAssembly.Instance(module)', 'instantiate2');
InspectorTest.log('Done.');
await Protocol.Debugger.disable();
await Protocol.Runtime.disable();
},
// If we compile twice, we get two instrumentation breakpoints (which might or
......@@ -49,6 +51,7 @@ InspectorTest.runAsyncTestSuite([
const start_fn = builder.addFunction('start', kSig_v_v).addBody([kExprNop]);
builder.addStart(start_fn.index);
await Protocol.Runtime.enable();
await Protocol.Debugger.enable();
InspectorTest.log('Setting instrumentation breakpoint');
InspectorTest.logMessage(
......@@ -61,6 +64,7 @@ InspectorTest.runAsyncTestSuite([
await WasmInspectorTest.instantiate(builder.toArray());
InspectorTest.log('Done.');
await Protocol.Debugger.disable();
await Protocol.Runtime.disable();
},
async function testBreakInExportedFunction() {
......@@ -68,6 +72,7 @@ InspectorTest.runAsyncTestSuite([
const func =
builder.addFunction('func', kSig_v_v).addBody([kExprNop]).exportFunc();
await Protocol.Runtime.enable();
await Protocol.Debugger.enable();
InspectorTest.log('Setting instrumentation breakpoint');
InspectorTest.logMessage(
......@@ -84,6 +89,7 @@ InspectorTest.runAsyncTestSuite([
await WasmInspectorTest.evalWithUrl('instance.exports.func()', 'call_func');
InspectorTest.log('Done.');
await Protocol.Debugger.disable();
await Protocol.Runtime.disable();
},
async function testBreakOnlyWithSourceMap() {
......@@ -94,6 +100,7 @@ InspectorTest.runAsyncTestSuite([
builder.addCustomSection('sourceMappingURL', [3, 97, 98, 99]);
const bytes_with_source_map = builder.toArray();
await Protocol.Runtime.enable();
await Protocol.Debugger.enable();
InspectorTest.log(
'Setting instrumentation breakpoint for source maps only');
......@@ -114,6 +121,7 @@ InspectorTest.runAsyncTestSuite([
await WasmInspectorTest.evalWithUrl('instance.exports.func()', 'call_func');
InspectorTest.log('Done.');
await Protocol.Debugger.disable();
await Protocol.Runtime.disable();
},
]);
......@@ -43,11 +43,11 @@ contextGroup.addScript(`
function test() {
instance.exports.main(1);
instance.exports.main(1);
}
//# sourceURL=test.js`);
}`, 0, 0, 'test.js');
InspectorTest.runAsyncTestSuite([
async function Test() {
await Protocol.Runtime.enable();
await Protocol.Debugger.enable();
InspectorTest.log('Calling instantiate function.');
WasmInspectorTest.instantiate(module_bytes);
......
......@@ -388,10 +388,10 @@ at (anonymous) (0:17):
-- skipped globals
Paused:
instance.exports.main(42)
instance.exports.main(42)#
Scope:
at (anonymous) (1:31):
at (anonymous) (0:25):
- scope (global):
-- skipped globals
......
......@@ -11,6 +11,7 @@ utils.load('test/inspector/wasm-inspector-test.js');
let {session, contextGroup, Protocol} = InspectorTest.start(
'Test retrieving scope information from compiled Liftoff frames');
session.setupScriptMap();
Protocol.Runtime.enable();
Protocol.Debugger.enable();
Protocol.Debugger.onPaused(printPauseLocationsAndContinue);
......
......@@ -30,6 +30,7 @@ builder.addFunction('main', kSig_v_i)
// clang-format on
var module_bytes = builder.toArray();
Protocol.Runtime.enable();
Protocol.Debugger.enable();
InspectorTest.runAsyncTestSuite([
......
......@@ -86,6 +86,7 @@ Protocol.Debugger.onPaused(async msg => {
InspectorTest.runAsyncTestSuite([
async function test() {
await Protocol.Runtime.enable();
await Protocol.Debugger.enable();
InspectorTest.log('Instantiating.');
// Spawn asynchronously:
......
......@@ -37,6 +37,7 @@ function instantiate(bytes, imports) {
InspectorTest.runAsyncTestSuite([
async function testPauseAndStep() {
await Protocol.Runtime.enable();
await Protocol.Debugger.enable();
InspectorTest.log('Instantiate');
const instantiate_code = `var instance = (${instantiate})(${JSON.stringify(module_bytes)}, {'imports': {'pause': () => { %ScheduleBreak() } }});`;
......
......@@ -33,6 +33,7 @@ Protocol.Debugger.onPaused(msg => {
InspectorTest.runAsyncTestSuite([
async function test() {
await Protocol.Runtime.enable();
await Protocol.Debugger.enable();
InspectorTest.log('Setting up global instance variable.');
WasmInspectorTest.instantiate(module_bytes);
......
......@@ -64,6 +64,7 @@ contextGroup.addScript(call_div.toString());
InspectorTest.runAsyncTestSuite([
async function test() {
await Protocol.Runtime.enable();
await Protocol.Debugger.enable();
await Protocol.Debugger.setPauseOnExceptions({state: 'all'});
InspectorTest.log('Instantiating.');
......
......@@ -26,6 +26,7 @@ InspectorTest.runAsyncTestSuite([
InspectorTest.logProtocolCommandCalls('Debugger.stepInto');
InspectorTest.logProtocolCommandCalls('Debugger.resume');
await Protocol.Runtime.enable();
await Protocol.Debugger.enable();
InspectorTest.log('Setting up global instance variable.');
WasmInspectorTest.instantiate(module_bytes);
......
......@@ -41,11 +41,11 @@ contextGroup.addScript(`
function test() {
debugger;
instance.exports.main(1);
}
//# sourceURL=test.js`);
}`, 0, 0, 'test.js');
InspectorTest.runAsyncTestSuite([
async function test() {
await Protocol.Runtime.enable();
await Protocol.Debugger.enable();
InspectorTest.log('Calling instantiate function.');
WasmInspectorTest.instantiate(module_bytes);
......
......@@ -23,6 +23,7 @@ Protocol.Debugger.onPaused(printPauseLocationAndStep);
InspectorTest.runAsyncTestSuite([
async function test() {
await Protocol.Runtime.enable();
await Protocol.Debugger.enable();
WasmInspectorTest.instantiate(module_bytes);
[, {params: {scriptId: wasm_script_id}}] = await Protocol.Debugger.onceScriptParsed(2);
......
......@@ -34,6 +34,7 @@ function pauseAlternating() {
InspectorTest.runAsyncTestSuite([
async function test() {
await Protocol.Runtime.enable();
await Protocol.Debugger.enable();
InspectorTest.log('Instantiating.');
const instantiate_code =
......
......@@ -58,11 +58,11 @@ function test() {
instance.exports.main();
var x = 1;
x++;
}
//# sourceURL=test.js`);
}`, 0, 0, 'test.js');
InspectorTest.runAsyncTestSuite([
async function test() {
await Protocol.Runtime.enable();
await Protocol.Debugger.enable();
InspectorTest.log('Calling instantiate function.');
WasmInspectorTest.instantiate(module_bytes);
......
......@@ -46,6 +46,7 @@ const func_a_end_offset = func_a_start_offset + 2;
InspectorTest.runAsyncTestSuite([
async function test() {
await Protocol.Runtime.enable();
await Protocol.Debugger.enable();
InspectorTest.log('Setting up global instance variable');
WasmInspectorTest.instantiate(module_bytes);
......
......@@ -41,6 +41,7 @@ InspectorTest.runAsyncTestSuite([
for (const action of ['stepInto', 'stepOver', 'stepOut', 'resume'])
InspectorTest.logProtocolCommandCalls('Debugger.' + action);
await Protocol.Runtime.enable();
await Protocol.Debugger.enable();
WasmInspectorTest.instantiate(module_bytes);
const [, {params: wasmScript}] = await Protocol.Debugger.onceScriptParsed(2);
......
......@@ -59,6 +59,7 @@ InspectorTest.runAsyncTestSuite([
for (const action of ['stepInto', 'stepOver', 'stepOut', 'resume'])
InspectorTest.logProtocolCommandCalls('Debugger.' + action);
await Protocol.Runtime.enable();
await Protocol.Debugger.enable();
InspectorTest.log('Setting up global instance variable.');
WasmInspectorTest.instantiate(module_bytes);
......
......@@ -7,9 +7,12 @@ utils.load('test/mjsunit/wasm/wasm-module-builder.js');
WasmInspectorTest = {}
InspectorTest.getWasmOpcodeName = getOpcodeName;
WasmInspectorTest.evalWithUrl = async function(code, url) {
WasmInspectorTest.evalWithUrl = async function(expression, url) {
const sourceURL = `v8://test/${url}`;
const {result: {scriptId}} = await Protocol.Runtime.compileScript({
expression, sourceURL, persistScript: true}).then(printIfFailure);
return await Protocol.Runtime
.evaluate({'expression': code + '\n//# sourceURL=v8://test/' + url})
.runScript({scriptId})
.then(printIfFailure);
};
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment