v8/test/inspector/debugger/pause-on-oom.js
Dan Elphick c2efa4b795 [test] Make pause-on-oom run out of memory faster
Allocate memory more quickly so the test completes faster. (On the ARM
simulator tests with slow asserts and verify-heap, it was taking around
20 minutes).

Change-Id: I6b4d0a4788817c4f996a073cc3fdf8b69d11bc40
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1973731
Reviewed-by: Nico Hartmann <nicohartmann@chromium.org>
Commit-Queue: Dan Elphick <delphick@chromium.org>
Cr-Commit-Position: refs/heads/master@{#65495}
2019-12-18 11:45:58 +00:00

29 lines
879 B
JavaScript

// Copyright 2017 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.
// Flags: --max-old-space-size=16
let {session, contextGroup, Protocol} = InspectorTest.start('Check pause on OOM');
contextGroup.addScript(`
var arr = [];
var stop = false;
function generateGarbage() {
while(!stop) {
arr.push(new Array(1000));
}
}
//# sourceURL=test.js`, 10, 26);
Protocol.Debugger.onPaused((message) => {
InspectorTest.log(`reason: ${message.params.reason}`);
Protocol.Debugger.evaluateOnCallFrame({
callFrameId: message.params.callFrames[0].callFrameId,
expression: 'arr = []; stop = true;'
}).then(() => Protocol.Debugger.resume());
});
Protocol.Debugger.enable();
Protocol.Runtime.evaluate({ expression: 'generateGarbage()' })
.then(InspectorTest.completeTest);