rust-vmm / vmm-sys-util

Helpers and utilities used by multiple rust-vmm components and VMMs
BSD 3-Clause "New" or "Revised" License
79 stars 64 forks source link

test failures in linux tests on i386 due to alignment expectatin failures #191

Open mjt0k opened 1 year ago

mjt0k commented 1 year ago

This one is somewhat fun: on i386, we have alignment expectations wrong:

---- linux::aio::test::bindgen_test_layout_iocb stdout ----
thread 'linux::aio::test::bindgen_test_layout_iocb' panicked at 'assertion failed: `(left == right)`
  left: `4`,
 right: `8`: Alignment ofIoControlBlock', src/linux/aio.rs:356:9

        assert_eq!(
            ::std::mem::align_of::(),
            8usize,
            concat!("Alignment of", stringify!(IoControlBlock))
        );

---- linux::aio::test::bindgen_test_layout_io_event stdout ----
thread 'linux::aio::test::bindgen_test_layout_io_event' panicked at 'assertion failed: `(left == right)`
  left: `4`,
 right: `8`: Alignment ofIoEvent', src/linux/aio.rs:342:9

        assert_eq!(
            ::std::mem::align_of::(),
            8usize,
            concat!("Alignment of", stringify!(IoEvent))
        );

---- linux::sock_ctrl_msg::tests::buffer_len stdout ----
thread 'linux::sock_ctrl_msg::tests::buffer_len' panicked at 'assertion failed: `(left == right)`
  left: `20`,
 right: `16`', src/linux/sock_ctrl_msg.rs:479:13

        assert_eq!(
            CMSG_SPACE!(size_of::()),
            size_of::() + size_of::()
        );

The last one also triggers on armhf (another issue I reported). Also, all of them has missing space, "Alignment ofIoEvent".

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

plugwash commented 1 year ago

This just seems to be a borked test. The type requiring the most alignment in the structure is a 64-bit integer, so the alignment of the overall structure will be the same as that of a 64-bit integer (which varies between architectures)

Patch at (along with issue 191) https://salsa.debian.org/rust-team/debcargo-conf/-/blob/1d296fda82959651ff7358066dcb4425941a2060/src/vmm-sys-util/debian/patches/fix-tests-32-bit.patch