Skip to content

A fast 2D and 3D game engine — TypeScript SDK, C++/WebAssembly core, visual editor. Ship one project to web, desktop, WeChat MiniGames, playable ads, and native Android / iOS.

test(native): every example is started, on a device that was chosen

esengine256793ac0fc3
diff --git a/.github/workflows/native-smoke.yml b/.github/workflows/native-smoke.yml
index c36b0d839..fe8fac89f 100644
--- a/.github/workflows/native-smoke.yml
+++ b/.github/workflows/native-smoke.yml
@@ -1,31 +1,35 @@
name: Native smoke
-# Does a game packaged from the runtime templates actually start?
+# Do games packaged from the runtime templates actually start?
#
# `verify-template` reads what an archive carries, which is a weaker claim than it
# sounds: v0.36.0's Android template carried a host that ran, and every game made
-# from it still opened on a black screen. This packages a real example around the
-# template the same way the editor's Package dialog does, installs it on a
+# from it still opened on a black screen. This packages every example around the
+# template the same way the editor's Package dialog does, installs each on a
# simulator, and asks the two questions a completeness check cannot — did the boot
# record reach "ready", and is the frame more than one flat color.
#
+# Booting a device is minutes and each app is seconds, so one device runs many
+# examples and the SET is sharded across jobs. A job per example would spend its
+# whole budget starting emulators.
+#
# A simulator is not a phone. Real GPU drivers, real compressed textures, thermal
# throttling and memory pressure are all outside what this can see, and the two
# Android rendering bugs this project has actually shipped were of that kind. What
-# this catches is the layer under them: a template that cannot produce a launching
-# app at all.
+# this catches is the layer under them: templates that cannot produce a launching
+# app at all, on any device.
on:
workflow_dispatch:
inputs:
template-tag:
- description: "Release tag to take the templates from (blank = this run's own artifacts)."
+ description: "Release tag to take the templates from (blank = this run's own artifacts, or the latest release when run by hand)."
required: false
type: string
- example:
- description: 'Example project to package.'
+ examples:
+ description: 'Comma-separated example names, or blank for every one.'
required: false
- default: hello-world
+ default: ''
type: string
workflow_call:
inputs:
@@ -33,19 +37,33 @@ on:
required: false
default: ''
type: string
- example:
+ examples:
required: false
- default: hello-world
+ default: ''
type: string
permissions:
contents: read
+env:
+ # Pinned, because "whatever the runner listed first" is a device nobody chose:
+ # a runner image update would silently move the test to another phone. A name
+ # that stops existing fails loudly, listing what the image does have.
+ IOS_DEVICE: iPhone 17 Pro
+ # The action's default profile is 640x320 — enough to prove a launch, useless
+ # for looking at.
+ ANDROID_PROFILE: pixel_6
+ ANDROID_API: '34'
+
jobs:
android:
- name: Android emulator boot
+ name: Android ${{ matrix.shard }}/3
runs-on: ubuntu-latest
- timeout-minutes: 45
+ timeout-minutes: 60
+ strategy:
+ fail-fast: false
+ matrix:
+ shard: [0, 1, 2]
steps:
- uses: actions/checkout@v7
@@ -89,15 +107,9 @@ jobs:
mkdir -p template
unzip -q templates/*.zip -d template
- - name: Build the SDK the game is bundled against
+ - name: Build the SDK the games are bundled against
run: pnpm --filter ./sdk build
- - name: Package the example as a signed APK
- run: |
- node desktop/scripts/export-project.mjs "examples/${{ inputs.example }}" \
- --platform android --template template --out dist-android --json export.json
- echo "APK=$(node -p "require('./export.json').apkFile")" >> "$GITHUB_ENV"
-
# Without this the emulator falls back to software CPU emulation and the
# boot alone outlasts the job.
- name: Enable KVM
@@ -109,27 +121,35 @@ jobs:
# The host is Dawn on Vulkan (the manifest requires it), which on a runner
# with no GPU means the emulator's bundled SwiftShader Vulkan.
- - name: Boot it on an emulator
+ - name: Package and boot every example in this shard
uses: reactivecircus/android-emulator-runner@v2
with:
- api-level: 34
+ api-level: ${{ env.ANDROID_API }}
target: google_apis
arch: x86_64
+ profile: ${{ env.ANDROID_PROFILE }}
emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none -camera-front none
- script: node tools/verify-native-boot.mjs --platform android --apk "$APK"
+ script: >-
+ node tools/verify-native-boot.mjs --platform android --examples all
+ --shard ${{ matrix.shard }}/3
+ ${{ inputs.examples && format('--only {0}', inputs.examples) || '' }}
- - name: Keep the frame and the record
+ - name: Keep the frames and the records
if: always()
uses: actions/upload-artifact@v7
with:
- name: android-boot-${{ inputs.example }}
+ name: android-shots-${{ matrix.shard }}
path: build/native-boot
if-no-files-found: warn
ios:
- name: iOS simulator boot
+ name: iOS ${{ matrix.shard }}/3
runs-on: macos-latest
- timeout-minutes: 45
+ timeout-minutes: 60
+ strategy:
+ fail-fast: false
+ matrix:
+ shard: [0, 1, 2]
steps:
- uses: actions/checkout@v7
@@ -168,39 +188,21 @@ jobs:
mkdir -p template
unzip -q templates/*.zip -d template
- - name: Build the SDK the game is bundled against
+ - name: Build the SDK the games are bundled against
run: pnpm --filter ./sdk build
- - name: Write the Xcode project around the example
- run: |
- node desktop/scripts/export-project.mjs "examples/${{ inputs.example }}" \
- --platform ios --template template --out dist-ios --json export.json
- project=$(node -p "require('./export.json').xcodeProject")
- if [ "$project" = "undefined" ]; then
- echo "::error::the iOS export wrote no Xcode project — see the warnings above"
- exit 1
- fi
- echo "XCODEPROJ=$project" >> "$GITHUB_ENV"
- echo "SCHEME=$(basename "$project" .xcodeproj)" >> "$GITHUB_ENV"
-
# Simulator slices need no signing identity, which is the whole reason this
# can run on a hosted runner at all.
- - name: Build it for the simulator
- run: |
- xcodebuild -project "$XCODEPROJ" -scheme "$SCHEME" -configuration Release \
- -sdk iphonesimulator -destination 'generic/platform=iOS Simulator' \
- -derivedDataPath dd CODE_SIGNING_ALLOWED=NO build
- app=$(find dd/Build/Products -maxdepth 2 -name '*.app' | head -1)
- test -n "$app" || { echo "::error::xcodebuild produced no .app"; exit 1; }
- echo "APP=$app" >> "$GITHUB_ENV"
-
- - name: Boot it on a simulator
- run: node tools/verify-native-boot.mjs --platform ios --app "$APP"
+ - name: Package and boot every example in this shard
+ run: >-
+ node tools/verify-native-boot.mjs --platform ios --examples all
+ --device "$IOS_DEVICE" --shard ${{ matrix.shard }}/3
+ ${{ inputs.examples && format('--only {0}', inputs.examples) || '' }}
- - name: Keep the frame and the record
+ - name: Keep the frames and the records
if: always()
uses: actions/upload-artifact@v7
with:
- name: ios-boot-${{ inputs.example }}
+ name: ios-shots-${{ matrix.shard }}
path: build/native-boot
if-no-files-found: warn
diff --git a/tools/verify-native-boot.mjs b/tools/verify-native-boot.mjs
index 9c1bb3cf1..695ecbc1e 100644
--- a/tools/verify-native-boot.mjs
+++ b/tools/verify-native-boot.mjs
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: Apache-2.0
// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Team
/**
- * @file verify-native-boot.mjs — a packaged game starts, and draws.
+ * @file verify-native-boot.mjs — packaged games start, and draw.
*
* `verify-template` proves an archive carries its files. That is a weaker claim
* than it sounds: v0.36.0's Android template carried a host that ran, and every
@@ -9,7 +9,7 @@
* and "a player sees the game" sit the two failures nobody was checking — a
* launch that dies, and a launch that survives showing nothing.
*
- * So the app is installed on a simulator, started, and asked two questions:
+ * So an app is installed on a simulator, started, and asked two questions:
*
* 1. did the boot record reach `ready in` — the line the host writes only once
* the first frame is up, so its absence is where the launch stopped;
@@ -20,15 +20,21 @@
* `bootPhase`/`bootReady` write to the file only (BootLog.cpp), so grepping
* logcat for "ready" finds nothing and calls a dead app healthy.
*
- * node tools/verify-native-boot.mjs --platform android --apk <file>
* node tools/verify-native-boot.mjs --platform ios --app <bundle.app>
+ * node tools/verify-native-boot.mjs --platform android --examples all
+ * node tools/verify-native-boot.mjs --platform android --examples all --shard 1/3
+ *
+ * `--examples` packages each project the way the editor's Package dialog does and
+ * runs the same two questions against every one, on ONE booted device: booting is
+ * minutes and each app is seconds, so a device per example would spend the whole
+ * budget on emulators. Shard across jobs instead.
*
* Absent a device this FAILS rather than skipping, because its whole reason to
* exist is to be a gate. `--allow-skip` is for running it on a machine that may
* not have a simulator, and says so in the output when it takes that door.
*/
import { execFileSync, spawnSync } from 'node:child_process';
-import { existsSync, mkdirSync, writeFileSync } from 'node:fs';
+import { appendFileSync, existsSync, mkdirSync, readdirSync, rmSync, writeFileSync } from 'node:fs';
import path from 'node:path';
import { fileURLToPath } from 'node:url';
import { decodePng, distinctColors } from '../build-tools/utils/png.js';
@@ -38,8 +44,21 @@ const APP_ID = 'com.estella.game';
const LOG_NAME = 'estella-boot.log';
const READY = 'ready in';
+/**
+ * Examples that do not start or draw on a device yet, and why.
+ *
+ * An entry that PASSES fails this check too. A list nothing reconciles is where
+ * work goes to be forgotten: the point of naming a break is to notice when it is
+ * fixed, not to make the run green forever.
+ */
+const KNOWN_FAILURES = {};
+
function parseArgs(argv) {
- const opts = { platform: 'android', timeout: 120, minColors: 8, out: path.join(ROOT, 'build', 'native-boot') };
+ const opts = {
+ platform: 'android', timeout: 120, minColors: 8,
+ out: path.join(ROOT, 'build', 'native-boot'),
+ template: path.join(ROOT, 'template'),
+ };
for (let i = 0; i < argv.length; i++) {
const key = argv[i].replace(/^--/, '');
if (key === 'allow-skip') { opts.allowSkip = true; continue; }
@@ -61,28 +80,35 @@ const sleep = (ms) => new Promise((r) => { setTimeout(r, ms); });
function androidDriver(opts) {
const adb = process.env.ANDROID_HOME
? path.join(process.env.ANDROID_HOME, 'platform-tools', 'adb') : 'adb';
- const shell = (...a) => sh(adb, ['shell', ...a]);
const logFile = `/sdcard/Android/data/${APP_ID}/files/${LOG_NAME}`;
return {
name: 'android',
+ artifactFlag: 'apk',
available() {
const probe = trySh(adb, ['devices']);
if (probe.status !== 0) return null;
const devices = probe.stdout.split('\n').slice(1)
.filter((l) => /\tdevice$/.test(l.trim()));
- return devices.length ? devices[0].split('\t')[0] : null;
+ if (!devices.length) return null;
+ const serial = devices[0].split('\t')[0];
+ const model = trySh(adb, ['shell', 'getprop', 'ro.product.model']).stdout.trim();
+ const release = trySh(adb, ['shell', 'getprop', 'ro.build.version.release']).stdout.trim();
+ const size = trySh(adb, ['shell', 'wm', 'size']).stdout.trim().replace(/^.*:\s*/, '');
+ return `${serial} — ${model}, Android ${release}, ${size}`;
},
install(apk) {
trySh(adb, ['uninstall', APP_ID]);
- sh(adb, ['install', '-r', '-t', apk], { stdio: 'inherit' });
- // A record left by an earlier run would answer for this one.
+ sh(adb, ['install', '-r', '-t', apk]);
+ // A record left by an earlier app would answer for this one.
trySh(adb, ['shell', 'rm', '-f', logFile]);
trySh(adb, ['logcat', '-c']);
},
launch() {
- sh(adb, ['shell', 'am', 'start', '-W', '-n', `${APP_ID}/android.app.NativeActivity`],
- { stdio: 'inherit' });
+ sh(adb, ['shell', 'am', 'start', '-W', '-n', `${APP_ID}/android.app.NativeActivity`]);
+ },
+ stop() {
+ trySh(adb, ['shell', 'am', 'force-stop', APP_ID]);
},
readLog() {
const got = trySh(adb, ['shell', 'cat', logFile]);
@@ -97,6 +123,11 @@ function androidDriver(opts) {
['logcat (crashes)', trySh(adb, ['logcat', '-d', '-b', 'crash']).stdout],
];
},
+ /** Package an exported project into an installable app. */
+ build(exported) {
+ if (!exported.apkFile) throw new Error('the export wrote no APK');
+ return exported.apkFile;
+ },
};
}
@@ -107,25 +138,41 @@ function androidDriver(opts) {
function iosDriver(opts) {
let udid = null;
const simctl = (...a) => sh('xcrun', ['simctl', ...a]);
+ const derived = path.join(ROOT, 'build', 'smoke-derived');
return {
name: 'ios',
+ artifactFlag: 'app',
available() {
if (process.platform !== 'darwin') return null;
const probe = trySh('xcrun', ['simctl', 'list', 'devices', 'available', '--json']);
if (probe.status !== 0) return null;
const all = Object.values(JSON.parse(probe.stdout).devices).flat();
- const want = opts.device
- ? all.find((d) => d.name === opts.device)
- : all.find((d) => d.state === 'Booted' && /iPhone/.test(d.name))
- ?? all.find((d) => /iPhone/.test(d.name));
- if (!want) return null;
- udid = want.udid;
- if (want.state !== 'Booted') {
+ // A named device that is not there is a configuration error, not an
+ // absent simulator: fail saying what this runner actually has, rather
+ // than quietly testing a different phone than the one asked for.
+ if (opts.device) {
+ const want = all.find((d) => d.name === opts.device);
+ if (!want) {
+ throw new Error(`no simulator named "${opts.device}". This runner has:\n `
+ + all.map((d) => d.name).join('\n '));
+ }
+ udid = want.udid;
+ if (want.state !== 'Booted') {
+ simctl('boot', udid);
+ sh('xcrun', ['simctl', 'bootstatus', udid, '-b']);
+ }
+ return `${want.name} (${udid})`;
+ }
+ const any = all.find((d) => d.state === 'Booted' && /iPhone/.test(d.name))
+ ?? all.find((d) => /iPhone/.test(d.name));
+ if (!any) return null;
+ udid = any.udid;
+ if (any.state !== 'Booted') {
simctl('boot', udid);
sh('xcrun', ['simctl', 'bootstatus', udid, '-b']);
}
- return `${want.name} (${udid})`;
+ return `${any.name} (${udid}) — not pinned, whatever this runner listed first`;
},
install(app) {
trySh('xcrun', ['simctl', 'terminate', udid, APP_ID]);
@@ -135,12 +182,14 @@ function iosDriver(opts) {
launch() {
simctl('launch', udid, APP_ID);
},
+ stop() {
+ trySh('xcrun', ['simctl', 'terminate', udid, APP_ID]);
+ },
readLog() {
const container = trySh('xcrun', ['simctl', 'get_app_container', udid, APP_ID, 'data']);
if (container.status !== 0) return '';
const file = path.join(container.stdout.trim(), 'Documents', LOG_NAME);
- if (!existsSync(file)) return '';
- return sh('cat', [file]);
+ return existsSync(file) ? sh('cat', [file]) : '';
},
screenshot() {
const shot = path.join(opts.out, 'raw.png');
@@ -148,26 +197,115 @@ function iosDriver(opts) {
return sh('cat', [shot], { encoding: 'buffer' });
},
diagnostics() {
- const crash = trySh('xcrun', ['simctl', 'spawn', udid, 'log', 'show',
+ const log = trySh('xcrun', ['simctl', 'spawn', udid, 'log', 'show',
'--last', '3m', '--predicate', 'senderImagePath CONTAINS "Estella"']);
- return [['simulator log', crash.stdout]];
+ return [['simulator log', log.stdout]];
+ },
+ build(exported) {
+ if (!exported.xcodeProject) throw new Error('the export wrote no Xcode project');
+ const scheme = path.basename(exported.xcodeProject, '.xcodeproj');
+ sh('xcodebuild', [
+ '-project', exported.xcodeProject, '-scheme', scheme, '-configuration', 'Release',
+ '-sdk', 'iphonesimulator', '-destination', 'generic/platform=iOS Simulator',
+ '-derivedDataPath', derived, 'CODE_SIGNING_ALLOWED=NO', 'build',
+ ], { stdio: ['ignore', 'ignore', 'pipe'] });
+ const app = path.join(derived, 'Build', 'Products', 'Release-iphonesimulator', `${scheme}.app`);
+ if (!existsSync(app)) throw new Error(`xcodebuild produced no ${scheme}.app`);
+ return app;
},
};
}
+// =============================================================================
+// The two questions, asked of one installed app
// =============================================================================
-const opts = parseArgs(process.argv.slice(2));
-const driver = opts.platform === 'ios' ? iosDriver(opts) : androidDriver(opts);
-const artifact = opts.platform === 'ios' ? opts.app : opts.apk;
+async function verifyApp(driver, artifact, label, opts) {
+ driver.install(artifact);
+ driver.launch();
-if (!artifact || !existsSync(artifact)) {
- console.error(`✗ no ${opts.platform} app to verify (pass --${opts.platform === 'ios' ? 'app' : 'apk'} <path>)`);
- process.exit(2);
+ let log = '';
+ const deadline = Date.now() + opts.timeout * 1000;
+ while (Date.now() < deadline) {
+ log = driver.readLog();
+ if (log.includes(READY)) break;
+ await sleep(2000);
+ }
+
+ const frame = driver.screenshot();
+ const shot = path.join(opts.out, `${driver.name}-${label}.png`);
+ writeFileSync(shot, frame);
+ writeFileSync(path.join(opts.out, `${driver.name}-${label}.log`), log);
+ driver.stop();
+
+ const image = decodePng(frame);
+ const colors = distinctColors(image);
+ const ready = log.includes(READY);
+ const readyLine = log.split('\n').find((l) => l.includes(READY))?.trim() ?? '';
+ return {
+ ok: ready && colors >= opts.minColors,
+ ready,
+ colors,
+ readyLine,
+ size: `${image.width}x${image.height}`,
+ log,
+ shot,
+ why: !ready ? 'never reported ready' : (colors < opts.minColors ? `frame is ${colors} color(s)` : ''),
+ };
+}
+
+// =============================================================================
+// Packaging an example the way the Package dialog does
+// =============================================================================
+
+function listExamples(opts) {
+ const dir = path.join(ROOT, 'examples');
+ const all = opts.only
+ ? opts.only.split(',').map((s) => s.trim()).filter(Boolean)
+ : readdirSync(dir, { withFileTypes: true })
+ .filter((e) => e.isDirectory() && existsSync(path.join(dir, e.name, 'project.esproject')))
+ .map((e) => e.name)
+ .sort();
+ // Sharding applies to a named set too — the matrix runs every shard, so a
+ // list that ignored it would be packaged three times over.
+ if (!opts.shard) return all;
+ const [index, total] = opts.shard.split('/').map(Number);
+ return all.filter((_, i) => i % total === index);
+}
+
+function packageExample(driver, name, opts) {
+ const work = path.join(ROOT, 'build', 'smoke-work', name);
+ const report = path.join(work, 'export.json');
+ rmSync(work, { recursive: true, force: true });
+ mkdirSync(work, { recursive: true });
+ const out = sh(process.execPath, [
+ path.join(ROOT, 'desktop', 'scripts', 'export-project.mjs'),
+ path.join(ROOT, 'examples', name),
+ '--platform', driver.name,
+ '--template', opts.template,
+ '--out', path.join(work, 'dist'),
+ '--json', report,
+ ], { stdio: ['ignore', 'ignore', 'pipe'] });
+ void out;
+ if (!existsSync(report)) throw new Error('the export wrote no result');
+ const exported = JSON.parse(sh('cat', [report]));
+ if (!exported.ok) throw new Error(`export failed: ${(exported.errors ?? []).join('; ') || 'no reason given'}`);
+ return { app: driver.build(exported), work };
}
+
+// =============================================================================
+
+const opts = parseArgs(process.argv.slice(2));
+const driver = opts.platform === 'ios' ? iosDriver(opts) : androidDriver(opts);
mkdirSync(opts.out, { recursive: true });
-const device = driver.available();
+let device;
+try {
+ device = driver.available();
+} catch (err) {
+ console.error(`✗ ${err.message}`);
+ process.exit(1);
+}
if (!device) {
const what = `no ${driver.name} device or simulator is available`;
if (opts.allowSkip) {
@@ -177,45 +315,102 @@ if (!device) {
console.error(`✗ ${what}. This check is a gate; pass --allow-skip to run it where one may be absent.`);
process.exit(1);
}
+console.log(`device: ${device}\n`);
+
+const summary = [];
+const note = (line) => {
+ summary.push(line);
+ if (process.env.GITHUB_STEP_SUMMARY) appendFileSync(process.env.GITHUB_STEP_SUMMARY, `${line}\n`);
+};
-console.log(`device: ${device}`);
-console.log(`app: ${artifact}`);
-driver.install(artifact);
-driver.launch();
+// --- one prebuilt app -------------------------------------------------------
-let log = '';
-const deadline = Date.now() + opts.timeout * 1000;
-while (Date.now() < deadline) {
- log = driver.readLog();
- if (log.includes(READY)) break;
- await sleep(2000);
+if (!opts.examples) {
+ const artifact = opts[driver.artifactFlag];
+ if (!artifact || !existsSync(artifact)) {
+ console.error(`✗ no ${driver.name} app to verify (pass --${driver.artifactFlag} <path>)`);
+ process.exit(2);
+ }
+ const r = await verifyApp(driver, artifact, 'app', opts);
+ console.log(`boot record: ${r.ready ? r.readyLine : 'never reached "ready in"'}`);
+ console.log(`frame: ${r.size}, ${r.colors} distinct colors (need ${opts.minColors})`);
+ console.log(`written: ${r.shot}`);
+ if (r.ok) {
+ console.log(`\n✓ ${driver.name}: the packaged game started and drew a frame`);
+ process.exit(0);
+ }
+ console.error(`\n✗ ${driver.name}: ${r.why}`);
+ console.error('\n--- boot record ---');
+ console.error(r.log.trim() || '(empty — the app wrote no record at all)');
+ for (const [title, text] of driver.diagnostics()) {
+ if (!text?.trim()) continue;
+ console.error(`\n--- ${title} ---`);
+ console.error(text.trim().split('\n').slice(-60).join('\n'));
+ }
+ process.exit(1);
}
-const frame = driver.screenshot();
-const shotPath = path.join(opts.out, `${driver.name}-frame.png`);
-writeFileSync(shotPath, frame);
-writeFileSync(path.join(opts.out, `${driver.name}-boot.log`), log);
+// --- every example ----------------------------------------------------------
-const image = decodePng(frame);
-const colors = distinctColors(image);
-const ready = log.includes(READY);
-const drew = colors >= opts.minColors;
+const examples = listExamples(opts);
+if (!examples.length) {
+ console.error('✗ no examples selected');
+ process.exit(2);
+}
+console.log(`${examples.length} example(s)${opts.shard ? ` (shard ${opts.shard})` : ''}\n`);
-console.log(`\nboot record: ${ready ? log.trim().split('\n').filter((l) => l.includes(READY))[0] : 'never reached "ready in"'}`);
-console.log(`frame: ${image.width}x${image.height}, ${colors} distinct colors (need ${opts.minColors})`);
-console.log(`written: ${shotPath}`);
+const results = [];
+for (const name of examples) {
+ process.stdout.write(`${name.padEnd(24)} `);
+ let r;
+ try {
+ const { app, work } = packageExample(driver, name, opts);
+ r = await verifyApp(driver, app, name, opts);
+ // Each APK carries the whole runtime template; keeping 40 of them around
+ // is gigabytes for no reason.
+ rmSync(work, { recursive: true, force: true });
+ } catch (err) {
+ r = { ok: false, why: err.message.split('\n')[0], log: '', colors: 0, size: '-' };
+ }
+ results.push({ name, ...r });
+ console.log(r.ok ? `✓ ${r.colors} colors` : `✗ ${r.why}`);
+}
+
+const known = Object.keys(KNOWN_FAILURES);
+const brokeUnexpectedly = results.filter((r) => !r.ok && !KNOWN_FAILURES[r.name]);
+const fixedUnexpectedly = results.filter((r) => r.ok && KNOWN_FAILURES[r.name]);
+
+note(`### ${driver.name} — ${results.filter((r) => r.ok).length}/${results.length} examples started and drew`);
+note('');
+note(`Device: \`${device}\``);
+note('');
+note('| example | result | frame |');
+note('| --- | --- | --- |');
+for (const r of results) {
+ const state = r.ok ? '✓' : (KNOWN_FAILURES[r.name] ? `✗ known — ${KNOWN_FAILURES[r.name]}` : `✗ ${r.why}`);
+ note(`| ${r.name} | ${state} | ${r.ok ? `${r.size}, ${r.colors} colors` : '—'} |`);
+}
-if (ready && drew) {
- console.log(`\n✓ ${driver.name}: the packaged game started and drew a frame`);
- process.exit(0);
+if (known.length) {
+ console.log(`\n${known.length} example(s) are recorded as already broken:`);
+ for (const name of known) console.log(` ${name} — ${KNOWN_FAILURES[name]}`);
}
-console.error(`\n✗ ${driver.name}: ${!ready ? 'the launch never reported ready' : 'the launch reported ready but the frame is blank'}`);
-console.error('\n--- boot record ---');
-console.error(log.trim() || '(empty — the app wrote no record at all)');
-for (const [title, text] of driver.diagnostics()) {
- if (!text?.trim()) continue;
- console.error(`\n--- ${title} ---`);
- console.error(text.trim().split('\n').slice(-60).join('\n'));
+for (const r of brokeUnexpectedly) {
+ console.error(`\n✗ ${r.name}: ${r.why}`);
+ console.error((r.log || '').trim() || '(no boot record)');
}
-process.exit(1);
+for (const r of fixedUnexpectedly) {
+ console.error(`\n✗ ${r.name} now starts and draws, but is still on the known-failure list — remove it.`);
+}
+
+if (brokeUnexpectedly.length || fixedUnexpectedly.length) {
+ for (const [title, text] of driver.diagnostics()) {
+ if (!text?.trim()) continue;
+ console.error(`\n--- ${title} ---`);
+ console.error(text.trim().split('\n').slice(-80).join('\n'));
+ }
+ process.exit(1);
+}
+
+console.log(`\n✓ ${driver.name}: ${results.filter((r) => r.ok).length}/${results.length} examples started and drew a frame`);