Skip to content

Commit

Permalink
fix: ci error with node-v13.6.0 on windows (#46)
Browse files Browse the repository at this point in the history
Ref: nodejs/node#30556
PR-URL: https://github.com/hyj1991/xprofiler/pull/46
Reviewed-BY: hyj1991 <yeekwanvong@gmail.com>
  • Loading branch information
hyj1991 committed Jan 18, 2020
1 parent d0cf7c1 commit 24b6d15
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 5 deletions.
4 changes: 2 additions & 2 deletions lib/xctl.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,8 @@ async function createMessageConnection(pid, xprofilerPath, message) {

message = JSON.stringify(message);

/* istanbul ignore if */
if (!fs.existsSync(xprofilerPath)) {
/* istanbul ignore next */
if (os.platform() !== 'win32' && !fs.existsSync(xprofilerPath)) {
throw new Error(`进程 ${pid} 不存在或者没有启动 xprofiler 信令线程!`);
}

Expand Down
1 change: 0 additions & 1 deletion src/logger.cc
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ using v8::String;
uv_mutex_lock(&logger_mutex); \
type##_stream.open(filepath, std::ios::app); \
type##_stream << log; \
type##_stream.flush(); \
type##_stream.close(); \
uv_mutex_unlock(&logger_mutex);

Expand Down
19 changes: 17 additions & 2 deletions test/logbypass.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,21 @@ const getTestCases = require('./fixtures/logbypass.test');
const logdirBlocking = utils.createLogDir('log_bypass_blocking');
const logdirNonBlocking = utils.createLogDir('log_bypass_non_blocking');

// common cases
let cases = getTestCases('performance log correctly', logdirBlocking, logdirNonBlocking);

// libuv cases
const logdirBlockingForUv = utils.createLogDir('log_bypass_blocking_uv');
const logdirNonBlockingForUv = utils.createLogDir('log_bypass_non_blocking_uv');
const casesForLibuv = getTestCases('performance log correctly with XPROFILER_ENABLE_LOG_UV_HANDLES=NO',
logdirBlocking, logdirNonBlocking, { XPROFILER_ENABLE_LOG_UV_HANDLES: 'NO' },
logdirBlockingForUv, logdirNonBlockingForUv, { XPROFILER_ENABLE_LOG_UV_HANDLES: 'NO' },
{ uv: getTestCases.getUvRules(['active_handles']) });

// http cases
const logdirBlockingForHttp = utils.createLogDir('log_bypass_blocking_http');
const logdirNonBlockingForHttp = utils.createLogDir('log_bypass_non_blocking_http');
const casesForHttp = getTestCases('performance log correctly XPROFILER_PATCH_HTTP=YES',
logdirBlocking, logdirNonBlocking, { XPROFILER_PATCH_HTTP: 'YES' },
logdirBlockingForHttp, logdirNonBlockingForHttp, { XPROFILER_PATCH_HTTP: 'YES' },
{
http: {
live_http_request: /^\d+$/,
Expand All @@ -24,6 +33,8 @@ const casesForHttp = getTestCases('performance log correctly XPROFILER_PATCH_HT
http_rt: /^\d+.\d{2}$/
}
});

// compose cases
cases = cases.concat(casesForLibuv).concat(casesForHttp);

function parseLog(logType, content, patt, alinode) {
Expand Down Expand Up @@ -76,6 +87,10 @@ for (const testCase of cases) {
if (testCase.targets.indexOf(target) === testCase.targets.length - 1) {
utils.cleanDir(logdirBlocking);
utils.cleanDir(logdirNonBlocking);
utils.cleanDir(logdirBlockingForUv);
utils.cleanDir(logdirNonBlockingForUv);
utils.cleanDir(logdirBlockingForHttp);
utils.cleanDir(logdirNonBlockingForHttp);
}
}
});
Expand Down

0 comments on commit 24b6d15

Please sign in to comment.