Skip to content

Commit fbb51b9

Browse files
richardlauaddaleax
authored andcommittedMar 30, 2020
test: check bundled binaries are signed on macOS
For notarization on macOS all packaged binaries must be signed. Add a regression test to check that known binaries from our dependencies (at the time of this commit term-size via npm) are signed. Signed-off-by: Richard Lau <[email protected]> PR-URL: #32522 Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Anna Henningsen <[email protected]>
1 parent 36c6d22 commit fbb51b9

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed
 
+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
'use strict';
2+
3+
// Notarization on macOS requires all binaries to be signed.
4+
// We sign our own binaries but check here if any binaries from our dependencies
5+
// (e.g. npm) are signed.
6+
const common = require('../common');
7+
8+
if (!common.isOSX) {
9+
common.skip('macOS specific test');
10+
}
11+
12+
const assert = require('assert');
13+
const { spawnSync } = require('child_process');
14+
const path = require('path');
15+
16+
const debuglog = require('util').debuglog('test');
17+
18+
const binaries = [
19+
'deps/npm/node_modules/term-size/vendor/macos/term-size',
20+
];
21+
22+
for (const testbin of binaries) {
23+
const bin = path.resolve(__dirname, '..', '..', testbin);
24+
debuglog(`Checking ${bin}`);
25+
const cp = spawnSync('codesign', [ '-vvvv', bin ], { encoding: 'utf8' });
26+
debuglog(cp.stdout);
27+
debuglog(cp.stderr);
28+
assert.strictEqual(cp.signal, null);
29+
assert.strictEqual(cp.status, 0, `${bin} does not appear to be signed.\n` +
30+
`${cp.stdout}\n${cp.stderr}`);
31+
}

0 commit comments

Comments
 (0)
Please sign in to comment.