From 26cb36cf4eb9fc6d301f6d629a5bd44ec9ce0cee Mon Sep 17 00:00:00 2001 From: ivanlele Date: Wed, 20 May 2026 18:32:58 +0300 Subject: [PATCH] Update test DLL loading to use cargo-built outputs for platform compatibility --- .github/workflows/ci.yml | 1 + core/src/jets/custom_jet.rs | 16 ++++++++++++++-- core/src/runner.rs | 10 ++++++---- 3 files changed, 21 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ddae19b..a268bea 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -27,6 +27,7 @@ jobs: with: toolchain: 1.92.0 - uses: Swatinem/rust-cache@v2 + - run: cargo build --workspace --all-targets - run: cargo test --workspace clippy: diff --git a/core/src/jets/custom_jet.rs b/core/src/jets/custom_jet.rs index 658c2e0..3af69a3 100644 --- a/core/src/jets/custom_jet.rs +++ b/core/src/jets/custom_jet.rs @@ -273,13 +273,25 @@ mod test { use super::*; // --- DLLs for tests --- + // Use the cargo-built output from target/debug/ with the platform-appropriate extension + // (dylib on macOS, so on Linux) instead of pre-built platform-specific binaries. static ELEMENTS_TEST_DLL: LazyLock>> = LazyLock::new(|| unsafe { - Container::::load("../cli/assets/custom_jet_dlls/libelements.so").ok() + let path = format!( + "{}/../target/debug/libelements.{}", + env!("CARGO_MANIFEST_DIR"), + std::env::consts::DLL_EXTENSION + ); + Container::::load(&path).ok() }); static CORE_TEST_DLL: LazyLock>> = LazyLock::new(|| unsafe { - Container::::load("../cli/assets/custom_jet_dlls/libbitcoin.so").ok() + let path = format!( + "{}/../target/debug/libbitcoin.{}", + env!("CARGO_MANIFEST_DIR"), + std::env::consts::DLL_EXTENSION + ); + Container::::load(&path).ok() }); struct ElementsTestApi; diff --git a/core/src/runner.rs b/core/src/runner.rs index bdde2fe..2ef4390 100644 --- a/core/src/runner.rs +++ b/core/src/runner.rs @@ -201,10 +201,12 @@ mod tests { use hal_simplicity::simplicity::elements::pset::PartiallySignedTransaction; static TEST_DLL: LazyLock>> = LazyLock::new(|| unsafe { - Container::::load( - "../cli/assets/custom_jet_dlls/libopcode_pubkey_elements.so", - ) - .ok() + let path = format!( + "{}/../target/debug/libopcode_pubkey_elements.{}", + env!("CARGO_MANIFEST_DIR"), + std::env::consts::DLL_EXTENSION + ); + Container::::load(&path).ok() }); struct TestApi;