Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: tmpdir include build id #41734

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions test/common/tmpdir.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ const testRoot = process.env.NODE_TEST_DIR ?
// Using a `.` prefixed name, which is the convention for "hidden" on POSIX,
// gets tools to ignore it by default or by simple rules, especially eslint.
const tmpdirName = '.tmp.' +
(process.env.BUILD_ID || process.pid + '.') +
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Going to check this gets passed - my understanding in test.py is that the os environment variables are copied and accessible.

(process.env.TEST_SERIAL_ID || process.env.TEST_THREAD_ID || '0');
const tmpPath = path.join(testRoot, tmpdirName);

Expand Down
38 changes: 0 additions & 38 deletions test/sequential/test-debugger-heap-profiler.js

This file was deleted.

36 changes: 36 additions & 0 deletions test/sequential/test-debugger-heap-profiler.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import { skipIfInspectorDisabled } from '../common/index.mjs';
import { createRequire } from 'module';
import path from 'path';

const require = createRequire(import.meta.url);
const fixtures = require('../common/fixtures');
const startCLI = require('../common/debugger');
const tmpdir = require('../common/tmpdir');

skipIfInspectorDisabled();

tmpdir.refresh();

const { readFileSync } = require('fs');

const filename = path.join(tmpdir.path, 'node.heapsnapshot');

// Heap profiler take snapshot.
const opts = { cwd: tmpdir.path };
const cli = startCLI([fixtures.path('debugger/empty.js')], [], opts);

try {
// Check that the snapshot is valid JSON.
await cli.waitForInitialBreak();
await cli.waitForPrompt();
await cli.command('takeHeapSnapshot()');
await JSON.parse(readFileSync(filename, 'utf8'));
// Check that two simultaneous snapshots don't step all over each other.
// Refs: https://github.com/nodejs/node/issues/39555
await cli.command('takeHeapSnapshot(); takeHeapSnapshot()');
await JSON.parse(readFileSync(filename, 'utf8'));
await cli.quit();
} catch (e) {
cli.quit();
throw e;
}