test: add tests for electron fuses (#42129)

* spec: add tests for electron fuses

* spec: fix tests for windows

* spec: handle weird crash codes on win32

* spec: disable fuse tests on arm64 windows
This commit is contained in:
Samuel Attard 2024-05-13 10:48:26 -07:00 committed by GitHub
parent c56e1dffb0
commit e19754d7fd
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 1080 additions and 38 deletions

View file

@ -1,6 +1,5 @@
import * as cp from 'node:child_process';
import * as fs from 'fs-extra';
import * as os from 'node:os';
import * as path from 'node:path';
import { expect } from 'chai';
@ -32,7 +31,7 @@ export function getCodesignIdentity () {
return identity;
}
export async function copyApp (newDir: string, fixture: string | null = 'initial') {
export async function copyMacOSFixtureApp (newDir: string, fixture: string | null = 'initial') {
const appBundlePath = path.resolve(process.execPath, '../../..');
const newPath = path.resolve(newDir, 'Electron.app');
cp.spawnSync('cp', ['-R', appBundlePath, path.dirname(newPath)]);
@ -86,14 +85,3 @@ export function spawn (cmd: string, args: string[], opts: any = {}) {
export function signApp (appPath: string, identity: string) {
return spawn('codesign', ['-s', identity, '--deep', '--force', appPath]);
};
export async function withTempDirectory (fn: (dir: string) => Promise<void>, autoCleanUp = true) {
const dir = await fs.mkdtemp(path.resolve(os.tmpdir(), 'electron-update-spec-'));
try {
await fn(dir);
} finally {
if (autoCleanUp) {
cp.spawnSync('rm', ['-r', dir]);
}
}
};