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 gate runs the harnesses it builds

esengine346122ad006d
diff --git a/tests/renderer/test_shader_variant.cpp b/tests/renderer/test_shader_variant.cpp
index bcf509351..54ef19c1c 100644
--- a/tests/renderer/test_shader_variant.cpp
+++ b/tests/renderer/test_shader_variant.cpp
@@ -240,9 +240,10 @@ static void testWGSLEmission() {
ParsedShader lit = ShaderParser::parse(WGSL_TWIN_LIT);
const std::string litVs = wgsl(lit, ShaderStage::Vertex);
- // .xy, not the whole position: the batch vertex carries a z now, and the
- // lighting varying is a vec2 because 2D lighting works in the XY plane.
- CHECK(litVs.find("out.v_worldPos = v.a_position.xy;") != std::string::npos,
+ // From `world`, not from the attribute: the same stage serves two vertex
+ // sources, and under MESH the position is local until the model matrix has
+ // been applied. .xy because 2D lighting works in that plane.
+ CHECK(litVs.find("out.v_worldPos = world.xy;") != std::string::npos,
"Lit2D canonical WGSL vertex forwards world position");
const std::string litFs = wgsl(lit, ShaderStage::Fragment);
CHECK(litFs.find("@location(2) v_worldPos : vec2f,") != std::string::npos,
@@ -360,7 +361,8 @@ static void testFragmentOnly() {
ParsedShader lit = ShaderParser::parse(FRAG_ONLY_LIT);
CHECK(lit.valid, "fragment-only Lit2D shader parses");
const std::string lv = ShaderParser::assembleStage(lit, ShaderStage::Vertex);
- CHECK(lv.find("v_worldPos = a_position") != std::string::npos, "Lit2D canonical vertex forwards world position");
+ CHECK(lv.find("v_worldPos = world.xy;") != std::string::npos,
+ "Lit2D canonical vertex forwards world position");
const std::string lf = ShaderParser::assembleStage(lit, ShaderStage::Fragment);
CHECK(lf.find("applyLighting2D") != std::string::npos, "Lit2D fragment gets the lighting helper injected");
diff --git a/tools/check-cpp-tests.mjs b/tools/check-cpp-tests.mjs
index c2cf0f1c3..b509ba698 100644
--- a/tools/check-cpp-tests.mjs
+++ b/tools/check-cpp-tests.mjs
@@ -147,12 +147,37 @@ try {
process.exit(0);
}
+/** Where a built harness landed — the layout differs by generator. */
+function harnessBinary(target) {
+ const candidates = [
+ path.join(BUILD, 'bin', target),
+ path.join(BUILD, 'bin', `${target}.exe`),
+ path.join(BUILD, 'bin', 'Release', `${target}.exe`),
+ ];
+ return candidates.find((c) => existsSync(c)) ?? null;
+}
+
const built = [];
const absent = [];
for (const target of buildable) {
const run = spawnSync('cmake', ['--build', BUILD, '-j', '8', '--target', target], { encoding: 'utf8' });
const out = `${run.stdout ?? ''}${run.stderr ?? ''}`;
- if (run.status === 0) { built.push(target); continue; }
+ if (run.status === 0) {
+ // Compiling is half the claim. A harness that builds and then fails its
+ // assertions is a red CI job this gate would otherwise call green — which
+ // is how two stale shader-variant assertions sat behind a broken build.
+ const binary = harnessBinary(target);
+ const ran = binary ? spawnSync(binary, [], { encoding: 'utf8' }) : null;
+ if (ran && ran.status !== 0) {
+ console.error(`check-cpp-tests: ${target} builds but does not pass.\n`);
+ console.error(`${ran.stdout ?? ''}${ran.stderr ?? ''}`.split('\n')
+ .filter((l) => /FAIL|error|assert/i.test(l)).slice(0, 12).join('\n'));
+ console.error(`\nReproduce: ${path.relative(ROOT, binary)}`);
+ process.exit(1);
+ }
+ 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. MSB1009 is matched by code
@@ -165,6 +190,6 @@ for (const target of buildable) {
process.exit(1);
}
-console.log(`check-cpp-tests: ${built.length} harness(es) build`
+console.log(`check-cpp-tests: ${built.length} harness(es) build and pass`
+ `${absent.length ? `; ${absent.length} not configured here (${absent.join(', ')})` : ''}`
+ `; ${skip.size} link the engine and are CI's to judge (${[...skip].join(', ')}).`);