Skip to content
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

rand selftest issues on s390x: wrong byte order? #192

Open
mjt0k opened this issue Apr 16, 2023 · 1 comment
Open

rand selftest issues on s390x: wrong byte order? #192

mjt0k opened this issue Apr 16, 2023 · 1 comment
Labels
help wanted Extra attention is needed

Comments

@mjt0k
Copy link

mjt0k commented Apr 16, 2023

Here's an example selftest failure on s390x:

---- rand::tests::test_rand_alphanumerics_impl stdout ----
thread 'rand::tests::test_rand_alphanumerics_impl' panicked at 'assertion failed: `(left == right)`
  left: `"67676"`,
 right: `"76767"`', src/rand.rs:133:9

    fn test_rand_alphanumerics_impl() {
        let s = rand_alphanumerics_impl(&|| 14134, 5);
        assert_eq!("67676", s);
    }

---- rand::tests::test_rand_bytes_impl stdout ----
thread 'rand::tests::test_rand_bytes_impl' panicked at 'assertion failed: `(left == right)`
  left: `[135, 214, 18, 0]`,
 right: `[0, 18, 214, 135]`', src/rand.rs:154:9

    fn test_rand_bytes_impl() {
        let s = rand_bytes_impl(&|| 1234567, 4);
        assert_eq!(vec![135, 214, 18, 0], s);
    }

---- rand::tests::test_xor_pseudo_rng_u8_alphas stdout ----
thread 'rand::tests::test_xor_pseudo_rng_u8_alphas' panicked at 'assertion failed: `(left == right)`
  left: `[54, 55]`,
 right: `[55, 54]`', src/rand.rs:127:9

    fn test_xor_pseudo_rng_u8_alphas() {
        let i = 3612982; // 55 (shifted 16 places), 33 (shifted 8 places), 54...
                         // The 33 will be discarded as it is not a valid letter
                         // (upper or lower) or number.
        let s = xor_pseudo_rng_u8_alphanumerics(&|| i);
        assert_eq!(vec![54, 55], s);
    }

---- rand::tests::test_xor_pseudo_rng_u8_bytes stdout ----
thread 'rand::tests::test_xor_pseudo_rng_u8_bytes' panicked at 'assertion failed: `(left == right)`
  left: `[54, 33, 55, 0]`,
 right: `[0, 55, 33, 54]`', src/rand.rs:148:9

    fn test_xor_pseudo_rng_u8_bytes() {
        let i = 3612982; // 55 (shifted 16 places), 33 (shifted 8 places), 54...
                         // The 33 will be discarded as it is not a valid letter
                         // (upper or lower) or number.
        let s = xor_pseudo_rng_u8_bytes(&|| i);
        assert_eq!(vec![54, 33, 55, 0], s);
    }

It looks like some byte swapping is occurring here?

https://ci.debian.net/data/autopkgtest/testing/s390x/r/rust-vmm-sys-util/32901017/log.gz

@andreeaflorescu andreeaflorescu added the help wanted Extra attention is needed label Apr 19, 2023
@plugwash
Copy link

plugwash commented May 6, 2023

This appears to be fixed by 64e4475 ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

3 participants