Skip to content

cargo llvm-cov nextest no multithreading for funtional tests? #258

@Dushistov

Description

@Dushistov

In crate I have "unit" tests and "functional" one.

// src/lib.rs
pub fn sleep(secs: u32) {
    std::thread::sleep(std::time::Duration::from_secs(secs.into()));
}

#[cfg(test)]
mod tests {
    use super::*;

    #[test]
    fn test_8() {
        sleep(8);
    }
}
// tests/functional_tests.rs
use crate_example_with_tests::*;

#[test]
fn test_30() {
    sleep(30);
}

Because of number of CPU on my machine is >=2 I expect that execution time cargo nextest
is equal to time of the slowest test - test_30, and it works as expected:

❯ cargo nextest run
   Compiling crate_example_with_tests v0.1.0 (/home/evgeniy/bigdisk1/projects/rust-infra/crate_example_with_tests)
    Finished test [unoptimized + debuginfo] target(s) in 0.26s
    Starting 2 tests across 2 binaries
        PASS [   8.003s] crate_example_with_tests tests::test_8
        PASS [  30.003s] crate_example_with_tests::functional_tests test_30
------------
     Summary [  30.003s] 2 tests run: 2 passed, 0 skipped

but with llvm-cov it for some reasons waits all unit tests to pass, before starting functional tests:

❯ cargo llvm-cov nextest
   Compiling crate_example_with_tests v0.1.0 (/home/evgeniy/bigdisk1/projects/rust-infra/crate_example_with_tests)
    Finished test [unoptimized + debuginfo] target(s) in 0.33s
    Starting 2 tests across 2 binaries
        PASS [   8.003s] crate_example_with_tests tests::test_8
        PASS [  30.004s] crate_example_with_tests::functional_tests test_30
------------
     Summary [  38.008s] 2 tests run: 2 passed, 0 skipped

On real project all looks worse.
Is any way to run functional and unit tests in parallel with llvm-cov?

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-nextestArea: nextest integration https://github.com/nextest-rs/nextestC-upstream-bugCategory: This is a bug of compiler or dependencies (the fix may require action in the upstream)

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions