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 start that drew nothing is the same event as a frame of one colour
esengine2b1faef44726
diff --git a/tools/lib/smokeRetry.mjs b/tools/lib/smokeRetry.mjsindex a5e5b0b8b..88f7705f3 100644--- a/tools/lib/smokeRetry.mjs+++ b/tools/lib/smokeRetry.mjs@@ -26,8 +26,14 @@/** @typedef {{ok?: boolean, undetermined?: boolean, why?: string, unjudged?: string|null, offScreen?: string|null}} SmokeResult */-/** The verdict for a frame that has no colour in it but one. */-const FLAT_FRAME = / flat color after /;+/**+ * The verdicts that follow a successful start and say the app did not draw.+ *+ * Two faces of one event — the frame never reaching the surface — telling apart+ * only by whether the record caught a frame count (camera-follow: 240 frames in+ * one run of a build, none in the next).+ */+const NOT_DRAWN_AFTER_READY = [/ flat color after /, /drew no frame at all/];/*** Worth launching a second time, on the same installed APK.@@ -40,7 +46,10 @@ export function worthAnotherLaunch(r) {// spent, and the frame under a dialog is not this check's to judge.if (r.offScreen) return false;if (r.undetermined) return true;- return !r.ok && FLAT_FRAME.test(r.why ?? '');+ // No `ready` check guarding these: a run that never reported ready is given+ // that verdict and no other, so both faces below already imply a start that+ // succeeded. The border is real, and the caller draws it.+ return !r.ok && NOT_DRAWN_AFTER_READY.some((face) => face.test(r.why ?? ''));}/**diff --git a/tools/tests/smoke-retry.test.ts b/tools/tests/smoke-retry.test.tsindex 8100687a2..f0a90d567 100644--- a/tools/tests/smoke-retry.test.ts+++ b/tools/tests/smoke-retry.test.ts@@ -17,30 +17,41 @@ import { worthAnotherLaunch, verdictOf, exitCodeFor, unjudgedReason } from '../lconst 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 };-const slow = { ok: false, undetermined: true, unjudged: 'too slow to judge here — 10 frame(s) before the capture' };+const flat = { ok: false, ready: true, why: 'the frame is 1 flat color after 120 frame(s)' };+const noFrame = { ok: false, ready: true, why: 'reported ready, then drew no frame at all' };+const drew = { ok: true, ready: true, colors: 8 };+const slow = { ok: false, ready: true, undetermined: true, unjudged: 'too slow to judge here — 10 frame(s) before the capture' };describe('what earns a second launch', () => {it('repeats a frame of one flat colour', () => {expect(worthAnotherLaunch(flat)).toBe(true);});+ // The same event as a flat frame, seen when the record caught no frame count+ // at all: camera-follow drew 240 frames in one run of a build and none in the+ // next, on the same emulator.+ it('repeats a start that reported ready and then drew nothing', () => {+ expect(worthAnotherLaunch(noFrame)).toBe(true);+ });+it('repeats a run that never reached the frame it is judged at', () => {expect(worthAnotherLaunch(slow)).toBe(true);});// The whole point of the policy: these are the ones that must not be given a- // second chance, or a broken build becomes a slow green one.- it('does not repeat a crash, a launch that never reported ready, or a boot error', () => {- expect(worthAnotherLaunch({ ok: false, why: 'never reported ready' })).toBe(false);- expect(worthAnotherLaunch({ ok: false, why: 'reported ready, then drew no frame at all' })).toBe(false);- expect(worthAnotherLaunch({ ok: false, why: 'ERROR [asset] texture 4 failed to upload' })).toBe(false);- expect(worthAnotherLaunch({ ok: false, why: 'after an activity recreate: ERROR [js] undefined' })).toBe(false);+ // second chance, or a broken build becomes a slow green one. `ready` is the+ // border — a launch that never got there is judged once.+ it('does not repeat a launch that never reported ready', () => {+ expect(worthAnotherLaunch({ ok: false, ready: false, why: 'never reported ready' })).toBe(false);+ });++ it('does not repeat an engine error, even after a successful start', () => {+ expect(worthAnotherLaunch({ ok: false, ready: true, why: 'ERROR [asset] texture 4 failed to upload' })).toBe(false);+ expect(worthAnotherLaunch({ ok: false, ready: true, why: 'after an activity recreate: ERROR [js] undefined' })).toBe(false);});it('does not repeat a game a dialog was covering — that retry is already spent', () => {- expect(worthAnotherLaunch({ ok: false, why: 'the game was not on screen — a dialog has focus', offScreen: 'a dialog has focus' })).toBe(false);+ expect(worthAnotherLaunch({ ok: false, ready: true, why: 'the game was not on screen — a dialog has focus', offScreen: 'a dialog has focus' })).toBe(false);});it('leaves a run that drew alone', () => {