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(ci): the harness list names a target CI's configure never defines

esengine868d9367d910
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index b16696a2f..cb7583caa 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -70,7 +70,7 @@ jobs:
- name: Build C++ test harnesses
run: |
- emcmake cmake -S . -B build/wasm/web-tests -DCMAKE_BUILD_TYPE=Release -DES_BUILD_WEB=ON -DES_BUILD_TESTS=ON
+ emcmake cmake -S . -B build/wasm/web-tests -DCMAKE_BUILD_TYPE=Release -DES_BUILD_WEB=ON -DES_BUILD_TESTS=ON -DES_ENABLE_BOX2D=ON
# webgpu_engine_bringup is compiled (a link-time smoke) but not run below.
cmake --build build/wasm/web-tests -j "$(nproc)" --target $CPP_TESTS webgpu_engine_bringup
@@ -123,7 +123,7 @@ jobs:
- name: Configure (ASan + UBSan)
run: |
emcmake cmake -S . -B build/wasm/asan -DCMAKE_BUILD_TYPE=Debug \
- -DES_BUILD_WEB=ON -DES_BUILD_TESTS=ON -DES_SANITIZE=ON
+ -DES_BUILD_WEB=ON -DES_BUILD_TESTS=ON -DES_SANITIZE=ON -DES_ENABLE_BOX2D=ON
- name: Build C++ test harnesses
run: cmake --build build/wasm/asan -j "$(nproc)" --target $CPP_TESTS
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
index 614920f0e..853a30e24 100644
--- a/tests/CMakeLists.txt
+++ b/tests/CMakeLists.txt
@@ -297,6 +297,7 @@ if(ES_ENABLE_BOX2D)
${CMAKE_SOURCE_DIR}/src/esengine/bindings/modules/physics/PhysicsShapes.cpp
${CMAKE_SOURCE_DIR}/src/esengine/bindings/modules/physics/PhysicsJoints.cpp
${CMAKE_SOURCE_DIR}/src/esengine/bindings/modules/physics/PhysicsQueries.cpp
+ ${CMAKE_SOURCE_DIR}/src/esengine/bindings/modules/physics/PhysicsTaskPool.cpp
)
target_link_libraries(test_physics_interpolation PRIVATE box2d)
target_include_directories(test_physics_interpolation PRIVATE
diff --git a/tools/check-cpp-tests.mjs b/tools/check-cpp-tests.mjs
index 93c760f11..c2cf0f1c3 100644
--- a/tools/check-cpp-tests.mjs
+++ b/tools/check-cpp-tests.mjs
@@ -44,6 +44,46 @@ function declaredHarnesses() {
return [...cmake.matchAll(/add_test\(NAME\s+(\w+)/g)].map((m) => m[1]);
}
+/**
+ * Which cmake options each harness sits behind, from the test tree's own `if()`s.
+ *
+ * A target CI names but its configure never defines is not a skip — it is
+ * `No rule to make target`, which fails the build. That is a question about two
+ * files, so it is answered here rather than by a compiler that may be absent.
+ */
+function harnessConditions() {
+ const cmake = readFileSync(path.join(ROOT, 'tests', 'CMakeLists.txt'), 'utf8').replace(/\r\n?/g, '\n');
+ const conditions = new Map();
+ const stack = [];
+ for (const line of cmake.split('\n')) {
+ const open = line.match(/^\s*if\s*\(\s*([A-Za-z0-9_]+)\s*\)/);
+ if (open) { stack.push(open[1]); continue; }
+ // Anything this gate cannot read as one plain option is pushed as null,
+ // so the nesting stays balanced and the condition reads as "unknown".
+ if (/^\s*if\s*\(/.test(line)) { stack.push(null); continue; }
+ if (/^\s*endif\s*\(/.test(line)) { stack.pop(); continue; }
+ const test = line.match(/add_test\(NAME\s+(\w+)/);
+ if (test) conditions.set(test[1], stack.filter(Boolean));
+ }
+ return conditions;
+}
+
+/** Every cmake line that configures the harnesses, and the options it turns on. */
+function ciConfigures() {
+ const workflow = readFileSync(path.join(ROOT, '.github', 'workflows', 'build.yml'), 'utf8')
+ .replace(/\r\n?/g, '\n')
+ .replace(/\\\n\s*/g, ' '); // a continued cmake line is one command
+ return workflow.split('\n')
+ .filter((l) => /\bcmake\b/.test(l) && /-DES_BUILD_TESTS=ON/.test(l))
+ .map((l) => {
+ const on = new Set([...l.matchAll(/-D([A-Za-z0-9_]+)=ON/g)].map((m) => m[1]));
+ // What `emcmake` is for: it hands cmake the toolchain that defines
+ // EMSCRIPTEN, which the test tree gates its GPU harnesses on.
+ if (/\bemcmake\b/.test(l)) on.add('EMSCRIPTEN');
+ return { line: l.trim(), on };
+ });
+}
+
/** Targets that link the engine library, which does not build off emscripten. */
function enginelinked() {
const cmake = readFileSync(path.join(ROOT, 'tests', 'CMakeLists.txt'), 'utf8');
@@ -62,6 +102,26 @@ if (uncovered.length) {
process.exit(1);
}
+// Every harness CI names has to EXIST under the flags CI configures with. No
+// compiler needed, and it is the half that was missing: this gate read the same
+// absence locally as "not configured here" and passed it.
+const conditions = harnessConditions();
+const configures = ciConfigures();
+if (!configures.length) {
+ console.error('check-cpp-tests: build.yml no longer configures the harnesses — this gate reads those lines');
+ process.exit(1);
+}
+for (const { line, on } of configures) {
+ for (const target of targets) {
+ const missing = (conditions.get(target) ?? []).filter((opt) => !on.has(opt));
+ if (!missing.length) continue;
+ console.error(`check-cpp-tests: CI builds "${target}", which tests/CMakeLists.txt declares behind`
+ + ` ${missing.join(' + ')} — a configure without it has no such target and the build fails.`
+ + `\n the configure: ${line}`);
+ process.exit(1);
+ }
+}
+
const has = (cmd) => spawnSync(cmd, ['--version'], { stdio: 'ignore' }).status === 0;
if (!has('cmake')) {
console.log('check-cpp-tests: no cmake on this machine — skipped (CI still builds them).');
@@ -73,7 +133,14 @@ const buildable = targets.filter((t) => !skip.has(t));
mkdirSync(BUILD, { recursive: true });
try {
- execFileSync('cmake', ['-S', ROOT, '-B', BUILD, '-DES_BUILD_TESTS=ON', '-DCMAKE_BUILD_TYPE=Release'],
+ // The options CI configures with, minus what no plain cmake can honour
+ // (EMSCRIPTEN / ES_BUILD_WEB are the emscripten toolchain's, ES_SANITIZE a
+ // build of its own). Absence under the rest is the platform's.
+ const fromToolchain = new Set(['EMSCRIPTEN', 'ES_BUILD_WEB', 'ES_SANITIZE']);
+ const options = [...new Set(configures.flatMap((c) => [...c.on]))]
+ .filter((o) => !fromToolchain.has(o))
+ .map((o) => `-D${o}=ON`);
+ execFileSync('cmake', ['-S', ROOT, '-B', BUILD, ...options, '-DCMAKE_BUILD_TYPE=Release'],
{ stdio: 'pipe' });
} catch (err) {
console.log(`check-cpp-tests: cmake could not configure here — skipped.\n${err.stderr ?? ''}`);