compiletest-rs
compiletest-rs copied to clipboard
panic if TERM environment variable is "dumb"
If I do a compiletest test run under Emacs, Emacs sets the TERM
environment variable to "dumb"
, and then the test run panics:
running 2 tests
test [compile-fail] asynchronous/async-fn-not-unpin.rs ...
thread '[compile-fail] asynchronous/wrong_mutex.rs' panicked at 'called `Result::unwrap()` on an `Err` value: "SendError(..)"', /home/jimb/.cargo/registry/src/github.com-1ecc6299db9ec823/tester-0.7.0/src/lib.rs:598:5
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
test [compile-fail] enums/exclusive_range_patterns.rs ...
...
If I change the test command to TERM=ansi cargo test
, then all is well.
This is the panicking line, in the tester
crate's run_test_in_process
function:
monitor_ch.send(message).unwrap();
where monitor_ch
is a Sender<CompletedTest>
.
The only thing I can imagine compiletest uses TERM
for is the color in the output. So I'd guess that whoever is supposed to be receiving on this channel exited early for some color-related reason. Ideally, if color is not available, one should simply not emit the color escape codes.
Hi @jimblandy, thank you for reporting this issue. I'm having trouble recreating it on my local machine. Running TERM=dumb cargo test
in our test-project doesn't seem to exhibit the error you've described. What project are you running this on? Can you perhaps supply a minimal working example?
Furthermore, if the panicking line is in the tester crate, I think it would be best to report the error there?
Here's a test case: https://github.com/jimblandy/compiletest-issue-219
This is on Fedora.
Okay, I filed an issue against the tester crate: https://github.com/messense/rustc-test/issues/6
Thank you @jimblandy, that reproduces the issue for me here. I don't have time to look at the issue at the moment, unfortunately, let's hope someone else does.