Skip to content

Commit

Permalink
arch: add big endian regression test
Browse files Browse the repository at this point in the history
This was reported along with the fact that memchr 2.7.3 broke big endian
targets. While I at first thought the test suite just somehow missed the
regression and thus this test was somehow novel in some interesting way,
it turned out it was just a CI configuration failure. The existing tests
catch the regression easily (dozens of test failures). The problem, as
mentioned in the previous commit, was that tests in CI weren't using
`cross` when cross compilation was enabled.

So while this test is seemingly redundant, I still think it's good form
to add it.

Ref #152
  • Loading branch information
BurntSushi committed Jun 14, 2024
1 parent 4836ac3 commit 92edbb6
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion src/arch/all/memchr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1143,7 +1143,24 @@ mod tests {
assert_eq!(4, count);
}

/// Generate 500K values.
// A test[1] that failed on some big endian targets after a perf
// improvement was merged[2].
//
// At first it seemed like the test suite somehow missed the regression,
// but in actuality, CI was not running tests with `cross` but instead with
// `cargo` specifically. This is because those steps were using `cargo`
// instead of `${{ env.CARGO }}`. So adding this regression test doesn't
// really help catch that class of failure, but we add it anyway for good
// measure.
//
// [1]: https://github.com/BurntSushi/memchr/issues/152
// [2]: https://github.com/BurntSushi/memchr/pull/151
#[test]
fn regression_big_endian1() {
assert_eq!(One::new(b':').find(b"1:23"), Some(1));
}

// Generate 500K values.
fn special_values() -> impl Iterator<Item = usize> {
fn all_bytes() -> impl Iterator<Item = u8> {
0..=0xff
Expand Down

0 comments on commit 92edbb6

Please sign in to comment.