Skip to content

Race in build::cargo_compile_with_invalid_code_in_deps #17161

Description

@ehuss

The test build::cargo_compile_with_invalid_code_in_deps has a race that can cause the test to sporadically fail. If, for whatever reason, one job finishes before the second one starts, then it will only emit one error.

The test previously only checked a subset of the output to handle this situation (and also checked what the error was):

p.cargo("build")
        .with_status(101)
        .with_stderr_contains("[..]invalid rust code[..]")
        .with_stderr_contains("[ERROR] could not compile [..]")
        .run();

But with the change to check the entire output, it is now not doing the same checks.

The error is:

---- build::cargo_compile_with_invalid_code_in_deps stdout ----
running `/Users/runner/work/cargo/cargo/target/debug/cargo build`

thread 'build::cargo_compile_with_invalid_code_in_deps' (97001) panicked at tests/testsuite/build.rs:888:10:

---- expected: tests/testsuite/build.rs:878:13
++++ actual:   stderr
   1    1 | [COMPILING] bar v0.1.0 ([ROOT]/bar)
   2      - [COMPILING] baz v0.1.0 ([ROOT]/baz)
   3    2 | [ERROR] could not compile `bar` (lib) due to 1 previous error
Error: m   4      - [ERROR] could not compile `baz` (lib) due to 1 previous error
   5    3 | ...

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions