From eacc47930a8406bccd0ec346b7d413add11690c5 Mon Sep 17 00:00:00 2001 From: Mike Solar Date: Fri, 21 Aug 2026 12:53:11 +0800 Subject: [PATCH] tests: assemble the OFX fixture bundle correctly on Windows MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The fixture plugin binary was copied into Contents/Linux-x86-64 under the extension-less name "plugin" on every non-macOS platform. On Windows the host never loads it: LoadLibrary appends .dll to extension-less module names, so the scan found the bundle but produced no plugin — and because the (passing) draw-overlay test scans first, the path dedupe then hid the failure from the lifecycle test, which died with "interact variant instance: NotFound". Use Contents/Win64 and plugin.dll on Windows in both bundle assembly sites. --- crates/oakplugin/tests/common/mod.rs | 10 +++++++++- src/oakui/ofx.rs | 10 +++++++++- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/crates/oakplugin/tests/common/mod.rs b/crates/oakplugin/tests/common/mod.rs index fa44ca347..0dadc57f8 100644 --- a/crates/oakplugin/tests/common/mod.rs +++ b/crates/oakplugin/tests/common/mod.rs @@ -52,12 +52,20 @@ pub fn test_plugin_dir() -> Option { .join("oak-test-plugin.ofx.bundle"); let platform = if cfg!(target_os = "macos") { "MacOS" + } else if cfg!(target_os = "windows") { + "Win64" } else { "Linux-x86-64" }; let bin_dir = bundle.join("Contents").join(platform); std::fs::create_dir_all(&bin_dir).ok()?; - let target = bin_dir.join("plugin"); + // Windows 上必须有 .dll 扩展名:LoadLibrary 会对无扩展名的 + // 模块名自动追加 ".dll",名为 "plugin" 的文件将加载失败。 + let target = bin_dir.join(if cfg!(target_os = "windows") { + "plugin.dll" + } else { + "plugin" + }); if !target.exists() { std::fs::copy(&lib, &target).ok()?; } diff --git a/src/oakui/ofx.rs b/src/oakui/ofx.rs index dbecc016b..3b743c5b0 100644 --- a/src/oakui/ofx.rs +++ b/src/oakui/ofx.rs @@ -798,12 +798,20 @@ mod tests { .join("oak-test-plugin.ofx.bundle"); let platform = if cfg!(target_os = "macos") { "MacOS" + } else if cfg!(target_os = "windows") { + "Win64" } else { "Linux-x86-64" }; let bin_dir = bundle.join("Contents").join(platform); std::fs::create_dir_all(&bin_dir).ok()?; - let target = bin_dir.join("plugin"); + // Windows needs the .dll extension: LoadLibrary appends ".dll" to + // extension-less module names, so a bare "plugin" file never loads. + let target = bin_dir.join(if cfg!(target_os = "windows") { + "plugin.dll" + } else { + "plugin" + }); if !target.exists() { std::fs::copy(&lib, &target).ok()?; }