| 76 | } |
| 77 | |
| 78 | function test (bindingPath, processShouldAbort) { |
| 79 | const numberOfTestCases = 5; |
| 80 | |
| 81 | for (let i = 0; i < numberOfTestCases; ++i) { |
| 82 | const childProcess = require('./napi_child').spawnSync( |
| 83 | process.execPath, |
| 84 | [ |
| 85 | __filename, |
| 86 | 'runInChildProcess', |
| 87 | bindingPath, |
| 88 | i |
| 89 | ] |
| 90 | ); |
| 91 | |
| 92 | if (processShouldAbort) { |
| 93 | assert(childProcess.status !== 0, `Test case ${bindingPath} ${i} failed: Process exited with status code 0.`); |
| 94 | } else { |
| 95 | assert(childProcess.status === 0, `Test case ${bindingPath} ${i} failed: Process status ${childProcess.status} is non-zero`); |
| 96 | } |
| 97 | } |
| 98 | } |
| 99 | } |