build: remove native specs (#40190)

This commit is contained in:
Shelley Vohr 2023-10-12 20:51:59 +02:00 committed by GitHub
parent 3c31246343
commit 592a30aa0b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 7 additions and 87 deletions

View file

@ -1,3 +0,0 @@
[
"shell_browser_ui_unittests"
]

View file

@ -15,7 +15,6 @@ const fail = '✗'.red;
const args = require('minimist')(process.argv, {
string: ['runners', 'target', 'electronVersion'],
boolean: ['buildNativeTests'],
unknown: arg => unknownFlags.push(arg)
});
@ -35,8 +34,7 @@ const BASE = path.resolve(__dirname, '../..');
const NPX_CMD = process.platform === 'win32' ? 'npx.cmd' : 'npx';
const runners = new Map([
['main', { description: 'Main process specs', run: runMainProcessElectronTests }],
['native', { description: 'Native specs', run: runNativeElectronTests }]
['main', { description: 'Main process specs', run: runMainProcessElectronTests }]
]);
const specHashPath = path.resolve(__dirname, '../spec/.hash');
@ -183,57 +181,6 @@ async function runTestUsingElectron (specDir, testName) {
console.log(`${pass} Electron ${testName} process tests passed.`);
}
async function runNativeElectronTests () {
let testTargets = require('./native-test-targets.json');
const outDir = `out/${utils.getOutDir()}`;
// If native tests are being run, only one arg would be relevant
if (args.target && !testTargets.includes(args.target)) {
console.log(`${fail} ${args.target} must be a subset of [${[testTargets].join(', ')}]`);
process.exit(1);
}
// Optionally build all native test targets
if (args.buildNativeTests) {
for (const target of testTargets) {
const build = childProcess.spawnSync('ninja', ['-C', outDir, target], {
cwd: path.resolve(__dirname, '../..'),
stdio: 'inherit'
});
// Exit if test target failed to build
if (build.status !== 0) {
console.log(`${fail} ${target} failed to build.`);
process.exit(1);
}
}
}
// If a specific target was passed, only build and run that target
if (args.target) testTargets = [args.target];
// Run test targets
const failures = [];
for (const target of testTargets) {
console.info('\nRunning native test for target:', target);
const testRun = childProcess.spawnSync(`./${outDir}/${target}`, {
cwd: path.resolve(__dirname, '../..'),
stdio: 'inherit'
});
// Collect failures and log at end
if (testRun.status !== 0) failures.push({ target });
}
// Exit if any failures
if (failures.length > 0) {
console.log(`${fail} Electron native tests failed for the following targets: `, failures);
process.exit(1);
}
console.log(`${pass} Electron native tests passed.`);
}
async function runMainProcessElectronTests () {
await runTestUsingElectron('spec', 'main');
}