forked from nodejs/node
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
report: add
--report-exclude-network
option
New option `--report-exclude-network`, also available as `report.excludeNetwork`, enables the user to exclude networking interfaces in their diagnostic report. On some systems, this can cause the report to take minutes to generate so this option can be used to optimize that. Fixes: nodejs#46060 PR-URL: nodejs#51645
- Loading branch information
1 parent
68885d5
commit e114b4f
Showing
9 changed files
with
137 additions
and
10 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
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
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
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
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
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
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
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
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,41 @@ | ||
'use strict'; | ||
require('../common'); | ||
const assert = require('node:assert'); | ||
const { spawnSync } = require('node:child_process'); | ||
const tmpdir = require('../common/tmpdir'); | ||
const { describe, it, before } = require('node:test'); | ||
const fs = require('node:fs'); | ||
const helper = require('../common/report'); | ||
|
||
function validate(pid) { | ||
const reports = helper.findReports(pid, tmpdir.path); | ||
assert.strictEqual(reports.length, 1); | ||
let report = fs.readFileSync(reports[0], { encoding: 'utf8' }); | ||
report = JSON.parse(report); | ||
assert.strictEqual(report.header.networkInterfaces, undefined); | ||
fs.unlinkSync(reports[0]); | ||
} | ||
|
||
describe('report exclude network option', () => { | ||
before(() => { | ||
tmpdir.refresh(); | ||
process.report.directory = tmpdir.path; | ||
}); | ||
|
||
it('should be configurable with --report-exclude-network', () => { | ||
const args = ['--report-exclude-network', '-e', 'process.report.writeReport()']; | ||
const child = spawnSync(process.execPath, args, { cwd: tmpdir.path }); | ||
assert.strictEqual(child.status, 0); | ||
assert.strictEqual(child.signal, null); | ||
validate(child.pid); | ||
}); | ||
|
||
it('should be configurable with report.excludeNetwork', () => { | ||
process.report.excludeNetwork = true; | ||
process.report.writeReport(); | ||
validate(process.pid); | ||
|
||
const report = process.report.getReport(); | ||
assert.strictEqual(report.header.networkInterfaces, undefined); | ||
}); | ||
}); |