Skip to content

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

@mjt0k

Description

@mjt0k

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    help wantedExtra attention is needed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions