Skip to content

Commit

Permalink
run tests for 32-bit
Browse files Browse the repository at this point in the history
  • Loading branch information
dragazo committed Oct 1, 2024
1 parent 3171314 commit 7d7f10e
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 8 deletions.
23 changes: 21 additions & 2 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ jobs:
command: doc
args: --no-deps

test:
name: test
test-64:
name: test-64
runs-on: ubuntu-latest
strategy:
matrix:
Expand All @@ -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
Expand Down
18 changes: 12 additions & 6 deletions src/test/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -131,14 +131,20 @@ fn assert_values_eq<'gc>(got: &Value<'gc, C, StdSystem<C>>, expected: &Value<'gc

#[test]
fn test_sizes() {
if core::mem::size_of::<Value<C, StdSystem<C>>>() > 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::<Option<Value<C, StdSystem<C>>>>() > 16 {
panic!("optional values are too large!");

if core::mem::size_of::<Value<C, StdSystem<C>>>() != match_pointer_size!("64" => 16, "32" => 12) {
panic!("values wrong size: {}", core::mem::size_of::<Value<C, StdSystem<C>>>());
}
if core::mem::size_of::<Option<Value<C, StdSystem<C>>>>() != match_pointer_size!("64" => 16, "32" => 12) {
panic!("optional values wrong size: {}", core::mem::size_of::<Option<Value<C, StdSystem<C>>>>());
}
if core::mem::size_of::<Shared<'static, Value<'static, C, StdSystem<C>>>>() > 16 {
panic!("shared values are too large!");
if core::mem::size_of::<Shared<'static, Value<'static, C, StdSystem<C>>>>() != match_pointer_size!("64" => 16, "32" => 12) {
panic!("shared values wrong size: {}", core::mem::size_of::<Shared<'static, Value<'static, C, StdSystem<C>>>>());
}
}

Expand Down

0 comments on commit 7d7f10e

Please sign in to comment.