Skip to content

Commit

Permalink
Add some more documentation to SIMD/no-SIMD testing.
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelwoerister authored and wesleywiser committed Sep 20, 2021
1 parent 57ace38 commit b9b50e4
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 5 deletions.
5 changes: 3 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,12 @@ jobs:
run: cargo doc --verbose
- name: Run SIMD/no-SIMD tests
run: |
# See crosstest/main.rs for more info on the test
cd crosstest
# Create some no-simd test files
# Create a no-simd test file in /tmp
cargo run --verbose --features no_simd -- write
cargo clean
# Create some simd test files and test the no-simd files
# Create a simd-enabled test file and test the no-simd file
cargo run --verbose -- write read
cargo clean
# Test the simd-enabled files we generated in the last step
Expand Down
17 changes: 16 additions & 1 deletion crosstest/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,20 @@
// This test makes sure that a hash table generated with SIMD support
// can be loaded on a platform without SIMD support.
// can be loaded on a platform without SIMD support and vice versa.
//
// It works this way:
//
// The executable has two options: "write" and "read". When "write" is
// enabled, it will write a hashtable to /tmp. When "read" is enabled,
// it will try to read a hashtable from /tmp and verify that it contains
// the expected data.
//
// We compile the executable two times, once with and once without SIMD
// support. With both versions we generate a hashtable in /tmp and then
// try to load and verify that hashtable with the respective other
// version of the executable, that is, the SIMD-version will try to load
// the non-SIMD version and vice versa.
//
// See .github/workflows/ci.yml for how this is used.

struct FxConfig;

Expand Down
7 changes: 5 additions & 2 deletions src/memory_layout.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,11 @@ impl Header {

if raw_bytes.len() != bytes_needed::<C>(self.slot_count()) {
return Err(Error(format!(
"Provided allocation has wrong size for slot count {}",
self.slot_count()
"Provided allocation has wrong size for slot count {}. \
The allocation's size is {} but the expected size is {}.",
self.slot_count(),
raw_bytes.len(),
bytes_needed::<C>(self.slot_count()),
)));
}

Expand Down

0 comments on commit b9b50e4

Please sign in to comment.