From 5d843f39678d443f14743bb8fc7e2eddfbcdf8f1 Mon Sep 17 00:00:00 2001 From: Jorijn van der Graaf Date: Sun, 1 Nov 2026 18:40:32 +0100 Subject: [PATCH] fix(test): run the binary the link wrote, .wasm included RunTests worked each test binary's path out with a rule of its own, TestBinaryPath: BinDir()/, plus .exe for any triple naming windows or mingw, and nothing for wasm. The link writes .wasm for a wasm32 executable, so every wasm test declared with AddTest was handed to wasmtime without its extension and failed with "failed to open wasm module", inside the Flatpak as well, where wasmtime is bundled. RunTests now asks ExpectedOutput(), the name the staleness checks and -r read, which for a wasm32 executable is the .wasm the link writes. --- implementations/Crafter.Build-Test.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/implementations/Crafter.Build-Test.cpp b/implementations/Crafter.Build-Test.cpp index fef2108..3d68fa2 100644 --- a/implementations/Crafter.Build-Test.cpp +++ b/implementations/Crafter.Build-Test.cpp @@ -16,11 +16,6 @@ namespace { return target.find("windows") != std::string_view::npos || target.find("mingw") != std::string_view::npos; } - fs::path TestBinaryPath(const Configuration& cfg) { - fs::path outputDir = cfg.BinDir(); - return outputDir / (TargetIsWindows(cfg.target) ? std::format("{}.exe", cfg.outputName) : cfg.outputName); - } - // MatchGlob/MatchAny live in :Platform — shared with the lint verb. std::string JoinAndQuoteArgs(std::span args) { @@ -615,7 +610,12 @@ TestSummary Crafter::RunTests(Configuration& projectCfg, const RunTestsOptions& } std::chrono::seconds timeout = opts.timeoutOverride.value_or(t.timeout); - fs::path binary = TestBinaryPath(t.config); + // The file the link wrote, by the rule the staleness checks and -r + // use, which for a wasm32 executable is the .wasm the link + // writes. A rule of its own here once added .exe for any Windows + // triple and nothing for wasm, so every wasm test was handed to + // wasmtime without the .wasm it was linked as. + fs::path binary = ExpectedOutput(t.config); try { r = RunSingleTest(t, binary, timeout); } catch (const std::exception& e) {