Skip to content

Commit

Permalink
test: improve debug output in trace-events test
Browse files Browse the repository at this point in the history
test-trace-events-fs-sync is swallowing useful information when it
fails. This change results in more information being displayed.

PR-URL: #21120
Reviewed-By: Anatoli Papirovski <apapirovski@mac.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Lance Ball <lball@redhat.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
  • Loading branch information
Trott authored and targos committed Jun 13, 2018
1 parent a4ad989 commit c400448
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions test/parallel/test-trace-events-fs-sync.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ const common = require('../common');
const assert = require('assert');
const cp = require('child_process');
const fs = require('fs');
const util = require('util');

if (!common.isMainThread)
common.skip('process.chdir is not available in Workers');
Expand Down Expand Up @@ -121,7 +122,8 @@ for (const tr in tests) {
const proc = cp.spawnSync(process.execPath,
[ '--trace-events-enabled',
'--trace-event-categories', 'node.fs.sync',
'-e', tests[tr] ]);
'-e', tests[tr] ],
{ encoding: 'utf8' });
// Some AIX versions don't support futimes or utimes, so skip.
if (common.isAIX && proc.status !== 0 && tr === 'fs.sync.futimes') {
continue;
Expand All @@ -131,7 +133,7 @@ for (const tr in tests) {
}

// Make sure the operation is successful.
assert.strictEqual(proc.status, 0, tr + ': ' + proc.stderr);
assert.strictEqual(proc.status, 0, `${tr}:\n${util.inspect(proc)}`);

// Confirm that trace log file is created.
assert(common.fileExists(traceFile));
Expand Down

0 comments on commit c400448

Please sign in to comment.