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): say which frames this instrument cannot judge, instead of guessing

esenginea004a520d673
diff --git a/tools/verify-native-boot.mjs b/tools/verify-native-boot.mjs
index 576f3542e..73c1f110e 100644
--- a/tools/verify-native-boot.mjs
+++ b/tools/verify-native-boot.mjs
@@ -53,6 +53,20 @@ const READY = 'ready in';
*/
const KNOWN_FAILURES = {};
+/**
+ * Examples whose FRAME one capture cannot judge, and why.
+ *
+ * They are still installed, still have to reach `ready`, and still have to record
+ * no error — only "is it more than one flat color" is skipped, because for these
+ * the honest answer changes from run to run and a gate that flips with it teaches
+ * everyone to ignore it. Listing one here is an admission that this instrument is
+ * too blunt for it, not a claim that the example is broken; the deterministic
+ * capture that would settle it is the next piece of work, not a smaller number.
+ */
+const FRAME_NOT_JUDGED = {
+ cutscene: 'a timeline that is legitimately dark when the frame is taken (4 colors on iOS, 1 on Android)',
+};
+
function parseArgs(argv) {
const opts = {
platform: 'android', timeout: 120, settle: 3,
@@ -275,7 +289,7 @@ function iosDriver(opts) {
// The two questions, asked of one installed app
// =============================================================================
-async function verifyApp(driver, artifact, label, opts) {
+async function verifyApp(driver, artifact, label, opts, judgeFrame = true) {
driver.install(artifact);
let log = '';
@@ -318,7 +332,7 @@ async function verifyApp(driver, artifact, label, opts) {
const why = !ready ? 'never reported ready'
: offScreen ? `the game was not on screen — ${offScreen}`
: errors.length ? errors[0].trim()
- : colors < opts.minColors ? `the frame is ${colors} flat color` : '';
+ : (judgeFrame && colors < opts.minColors) ? `the frame is ${colors} flat color` : '';
return {
ok: !why, ready, colors, readyLine, errors, offScreen,
@@ -442,7 +456,7 @@ for (const name of examples) {
let r;
try {
const { app, work } = packageExample(driver, name, opts);
- r = await verifyApp(driver, app, name, opts);
+ r = await verifyApp(driver, app, name, opts, !FRAME_NOT_JUDGED[name]);
// Each APK carries the whole runtime template; keeping 40 of them around
// is gigabytes for no reason.
rmSync(work, { recursive: true, force: true });
@@ -450,7 +464,8 @@ for (const name of examples) {
r = { ok: false, why: err.message, log: '', colors: 0, size: '-' };
}
results.push({ name, ...r });
- console.log(`[smoke] ${name.padEnd(22)} ${r.ok ? `✓ ${r.size}, ${r.colors} colors` : `✗ ${r.why.split('\n')[0]}`}`);
+ const frameNote = FRAME_NOT_JUDGED[name] ? ' (frame not judged)' : '';
+ console.log(`[smoke] ${name.padEnd(22)} ${r.ok ? `✓ ${r.size}, ${r.colors} colors${frameNote}` : `✗ ${r.why.split('\n')[0]}`}`);
}
const known = Object.keys(KNOWN_FAILURES);
@@ -469,10 +484,17 @@ for (const r of results) {
note(`| ${r.name} | ${state} | ${r.ok ? `${r.size}, ${r.colors} colors` : '—'} |`);
}
+// Printed rather than silently applied: a list nobody sees is a list nobody
+// shortens.
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]}`);
}
+const unjudged = Object.keys(FRAME_NOT_JUDGED).filter((n) => examples.includes(n));
+if (unjudged.length) {
+ console.log(`\n${unjudged.length} example(s) launched but had their frame taken on trust:`);
+ for (const name of unjudged) console.log(` ${name} — ${FRAME_NOT_JUDGED[name]}`);
+}
for (const r of brokeUnexpectedly) {
console.error(`\n✗ ${r.name}: ${r.why}`);