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.
TypeScript 2d-game-engine3d3d-game-engineandroidcppecsgame-editorgame-enginegamedeviostypescriptwebassemblywebglwebgpuwechat-minigame
fix(smoke): a picture with content is an answer, whatever frame it stopped at
esengine1e894bb19013
diff --git a/tools/lib/smokeRetry.mjs b/tools/lib/smokeRetry.mjsindex bbdb26010..a5e5b0b8b 100644--- a/tools/lib/smokeRetry.mjs+++ b/tools/lib/smokeRetry.mjs@@ -43,6 +43,20 @@ export function worthAnotherLaunch(r) {return !r.ok && FLAT_FRAME.test(r.why ?? '');}+/**+ * Why this run judged nothing, or null if it judged something.+ *+ * Short of the asked-for frame the capture may still be racing the game, but only+ * over an EMPTY one: content is the game having drawn, at whatever frame it+ * stopped (lighting-2d: 10 frames in 90s, 1322 colours in the first).+ *+ * @param {{countColors: boolean, frames: number, wanted: number, colors: number, minColors: number}} run+ */+export function unjudgedReason({ countColors, frames, wanted, colors, minColors }) {+ if (!countColors || frames === 0 || frames >= wanted || colors >= minColors) return null;+ return `too slow to judge here — ${frames} frame(s) before the capture`;+}+/*** Pass, fail, or unanswered — the three a run can end in.*diff --git a/tools/tests/smoke-retry.test.ts b/tools/tests/smoke-retry.test.tsindex 2c653ab75..8100687a2 100644--- a/tools/tests/smoke-retry.test.ts+++ b/tools/tests/smoke-retry.test.ts@@ -11,7 +11,11 @@*/import { describe, it, expect } from 'vitest';// @ts-expect-error — a .mjs tool module, typed by its own JSDoc-import { worthAnotherLaunch, verdictOf, exitCodeFor } from '../lib/smokeRetry.mjs';+import { worthAnotherLaunch, verdictOf, exitCodeFor, unjudgedReason } from '../lib/smokeRetry.mjs';++/** A run of the shape the check produces: `wanted` frames asked for, `colors` seen. */+const run = (o: Partial<{ countColors: boolean, frames: number, wanted: number, colors: number, minColors: number }>) =>+ ({ countColors: true, frames: 30, wanted: 30, colors: 8, minColors: 2, ...o });const flat = { ok: false, why: 'the frame is 1 flat color after 120 frame(s)' };const drew = { ok: true, colors: 8 };@@ -44,6 +48,31 @@ describe('what earns a second launch', () => {});});+describe('what counts as having judged the frame', () => {+ // The question is "did it draw", not "did it reach frame 30". lighting-2d+ // takes 90s to reach 10 frames on a software rasteriser and has 1322 colours+ // in the first of them; failing the run for that reports the emulator.+ it('a picture with content is an answer, whatever frame it stopped at', () => {+ expect(unjudgedReason(run({ frames: 10, colors: 1322 }))).toBeNull();+ });++ it('a flat frame short of the asked-for frame is not an answer', () => {+ expect(unjudgedReason(run({ frames: 10, colors: 1 }))).toMatch(/too slow to judge/);+ });++ it('a flat frame that DID reach the asked-for frame is a verdict, not an excuse', () => {+ expect(unjudgedReason(run({ frames: 30, colors: 1 }))).toBeNull();+ });++ it('no frame at all is its own failure, never unanswered', () => {+ expect(unjudgedReason(run({ frames: 0, colors: 1 }))).toBeNull();+ });++ it('says nothing when the frame is not being judged', () => {+ expect(unjudgedReason(run({ countColors: false, frames: 10, colors: 1 }))).toBeNull();+ });+});+describe('three states, not two', () => {it('separates unanswered from passed', () => {expect(verdictOf(drew)).toBe('pass');diff --git a/tools/verify-native-boot.mjs b/tools/verify-native-boot.mjsindex 183574769..8c7be43fb 100644--- a/tools/verify-native-boot.mjs+++ b/tools/verify-native-boot.mjs@@ -47,7 +47,7 @@ import path from 'node:path';import { fileURLToPath } from 'node:url';import { decodePng, distinctColors } from '../build-tools/utils/png.js';import { GOLDEN, launchTimeoutFor } from './goldenProjects.mjs';-import { worthAnotherLaunch, exitCodeFor } from './lib/smokeRetry.mjs';+import { worthAnotherLaunch, exitCodeFor, unjudgedReason } from './lib/smokeRetry.mjs';const ROOT = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..');const APP_ID = 'com.estella.game';@@ -692,12 +692,9 @@ async function verifyApp(driver, artifact, label, opts, judgeFrame = true, round// capture that outran the game, one after three hundred is the game, and// without the number they read as the same failure.const frames = framesDrawn(log);- // Judge the pixels where the loop reached the frame the wait asked for, not- // below it: there the capture and the game are still racing. Zero is neither —- // ready and then no frame at all is the failure it looks like.- const unjudged = countColors && frames > 0 && frames < opts.frames- ? `too slow to judge here — ${frames} frame(s) before the capture`- : null;+ const unjudged = unjudgedReason({+ countColors, frames, wanted: opts.frames, colors, minColors: opts.minColors,+ });const why = !ready ? 'never reported ready': offScreen ? `the game was not on screen — ${offScreen}`: bootErrors.length ? bootErrors[0].trim()@@ -880,7 +877,7 @@ for (const name of examples) {// the same event as one that needed one, and a name that starts appearing// here every night is the black-frame defect getting worse, not a flake.const retryNote = r.firstTry- ? ` (relaunched — first: ${r.firstTry.why?.split('\n')[0] ?? r.firstTry.unjudged})`+ ? ` (relaunched — first: ${(r.firstTry.why || r.firstTry.unjudged || 'no verdict').split('\n')[0]})`: '';const verdict = r.ok ? `✓ ${r.size}, ${r.colors} colors, ${r.frames} frames${frameNote}`: r.undetermined ? `? ${r.unjudged} — twice`