Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fixup! fixup! test: log more information in debugger tests
- Loading branch information
1 parent
f8e6ee4
commit a3f66df
Showing
3 changed files
with
75 additions
and
2 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,26 @@ | ||
'use strict'; | ||
const dns = require('dns'); | ||
|
||
const { | ||
setDeserializeMainFunction | ||
} = require('v8').startupSnapshot; | ||
|
||
function query() { | ||
dns.resolve4('nodejs.org', (err, addresses) => { | ||
if (err) throw error; | ||
|
||
console.log(`addresses: ${JSON.stringify(addresses)}`); | ||
|
||
addresses.forEach((a) => { | ||
dns.reverse(a, (err, hostnames) => { | ||
if (err) throw error; | ||
|
||
console.log(`reverse for ${a}: ${JSON.stringify(hostnames)}`); | ||
}); | ||
}); | ||
}); | ||
} | ||
|
||
query(); | ||
|
||
setDeserializeMainFunction(query); |
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,49 @@ | ||
'use strict'; | ||
|
||
// This tests support for the dns module in snapshot. | ||
|
||
require('../common'); | ||
const assert = require('assert'); | ||
const { spawnSync } = require('child_process'); | ||
const tmpdir = require('../common/tmpdir'); | ||
const fixtures = require('../common/fixtures'); | ||
const path = require('path'); | ||
const fs = require('fs'); | ||
|
||
tmpdir.refresh(); | ||
const blobPath = path.join(tmpdir.path, 'snapshot.blob'); | ||
const entry = fixtures.path('snapshot', 'dns-local.js'); | ||
{ | ||
const child = spawnSync(process.execPath, [ | ||
'--snapshot-blob', | ||
blobPath, | ||
'--build-snapshot', | ||
entry, | ||
], { | ||
cwd: tmpdir.path | ||
}); | ||
if (child.status !== 0) { | ||
console.log(child.stderr.toString()); | ||
console.log(child.stdout.toString()); | ||
assert.strictEqual(child.status, 0); | ||
} | ||
const stats = fs.statSync(path.join(tmpdir.path, 'snapshot.blob')); | ||
assert(stats.isFile()); | ||
} | ||
|
||
{ | ||
const child = spawnSync(process.execPath, [ | ||
'--snapshot-blob', | ||
blobPath, | ||
], { | ||
cwd: tmpdir.path, | ||
env: { | ||
...process.env, | ||
} | ||
}); | ||
|
||
const stdout = child.stdout.toString().trim(); | ||
const file = fs.readFileSync(fixtures.path('x1024.txt'), 'utf8'); | ||
assert.strictEqual(stdout, file); | ||
assert.strictEqual(child.status, 0); | ||
} |
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