Skip to content

Test data-structure sizes in 32-bit Windows on CI, and fix size_of_hasher #1932

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Apr 5, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -309,6 +309,24 @@ jobs:
GIX_TEST_IGNORE_ARCHIVES: '1'
run: cargo nextest run --workspace --no-fail-fast

test-32bit-windows-size:
runs-on: windows-latest

env:
TARGET: i686-pc-windows-msvc

steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ env.TARGET }}
- uses: Swatinem/rust-cache@v2
- uses: taiki-e/install-action@v2
with:
tool: nextest
- name: Test (nextest)
run: cargo nextest run --target $env:TARGET --workspace --no-fail-fast size

lint:
runs-on: ubuntu-latest

Expand Down Expand Up @@ -504,6 +522,7 @@ jobs:
- test-fast
- test-fixtures-windows
- test-32bit
- test-32bit-windows-size
- lint
- cargo-deny
- check-packetline
Expand Down
13 changes: 8 additions & 5 deletions gix-hash/tests/hash/hasher.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
use gix_hash::{Hasher, ObjectId};
use gix_testtools::size_ok;

#[test]
fn size_of_hasher() {
assert_eq!(
std::mem::size_of::<Hasher>(),
if cfg!(target_arch = "x86") { 820 } else { 824 },
"The size of this type may be relevant when hashing millions of objects,\
and shouldn't change unnoticed. The DetectionState alone clocks in at 724 bytes."
let actual = std::mem::size_of::<Hasher>();
let expected = 824;
assert!(
size_ok(actual, expected),
"The size of this type may be relevant when hashing millions of objects, and shouldn't\
change unnoticed: {actual} <~ {expected}\
(The DetectionState alone clocked in at 724 bytes when last examined.)"
);
}

Expand Down
Loading