report: print common items first for readability
PR-URL: https://github.com/nodejs/node/pull/27367 Reviewed-By: Richard Lau <riclau@uk.ibm.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Yongsheng Zhang <zyszys98@gmail.com>
This commit is contained in:
parent
31ac8b9080
commit
38f3526f27
@ -190,13 +190,13 @@ is provided below for reference.
|
||||
"details": ""
|
||||
},
|
||||
{
|
||||
"repeat": 0,
|
||||
"firesInMsFromNow": 94403548320796,
|
||||
"expired": true,
|
||||
"type": "timer",
|
||||
"is_active": false,
|
||||
"is_referenced": false,
|
||||
"address": "0x00007fff5fbfeab0"
|
||||
"address": "0x00007fff5fbfeab0",
|
||||
"repeat": 0,
|
||||
"firesInMsFromNow": 94403548320796,
|
||||
"expired": true
|
||||
},
|
||||
{
|
||||
"type": "check",
|
||||
@ -229,36 +229,36 @@ is provided below for reference.
|
||||
"address": "0x000000010188f2e0"
|
||||
},
|
||||
{
|
||||
"type": "tty",
|
||||
"is_active": false,
|
||||
"is_referenced": true,
|
||||
"address": "0x000055b581db0e18",
|
||||
"width": 204,
|
||||
"height": 55,
|
||||
"fd": 17,
|
||||
"writeQueueSize": 0,
|
||||
"readable": true,
|
||||
"writable": true,
|
||||
"type": "tty",
|
||||
"is_active": false,
|
||||
"is_referenced": true,
|
||||
"address": "0x000055b581db0e18"
|
||||
"writable": true
|
||||
},
|
||||
{
|
||||
"signum": 28,
|
||||
"signal": "SIGWINCH",
|
||||
"type": "signal",
|
||||
"is_active": true,
|
||||
"is_referenced": false,
|
||||
"address": "0x000055b581d80010"
|
||||
"address": "0x000055b581d80010",
|
||||
"signum": 28,
|
||||
"signal": "SIGWINCH"
|
||||
},
|
||||
{
|
||||
"type": "tty",
|
||||
"is_active": true,
|
||||
"is_referenced": true,
|
||||
"address": "0x000055b581df59f8",
|
||||
"width": 204,
|
||||
"height": 55,
|
||||
"fd": 19,
|
||||
"writeQueueSize": 0,
|
||||
"readable": true,
|
||||
"writable": true,
|
||||
"type": "tty",
|
||||
"is_active": true,
|
||||
"is_referenced": true,
|
||||
"address": "0x000055b581df59f8"
|
||||
"writable": true
|
||||
},
|
||||
{
|
||||
"type": "loop",
|
||||
|
@ -126,6 +126,11 @@ void WalkHandle(uv_handle_t* h, void* arg) {
|
||||
uv_any_handle* handle = reinterpret_cast<uv_any_handle*>(h);
|
||||
|
||||
writer->json_start();
|
||||
writer->json_keyvalue("type", type);
|
||||
writer->json_keyvalue("is_active", static_cast<bool>(uv_is_active(h)));
|
||||
writer->json_keyvalue("is_referenced", static_cast<bool>(uv_has_ref(h)));
|
||||
writer->json_keyvalue("address",
|
||||
ValueToHexString(reinterpret_cast<uint64_t>(h)));
|
||||
|
||||
switch (h->type) {
|
||||
case UV_FS_EVENT:
|
||||
@ -216,11 +221,6 @@ void WalkHandle(uv_handle_t* h, void* arg) {
|
||||
static_cast<bool>(uv_is_writable(&handle->stream)));
|
||||
}
|
||||
|
||||
writer->json_keyvalue("type", type);
|
||||
writer->json_keyvalue("is_active", static_cast<bool>(uv_is_active(h)));
|
||||
writer->json_keyvalue("is_referenced", static_cast<bool>(uv_has_ref(h)));
|
||||
writer->json_keyvalue("address",
|
||||
ValueToHexString(reinterpret_cast<uint64_t>(h)));
|
||||
writer->json_end();
|
||||
}
|
||||
|
||||
|
@ -97,6 +97,22 @@ if (process.argv[2] === 'child') {
|
||||
const reports = helper.findReports(child.pid, tmpdir.path);
|
||||
assert.deepStrictEqual(reports, [], report_msg, reports);
|
||||
|
||||
// Test libuv handle key order
|
||||
{
|
||||
const get_libuv = /"libuv":\s\[([\s\S]*?)\]/gm;
|
||||
const get_handle_inner = /{([\s\S]*?),*?}/gm;
|
||||
const libuv_handles_str = get_libuv.exec(stdout)[1];
|
||||
const libuv_handles_array = libuv_handles_str.match(get_handle_inner);
|
||||
for (const i of libuv_handles_array) {
|
||||
// Exclude nested structure
|
||||
if (i.includes('type')) {
|
||||
const handle_keys = i.match(/(".*"):/gm);
|
||||
assert(handle_keys[0], 'type');
|
||||
assert(handle_keys[1], 'is_active');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const report = JSON.parse(stdout);
|
||||
const prefix = common.isWindows ? '\\\\?\\' : '';
|
||||
const expected_filename = `${prefix}${__filename}`;
|
||||
|
Loading…
x
Reference in New Issue
Block a user