Skip to content

chrono v0.4.27 test failure on 32-bit x86 (i686-unknown-linux-gnu) #1234

Closed
@decathorpe

Description

The format::strftime::tests::test_type_sizes test was added with #1152 and hard-codes type sizes that are specific to 64-bit architectures. The assertions in the test fail on i686 (and likely on all 32-bit architectures).

I've seen crates switch from strict assert_eq! to to assert!(a <= b) style checks in similar cases. Another solution would be to use conditional compilation, similar to this:

#[cfg(target_pointer_width = "64")]
assert_eq!(size_of::<Item>(), 24);
#[cfg(target_pointer_width = "32")]
assert_eq!(size_of::<Item>(), 12);

I don't know what the correct sizes would be for StrftimeItems and Locale types, since the tests abort at the first failed assertion.


Output from cargo test --release --all-features:

failures:
---- format::strftime::tests::test_type_sizes stdout ----
thread 'format::strftime::tests::test_type_sizes' panicked at 'assertion failed: `(left == right)`
  left: `12`,
 right: `24`', src/format/strftime.rs:912:9
failures:
    format::strftime::tests::test_type_sizes
test result: FAILED. 232 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.16s

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions