Skip to content

Commit 269d2da

Browse files
authored
Merge pull request #1932 from EliahKagan/run-ci/32bit-size
Test data-structure sizes in 32-bit Windows on CI, and fix `size_of_hasher`
2 parents 24f40b9 + 4cea38b commit 269d2da

File tree

2 files changed

+27
-5
lines changed

2 files changed

+27
-5
lines changed

.github/workflows/ci.yml

+19
Original file line numberDiff line numberDiff line change
@@ -309,6 +309,24 @@ jobs:
309309
GIX_TEST_IGNORE_ARCHIVES: '1'
310310
run: cargo nextest run --workspace --no-fail-fast
311311

312+
test-32bit-windows-size:
313+
runs-on: windows-latest
314+
315+
env:
316+
TARGET: i686-pc-windows-msvc
317+
318+
steps:
319+
- uses: actions/checkout@v4
320+
- uses: dtolnay/rust-toolchain@stable
321+
with:
322+
targets: ${{ env.TARGET }}
323+
- uses: Swatinem/rust-cache@v2
324+
- uses: taiki-e/install-action@v2
325+
with:
326+
tool: nextest
327+
- name: Test (nextest)
328+
run: cargo nextest run --target $env:TARGET --workspace --no-fail-fast size
329+
312330
lint:
313331
runs-on: ubuntu-latest
314332

@@ -504,6 +522,7 @@ jobs:
504522
- test-fast
505523
- test-fixtures-windows
506524
- test-32bit
525+
- test-32bit-windows-size
507526
- lint
508527
- cargo-deny
509528
- check-packetline

gix-hash/tests/hash/hasher.rs

+8-5
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,15 @@
11
use gix_hash::{Hasher, ObjectId};
2+
use gix_testtools::size_ok;
23

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

0 commit comments

Comments
 (0)