(callbackBody, message)
| 327 | } |
| 328 | |
| 329 | function assertInvalidCallbackBehaviorAborts(callbackBody, message) { |
| 330 | const { stderr, status, signal } = spawnSync(process.execPath, [ |
| 331 | '--experimental-ffi', |
| 332 | '-e', |
| 333 | `'use strict'; |
| 334 | const ffi = require('node:ffi'); |
| 335 | const { fixtureSymbols, libraryPath } = require(${JSON.stringify(require.resolve('./ffi-test-common'))}); |
| 336 | const { lib, functions } = ffi.dlopen(libraryPath, fixtureSymbols); |
| 337 | const callback = lib.registerCallback( |
| 338 | { arguments: ['i32'], return: 'i32' }, |
| 339 | () => { ${callbackBody} }, |
| 340 | ); |
| 341 | functions.call_int_callback(callback, 21);`, |
| 342 | ], { |
| 343 | encoding: 'utf8', |
| 344 | }); |
| 345 | |
| 346 | assert.ok(common.nodeProcessAborted(status, signal), |
| 347 | `status: ${status}, signal: ${signal} |
| 348 | stderr: ${stderr}`); |
| 349 | assert.ok(message.test(stderr), stderr); |
| 350 | } |
| 351 | |
| 352 | function assertCrossThreadCallbackAbort() { |
| 353 | const workerSource = ` |
no test coverage detected
searching dependent graphs…