Skip to content

Improving test coverage (as in, the amount of tests we manage to run) #7

@saethlin

Description

@saethlin

I recently adjusted the timeout logic to not include test build time in the 15 minute timeout. While this may be a bit unintuitive, our total lack of caching here means that if we don't do this, we see some crates time out without executing any code at all bevy-inspector-egui is one example. And quite a few crates have build times above 10 minutes (with --jobs=1), which is hardly giving their tests a fair chance to run.

But we have other much thornier problems with test coverage. For example, parking_lot_core builds in 10 seconds then spends the rest of its 15 minutes running its first integration test. So we should have some mechanism to time out individual tests. I looked into the unstable --ensure-time option in libtest and it looks like it is both broken and not what I want here.

But there are also crates like unicode-xid which experience blowup in the Stacked Borrows runtime because of borrow stacks associated with a static allocation. In that scenario, the initial memory footprint of the test runner will grow from test to test. Normally the Stacked Borrows memory overhead stays in check because all resources associate with an allocation are freed when the allocation is, but that's not the case with a large static that is oft-reborrowed in complex ways (like when doing a lot of binary searches).

Therefore, I think the best solution here is to run each test in its own process, and time them out individually. We can't use the -Cpanic=abort support in libtest, because the libtest code is run inside Miri and Miri does not have all the shims required to launch a subprocess and capture output. We also can't do this inside cargo-miri by running cargo test -- --list then cargo test -- --exact test_name because --list does not print a unique name that can be fed back to --exact. It might be this last issue that is the easiest to fix.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions