-
-
Notifications
You must be signed in to change notification settings - Fork 35.4k
Expand file tree
/
Copy pathcommon.js
More file actions
24 lines (20 loc) · 926 Bytes
/
common.js
File metadata and controls
24 lines (20 loc) · 926 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
'use strict';
const common = require('../common.js');
const fs = require('node:fs');
const path = require('node:path');
// Cannot use test/ffi/ffi-test-common.js because it requires test/common
// (the test harness module). Construct the path directly.
const libraryPath = path.join(__dirname, '..', '..', 'test', 'ffi',
'fixture_library', 'build', common.buildType,
process.platform === 'win32' ? 'ffi_test_library.dll' :
process.platform === 'darwin' ? 'ffi_test_library.dylib' :
'ffi_test_library.so');
function ensureFixtureLibrary() {
if (!fs.existsSync(libraryPath)) {
throw new Error(
`Missing FFI fixture library: ${libraryPath}. ` +
'Build it with `tools/test.py test/ffi/test-ffi-calls.js` first.',
);
}
}
module.exports = { libraryPath, ensureFixtureLibrary };