summaryrefslogtreecommitdiff
path: root/test/known_issues
diff options
context:
space:
mode:
authorRich Trott <rtrott@gmail.com>2021-07-27 19:10:42 -0700
committerNode.js GitHub Bot <github-bot@iojs.org>2021-08-01 13:09:47 +0000
commit7db86e7cceee3e1318f2c587c8d2307d0c81e989 (patch)
tree11af8130a7c0dd4e8feeb35639dccb9294a2e182 /test/known_issues
parent4d60ee8d1cbd6a74f690cbc65b87736374d635ac (diff)
downloadnode-new-7db86e7cceee3e1318f2c587c8d2307d0c81e989.tar.gz
test: add known issues test for debugger heap snapshot race
Refs: https://github.com/nodejs/node/issues/39555 PR-URL: https://github.com/nodejs/node/pull/39557 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Michaƫl Zasso <targos@protonmail.com>
Diffstat (limited to 'test/known_issues')
-rw-r--r--test/known_issues/test-debugger-takeHeapSnapshot-race.js48
1 files changed, 48 insertions, 0 deletions
diff --git a/test/known_issues/test-debugger-takeHeapSnapshot-race.js b/test/known_issues/test-debugger-takeHeapSnapshot-race.js
new file mode 100644
index 0000000000..c197413504
--- /dev/null
+++ b/test/known_issues/test-debugger-takeHeapSnapshot-race.js
@@ -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);
+}