Skip to content

Commit eb92a50

Browse files
Add some more documentation to SIMD/no-SIMD testing.
1 parent 294493b commit eb92a50

File tree

3 files changed

+24
-5
lines changed

3 files changed

+24
-5
lines changed

.github/workflows/ci.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,11 +67,12 @@ jobs:
6767
run: cargo doc --verbose
6868
- name: Run SIMD/no-SIMD tests
6969
run: |
70+
# See crosstest/main.rs for more info on the test
7071
cd crosstest
71-
# Create some no-simd test files
72+
# Create a no-simd test file in /tmp
7273
cargo run --verbose --features no_simd -- write
7374
cargo clean
74-
# Create some simd test files and test the no-simd files
75+
# Create a simd-enabled test file and test the no-simd file
7576
cargo run --verbose -- write read
7677
cargo clean
7778
# Test the simd-enabled files we generated in the last step

crosstest/src/main.rs

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,20 @@
11
// This test makes sure that a hash table generated with SIMD support
2-
// can be loaded on a platform without SIMD support.
2+
// can be loaded on a platform without SIMD support and vice versa.
3+
//
4+
// It works this way:
5+
//
6+
// The executable has two options: "write" and "read". When "write" is
7+
// enabled, it will write a hashtable to /tmp. When "read" is enabled,
8+
// it will try to read a hashtable from /tmp and verify that it contains
9+
// the expected data.
10+
//
11+
// We compile the executable two times, once with and once without SIMD
12+
// support. With both versions we generate a hashtable in /tmp and then
13+
// try to load and verify that hashtable with the respective other
14+
// version of the executable, that is, the SIMD-version will try to load
15+
// the non-SIMD version and vice versa.
16+
//
17+
// See .github/workflows/ci.yml for how this is used.
318

419
struct FxConfig;
520

src/memory_layout.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,11 @@ impl Header {
6262

6363
if raw_bytes.len() != bytes_needed::<C>(self.slot_count()) {
6464
return Err(Error(format!(
65-
"Provided allocation has wrong size for slot count {}",
66-
self.slot_count()
65+
"Provided allocation has wrong size for slot count {}. \
66+
The allocation's size is {} but the expected size is {}.",
67+
self.slot_count(),
68+
raw_bytes.len(),
69+
bytes_needed::<C>(self.slot_count()),
6770
)));
6871
}
6972

0 commit comments

Comments
 (0)