-
Notifications
You must be signed in to change notification settings - Fork 29.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: add known issues test for debugger heap snapshot race
Refs: #39555 PR-URL: #39557 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Michaël Zasso <targos@protonmail.com>
- Loading branch information
1 parent
4d60ee8
commit 7db86e7
Showing
1 changed file
with
48 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
'use strict'; | ||
const common = require('../common'); | ||
|
||
// Refs: https://github.com/nodejs/node/issues/39555 | ||
|
||
// After this issue is fixed, this can perhaps be integrated into | ||
// test/sequential/test-debugger-heap-profiler.js as it shares almost all | ||
// the same code. | ||
|
||
// These skips should be uncommented once the issue is fixed. | ||
// common.skipIfInspectorDisabled(); | ||
|
||
// if (!common.isMainThread) { | ||
// common.skip('process.chdir() is not available in workers'); | ||
// } | ||
|
||
// This assert.fail() can be removed once the issue is fixed. | ||
if (!common.hasCrypto || !process.features.inspector) { | ||
require('assert').fail('crypto is not available'); | ||
} | ||
|
||
const fixtures = require('../common/fixtures'); | ||
const startCLI = require('../common/debugger'); | ||
const tmpdir = require('../common/tmpdir'); | ||
|
||
tmpdir.refresh(); | ||
process.chdir(tmpdir.path); | ||
|
||
const { readFileSync } = require('fs'); | ||
|
||
const filename = 'node.heapsnapshot'; | ||
|
||
// Check that two simultaneous snapshots don't step all over each other. | ||
{ | ||
const cli = startCLI([fixtures.path('debugger/empty.js')]); | ||
|
||
function onFatal(error) { | ||
cli.quit(); | ||
throw error; | ||
} | ||
|
||
return cli.waitForInitialBreak() | ||
.then(() => cli.waitForPrompt()) | ||
.then(() => cli.command('takeHeapSnapshot(); takeHeapSnapshot()')) | ||
.then(() => JSON.parse(readFileSync(filename, 'utf8'))) | ||
.then(() => cli.quit()) | ||
.then(null, onFatal); | ||
} |