Skip to content

Commit b11b98a

Browse files
committed
test: fail the checks by default until they prove success
the earlier commits bound every known-hangable step; any await this or a future change leaves unbounded could still hang the run, or worse, drain the event loop and exit 0 silently. Preset the exit code to failure, add an unreferenced whole-run watchdog that forces a verdict through any held-alive hang, and keep both explicit exits, so every termination mode ends with the code that matches what was proven. (cherry picked from commit 61e41ce)
1 parent b2cea9f commit b11b98a

2 files changed

Lines changed: 30 additions & 0 deletions

File tree

‎ui/scripts/check-locale-resolution.js‎

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,21 @@ const TARGET_LANG = 'zh_CN';
5757
const DEFAULT_LANG = 'en_US';
5858
const TARGET_SCRIPT = /[一-鿿]/;
5959

60+
// The check is a failure until it proves otherwise, so an unexpected
61+
// event-loop drain (a pending promise with no live handles) cannot exit 0.
62+
process.exitCode = 1;
63+
64+
// unref lets a finished run exit on time; a run held alive by any leaked
65+
// or hung handle still gets terminated with a verdict.
66+
// Must exceed the sum of every bounded step below (worst case 100s), or a
67+
// run whose steps all succeed slowly gets a false FAIL from its own backstop.
68+
const WATCHDOG_MS = 180000;
69+
const watchdog = setTimeout(() => {
70+
console.error(`FAIL: check did not complete within ${WATCHDOG_MS / 1000}s`);
71+
process.exit(1);
72+
}, WATCHDOG_MS);
73+
watchdog.unref();
74+
6075
const rel = (file) => path.relative(UI_DIR, file);
6176

6277
function fail(message) {

‎ui/scripts/check-plugin-i18n-order.js‎

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,21 @@ const PLUGIN_NS = 'plugin';
4747
const SLUG = 'check_only_plugin';
4848
const SENTINEL = 'registered before init';
4949

50+
// The check is a failure until it proves otherwise, so an unexpected
51+
// event-loop drain (a pending promise with no live handles) cannot exit 0.
52+
process.exitCode = 1;
53+
54+
// unref lets a finished run exit on time; a run held alive by any leaked
55+
// or hung handle still gets terminated with a verdict.
56+
// Must exceed the sum of every bounded step below (worst case 130s), or a
57+
// run whose steps all succeed slowly gets a false FAIL from its own backstop.
58+
const WATCHDOG_MS = 180000;
59+
const watchdog = setTimeout(() => {
60+
console.error(`FAIL: check did not complete within ${WATCHDOG_MS / 1000}s`);
61+
process.exit(1);
62+
}, WATCHDOG_MS);
63+
watchdog.unref();
64+
5065
const rel = (file) => path.relative(UI_DIR, file);
5166

5267
function fail(message) {

0 commit comments

Comments
 (0)