diff options
author | James M Snell <jasnell@gmail.com> | 2018-08-21 13:04:02 -0700 |
---|---|---|
committer | James M Snell <jasnell@gmail.com> | 2018-08-23 16:14:44 -0700 |
commit | 2d64a51270f20e47de663fd45326a93dda1694e4 (patch) | |
tree | f252f23200b22ebcc3cf34a660bc2b493c17c0d0 /test/abort | |
parent | 3ba54e4cc844f3c7ba62ad8622e709fc51f0b6bf (diff) | |
download | android-node-v8-2d64a51270f20e47de663fd45326a93dda1694e4.tar.gz android-node-v8-2d64a51270f20e47de663fd45326a93dda1694e4.tar.bz2 android-node-v8-2d64a51270f20e47de663fd45326a93dda1694e4.zip |
test: remove isGlibc from common
The `common.isGlibc()` function is called exactly once from only
one test. There's no reason for it to be in `require('../common')`
at the current time. If it ends up needing to be used by multiple
tests, it can easily be moved into it's own common sub-module
(e.g. `require('../common/isglibc')` ... for now tho, just move
it into the one test that uses it and simplify the implementation
a bit to remove unnecessary caching.
PR-URL: https://github.com/nodejs/node/pull/22443
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Diffstat (limited to 'test/abort')
-rw-r--r-- | test/abort/test-addon-uv-handle-leak.js | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/test/abort/test-addon-uv-handle-leak.js b/test/abort/test-addon-uv-handle-leak.js index 3944cb79c7..96608f8dda 100644 --- a/test/abort/test-addon-uv-handle-leak.js +++ b/test/abort/test-addon-uv-handle-leak.js @@ -6,6 +6,7 @@ const fs = require('fs'); const path = require('path'); const cp = require('child_process'); const { Worker } = require('worker_threads'); +const { spawnSync } = require('child_process'); // This is a sibling test to test/addons/uv-handle-leak. @@ -49,9 +50,25 @@ if (process.argv[2] === 'child') { // Close callback: 0x7f2df31de220 CloseCallback(uv_handle_s*) [...] // Data: 0x42 + function isGlibc() { + try { + const lddOut = spawnSync('ldd', [process.execPath]).stdout; + const libcInfo = lddOut.toString().split('\n').map( + (line) => line.match(/libc\.so.+=>\s*(\S+)\s/)).filter((info) => info); + if (libcInfo.length === 0) + return false; + const nmOut = spawnSync('nm', ['-D', libcInfo[0][1]]).stdout; + if (/gnu_get_libc_version/.test(nmOut)) + return true; + } catch { + return false; + } + } + + if (!(common.isFreeBSD || common.isAIX || - (common.isLinux && !common.isGlibc()) || + (common.isLinux && !isGlibc()) || common.isWindows)) { assert(stderr.includes('ExampleOwnerClass'), stderr); assert(stderr.includes('CloseCallback'), stderr); |