From 7d7f10e69d0452e8d280c62f54ba8331876ab212 Mon Sep 17 00:00:00 2001 From: Devin Jean Date: Tue, 1 Oct 2024 09:44:47 -0500 Subject: [PATCH] run tests for 32-bit --- .github/workflows/ci.yaml | 23 +++++++++++++++++++++-- src/test/mod.rs | 18 ++++++++++++------ 2 files changed, 33 insertions(+), 8 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 479793c..ca41126 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -22,8 +22,8 @@ jobs: command: doc args: --no-deps - test: - name: test + test-64: + name: test-64 runs-on: ubuntu-latest strategy: matrix: @@ -40,6 +40,25 @@ jobs: command: test args: --lib ${{ matrix.opt }} + test-32: + name: test-32 + runs-on: ubuntu-latest + strategy: + matrix: + opt: ["", "--release"] + steps: + - uses: actions/checkout@v2 + - uses: actions-rs/toolchain@v1 + with: + profile: minimal + toolchain: stable + override: true + - uses: actions-rs/cargo@v1 + with: + use-cross: true + command: test + args: --lib ${{ matrix.opt }} --target i686-unknown-linux-gnu --features native-tls-vendored + audit: name: audit runs-on: ubuntu-latest diff --git a/src/test/mod.rs b/src/test/mod.rs index 0513f72..4f0dc96 100644 --- a/src/test/mod.rs +++ b/src/test/mod.rs @@ -131,14 +131,20 @@ fn assert_values_eq<'gc>(got: &Value<'gc, C, StdSystem>, expected: &Value<'gc #[test] fn test_sizes() { - if core::mem::size_of::>>() > 16 { - panic!("values are too large!"); + macro_rules! match_pointer_size { + ($($size:literal => $val:expr),*$(,)?) => {{ + $(#[cfg(target_pointer_width = $size)] { $val })* + }}; } - if core::mem::size_of::>>>() > 16 { - panic!("optional values are too large!"); + + if core::mem::size_of::>>() != match_pointer_size!("64" => 16, "32" => 12) { + panic!("values wrong size: {}", core::mem::size_of::>>()); + } + if core::mem::size_of::>>>() != match_pointer_size!("64" => 16, "32" => 12) { + panic!("optional values wrong size: {}", core::mem::size_of::>>>()); } - if core::mem::size_of::>>>() > 16 { - panic!("shared values are too large!"); + if core::mem::size_of::>>>() != match_pointer_size!("64" => 16, "32" => 12) { + panic!("shared values wrong size: {}", core::mem::size_of::>>>()); } }