LiveSplit / livesplit-core

livesplit-core is a library that provides a lot of functionality for creating a speedrun timer.
https://livesplit.org/
Apache License 2.0
210 stars 58 forks source link

Run Tests with miri #192

Open CryZe opened 5 years ago

CryZe commented 5 years ago

Run all the suitable tests with miri. Panicking ones and possibly really expensive ones should probably be skipped. Random numbers, such as necessary for Hash Maps are now possible with -Zmiri-seed=123. Accessing time stamps doesn't work with miri either, but fortunately, we already dealt with this problem for wasm-unknown, so miri is just another platform where we mock the time stamps.

CryZe commented 5 years ago

Looks like parsing from actual files doesn't work either, so I guess we skip that too. However we have one test where we encode and immediately parse a run as LSS. There we don't need a file system, so in theory it should work. But it doesn't, because the parsing uses the memchr crate internally, which uses cpuid + core::arch on x86, which isn't supported by miri. So if we want to test parsing (which we really should want), then memchr needs to cfg(miri) in the fallback implementation they have. So I guess I'll mark this as blocked in the meantime.

CryZe commented 5 years ago

For the file parsing we can just include_str / include_bytes them into the tests. Then we can just parse them normally, once memchr works.

CryZe commented 4 years ago

This is now unblocked. memchr 2.3.1 just got released and is miri compatible. AAaaaannnd it's yanked. I guess 2.3.2 will be released soon though.

CryZe commented 4 years ago

One problem I'm seeing is that running the tests with miri is VERY SLOW. It's so slow that this is going to cost us a lot of time on CI. Maybe we could run it periodically instead of for every PR.