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): stop waiting on a launch that is already dead

esenginec140ce82b90f
diff --git a/tools/android-compat-report.mjs b/tools/android-compat-report.mjs
index 3b93409f3..269603e37 100644
--- a/tools/android-compat-report.mjs
+++ b/tools/android-compat-report.mjs
@@ -204,6 +204,14 @@ if (renderers.length) {
out.push('所以上面的帧间隔是 CPU 光栅化的耗时,GPU 占用和功耗在这里根本不存在。');
out.push('跨版本互相比较仍然有意义,把任何一个数当成真机性能则没有。');
out.push('');
+ // Now that the row parses, it parses as zero — and a bare 0 invites the
+ // reading "the renderer allocates nothing", which is not what it means.
+ if (runs.some((r) => r.memory && r.memory.graphicsKb === 0)) {
+ out.push('`Graphics` 是 0 也是同一个原因:那一列统计的是 gralloc/GPU 归属的内存,');
+ out.push('软件渲染下不存在这种分配,Dawn 的缓冲全落在 PSS 的其他分类里。');
+ out.push('这一列只有在真机上才有意义。');
+ out.push('');
+ }
}
}
diff --git a/tools/verify-native-boot.mjs b/tools/verify-native-boot.mjs
index 23706ed6f..1f2bfba15 100644
--- a/tools/verify-native-boot.mjs
+++ b/tools/verify-native-boot.mjs
@@ -205,6 +205,12 @@ function androidDriver(opts) {
// Counting colors on a SCREEN, not on the game: an emulator that pops
// "Pixel Launcher isn't responding" over a black app hands the check a
// dialog full of colors and it calls that a rendered frame.
+ /** Has the launch already died? `am start -W` waits for the launch to
+ * finish, so by the time this is asked the process either exists or is
+ * gone for good. */
+ died() {
+ return !trySh(adb, ['shell', 'pidof', APP_ID]).stdout.trim();
+ },
foreground() {
const out = trySh(adb, ['shell', 'dumpsys', 'activity', 'activities']).stdout ?? '';
const line = out.split('\n').find((l) => /ResumedActivity/.test(l));
@@ -460,6 +466,13 @@ async function verifyApp(driver, artifact, label, opts, judgeFrame = true) {
while (Date.now() < deadline) {
log = driver.readLog();
if (log.includes(READY)) break;
+ // A launch that is already dead will not report ready in another two
+ // minutes. Sitting out the full timeout twice turned each crashing
+ // version into seven minutes of waiting for nothing, which is what
+ // pushed the slower emulators past the job cap and cost the matrix a
+ // version per run — reported as "no data" on a version that had in
+ // fact crashed, which is the wrong answer twice over.
+ if (driver.died?.()) break;
await sleep(2000);
}
// `ready` is the first frame submitted; presenting it is not instant.