Skip to content

Intereleaved text in "cargo test" output #84698

@dralley

Description

@dralley

Problem

The following image is two screenshots, side by side, of the output of "cargo test" from two test runs seconds apart with the same code. As you can see, there seems to be a race (or race-like behavior) causing text written to the stdout buffer to be interleaved together.

This is exclusive to when --nocapture is specified. I cannot reproduce if --nocapture is not specified.

Screenshot from 2021-04-29 00-35-07

Usually it works "correctly" but I can I can do this over and over and continue getting different versions of incorrectly printed output each time.

Screenshot from 2021-04-29 00-42-25

Another one

Screenshot from 2021-04-29 00-48-33

Notes

Output of cargo version:

cargo 1.53.0-nightly (0ed318d18 2021-04-23)
rustc 1.53.0-nightly (42816d6 2021-04-24)

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-libtestArea: `#[test]` / the `test` library

    Type

    No type
    No fields configured for issues without a type.

    Projects

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions