crossterm-rs / crossterm

Cross platform terminal library rust
MIT License
3.28k stars 281 forks source link

random test failures in style::types::colored::tests::test_parse_ansi_bg/fg #836

Open decathorpe opened 1 year ago

decathorpe commented 1 year ago

I'm packaging this crate for Fedora Linux, and I noticed that there's some seemingly random test failures with version 0.27.0 - either the style::types::colored::tests::test_parse_ansi_bg or the style::types::colored::tests::test_parse_ansi_fg (or both) tests fail, but not always.

The failures look like this (from cargo test output):

failures:
---- style::types::colored::tests::test_parse_ansi_fg stdout ----
thread 'style::types::colored::tests::test_parse_ansi_fg' panicked at 'assertion failed: `(left == right)`
  left: `None`,
 right: `Some(ForegroundColor(AnsiValue(249)))`', src/style/types/colored.rs:244:13
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
---- style::types::colored::tests::test_parse_ansi_bg stdout ----
thread 'style::types::colored::tests::test_parse_ansi_bg' panicked at 'assertion failed: `(left == right)`
  left: `None`,
 right: `Some(ForegroundColor(AnsiValue(120)))`', src/style/types/colored.rs:244:13
failures:
    style::types::colored::tests::test_parse_ansi_bg
    style::types::colored::tests::test_parse_ansi_fg
test result: FAILED. 78 passed; 2 failed; 7 ignored; 0 measured; 0 filtered out; finished in 0.01s

This happens with both Rust 1.73 and 1.66.

Is it possible that those tests are sensitive to being run "massively" parallel? Some of our build machine have dozens of CPUs.