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.

fix(verify): the local gate suite could not run on a Windows checkout

yhh2f4e8db387c3
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 99ce8a31e..827f6db86 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -35,6 +35,13 @@ option(ES_PHYSICS_ESM "Emit the physics module as an ES6 module (web) instead of
# ASan + UBSan for the test harnesses (the sanitizers job in build.yml). Findings
# are fatal: without -fno-sanitize-recover UBSan prints and continues, which a CI
# gate reads as green. clang/gcc/emcc flags — MSVC has no UBSan.
+# The sources are UTF-8; without this MSVC reads them in the host's ANSI codepage,
+# so a non-ASCII literal becomes mojibake and then a syntax error. Only the host
+# locale decides, which is why it compiles on one Windows machine and not the next.
+if(MSVC)
+ add_compile_options(/utf-8)
+endif()
+
option(ES_SANITIZE "Build with AddressSanitizer + UndefinedBehaviorSanitizer" OFF)
if(ES_SANITIZE)
if(MSVC)
diff --git a/tools/check-cpp-tests.mjs b/tools/check-cpp-tests.mjs
index 23d8132a4..c368ba843 100644
--- a/tools/check-cpp-tests.mjs
+++ b/tools/check-cpp-tests.mjs
@@ -29,7 +29,10 @@ const BUILD = path.join(ROOT, 'build', 'cmake', 'native-tests');
/** The harness targets, read off the CI list so the two cannot drift. */
function harnessTargets() {
- const workflow = readFileSync(path.join(ROOT, '.github', 'workflows', 'build.yml'), 'utf8');
+ // Normalised first: a Windows checkout has CRLF here and the line pattern
+ // would not match, so this gate could only ever run on the LF side.
+ const workflow = readFileSync(path.join(ROOT, '.github', 'workflows', 'build.yml'), 'utf8')
+ .replace(/\r\n?/g, '\n');
const block = workflow.match(/CPP_TESTS:\s*>-\s*\n((?:\s{4}.*\n)+)/);
if (!block) throw new Error('build.yml no longer declares CPP_TESTS — this gate reads it');
return block[1].split(/\s+/).filter(Boolean);
@@ -68,8 +71,9 @@ for (const target of buildable) {
if (run.status === 0) { built.push(target); continue; }
// A target the native configure never produced is not a broken one: some are
// declared behind an option this tree does not set. Saying which is the
- // difference between a gate and a green light.
- if (/No rule to make target|unknown target|does not exist/i.test(out)) { absent.push(target); continue; }
+ // difference between a gate and a green light. MSB1009 is matched by code
+ // because MSBuild says "project file does not exist" in the host's language.
+ if (/No rule to make target|unknown target|does not exist|MSB1009/i.test(out)) { absent.push(target); continue; }
console.error(`check-cpp-tests: ${target} does not build.\n`);
console.error(out.split('\n').filter((l) => /error|Undefined|undefined symbol/i.test(l)).slice(0, 12).join('\n'));
console.error(`\nReproduce: cmake -S . -B ${path.relative(ROOT, BUILD)} -DES_BUILD_TESTS=ON`
diff --git a/tools/run-gates.mjs b/tools/run-gates.mjs
index 425c59c7d..ee6c0a41b 100644
--- a/tools/run-gates.mjs
+++ b/tools/run-gates.mjs
@@ -34,6 +34,13 @@ console.log(`gates ${SCOPE}: ${gates.length} of ${GATES.length}`);
for (const gate of gates) {
const r = spawnSync('sh', ['-c', gate.run], { cwd: ROOT, stdio: 'inherit' });
+ // A shell that would not start is not a gate that failed. Reported as one it
+ // sends the reader after the first gate's subject, which said nothing at all.
+ if (r.error) {
+ console.error(`\n✗ could not run the gates: ${r.error.message}`);
+ console.error(' they are shell commands — run this from a shell that has `sh` on PATH.');
+ process.exit(2);
+ }
if (r.status !== 0) {
console.error(`\n✗ ${gate.id} — \`${gate.run}\``);
// Naming what did NOT run matters at the moment of failure: the gates after