| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent efe71e9 commit e684382
3 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -6,6 +6,7 @@ const fs = require('fs'); | |||
| 6 | 6 | const path = require('path'); | |
| 7 | 7 | const cp = require('child_process'); | |
| 8 | 8 | const { Worker } = require('worker_threads'); | |
| 9 | + const { spawnSync } = require('child_process'); | ||
| 9 | 10 | ||
| 10 | 11 | // This is a sibling test to test/addons/uv-handle-leak. | |
| 11 | 12 | ||
@@ -49,9 +50,25 @@ if (process.argv[2] === 'child') { | |||
| 49 | 50 | // Close callback: 0x7f2df31de220 CloseCallback(uv_handle_s*) [...] | |
| 50 | 51 | // Data: 0x42 | |
| 51 | 52 | ||
| 53 | + function isGlibc() { | ||
| 54 | + try { | ||
| 55 | + const lddOut = spawnSync('ldd', [process.execPath]).stdout; | ||
| 56 | + const libcInfo = lddOut.toString().split('\n').map( | ||
| 57 | + (line) => line.match(/libc\.so.+=>\s*(\S+)\s/)).filter((info) => info); | ||
| 58 | + if (libcInfo.length === 0) | ||
| 59 | + return false; | ||
| 60 | + const nmOut = spawnSync('nm', ['-D', libcInfo[0][1]]).stdout; | ||
| 61 | + if (/gnu_get_libc_version/.test(nmOut)) | ||
| 62 | + return true; | ||
| 63 | + } catch { | ||
| 64 | + return false; | ||
| 65 | + } | ||
| 66 | + } | ||
| 67 | + | ||
| 68 | + | ||
| 52 | 69 | if (!(common.isFreeBSD || | |
| 53 | 70 | common.isAIX || | |
| 54 | - (common.isLinux && !common.isGlibc()) || | ||
| 71 | + (common.isLinux && !isGlibc()) || | ||
| 55 | 72 | common.isWindows)) { | |
| 56 | 73 | assert(stderr.includes('ExampleOwnerClass'), stderr); | |
| 57 | 74 | assert(stderr.includes('CloseCallback'), stderr); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -67,23 +67,6 @@ exports.isOpenBSD = process.platform === 'openbsd'; | |||
| 67 | 67 | exports.isLinux = process.platform === 'linux'; | |
| 68 | 68 | exports.isOSX = process.platform === 'darwin'; | |
| 69 | 69 | ||
| 70 | - let isGlibc; | ||
| 71 | - exports.isGlibc = () => { | ||
| 72 | - if (isGlibc !== undefined) | ||
| 73 | - return isGlibc; | ||
| 74 | - try { | ||
| 75 | - const lddOut = spawnSync('ldd', [process.execPath]).stdout; | ||
| 76 | - const libcInfo = lddOut.toString().split('\n').map( | ||
| 77 | - (line) => line.match(/libc\.so.+=>\s*(\S+)\s/)).filter((info) => info); | ||
| 78 | - if (libcInfo.length === 0) | ||
| 79 | - return isGlibc = false; | ||
| 80 | - const nmOut = spawnSync('nm', ['-D', libcInfo[0][1]]).stdout; | ||
| 81 | - if (/gnu_get_libc_version/.test(nmOut)) | ||
| 82 | - return isGlibc = true; | ||
| 83 | - } catch {} | ||
| 84 | - return isGlibc = false; | ||
| 85 | - }; | ||
| 86 | - | ||
| 87 | 70 | exports.enoughTestMem = os.totalmem() > 0x70000000; /* 1.75 Gb */ | |
| 88 | 71 | const cpus = os.cpus(); | |
| 89 | 72 | exports.enoughTestCpu = Array.isArray(cpus) && | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -13,7 +13,6 @@ const { | |||
| 13 | 13 | isOpenBSD, | |
| 14 | 14 | isLinux, | |
| 15 | 15 | isOSX, | |
| 16 | - isGlibc, | ||
| 17 | 16 | enoughTestMem, | |
| 18 | 17 | enoughTestCpu, | |
| 19 | 18 | rootDir, | |
@@ -71,7 +70,6 @@ export { | |||
| 71 | 70 | isOpenBSD, | |
| 72 | 71 | isLinux, | |
| 73 | 72 | isOSX, | |
| 74 | - isGlibc, | ||
| 75 | 73 | enoughTestMem, | |
| 76 | 74 | enoughTestCpu, | |
| 77 | 75 | rootDir, | |
| Back | FazBrowse Home | New Git URL |
0 commit comments