-
Notifications
You must be signed in to change notification settings - Fork 12.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Doctests doesn't print the assert failure output #51162
Comments
Do you know where it could come from @QuietMisdreavus? I don't remember us updating this part of rustdoc since a few months. |
Bisecting: /// ```
/// panic!("oh no");
/// ```
pub struct SomeStruct; $ rustdoc +nightly-2018-05-13 --test j.rs
running 1 test
test j.rs - SomeStruct (line 1) ... FAILED
failures:
---- j.rs - SomeStruct (line 1) stdout ----
thread 'j.rs - SomeStruct (line 1)' panicked at 'test executable failed:
thread 'main' panicked at 'oh no', j.rs:3:1
note: Run with `RUST_BACKTRACE=1` for a backtrace.
', librustdoc/test.rs:356:17
note: Run with `RUST_BACKTRACE=1` for a backtrace.
failures:
j.rs - SomeStruct (line 1)
test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out
$ rustdoc +nightly-2018-05-14 --test j.rs
running 1 test
test j.rs - SomeStruct (line 1) ... FAILED
failures:
failures:
j.rs - SomeStruct (line 1)
test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out The only change in |
@QuietMisdreavus looks to me there's a Lines 267 to 268 in 61ba018
|
Ping @QuietMisdreavus, is there any update on this? |
I walked PR-by-PR between those nightlies and found that it was in fact #50235 that caused this. However, that PR doesn't seem to have changed anything about panic handling, or the way things are printed? @rust-lang/compiler I'm a bit lost for what's happening here. |
I think set_panic needs to happen inside each thread and it looks like we might be compiling/running tests inside different threads now in some fashion? I seem to recall such similar behavior last time I looked at a similar issue where the panics during std's tests are printed despite normally being swallowed... |
cc @Zoxc, this is probably not setting some thread-local state? |
I think the |
rustdoc: set panic output before starting compiler thread pool When the compiler was updated to run on a thread pool, rustdoc's processing of compiler/doctest stderr/stdout was moved into each compiler thread. However, this caused output of the test to be lost if the test failed at *runtime* instead of compile time. This change sets up the `set_panic` call and output bomb before starting the compiler thread pool, so that the `Drop` call that writes back to the test's stdout happens after the test runs, not just after it compiles. Fixes #51162
rustdoc: set panic output before starting compiler thread pool When the compiler was updated to run on a thread pool, rustdoc's processing of compiler/doctest stderr/stdout was moved into each compiler thread. However, this caused output of the test to be lost if the test failed at *runtime* instead of compile time. This change sets up the `set_panic` call and output bomb before starting the compiler thread pool, so that the `Drop` call that writes back to the test's stdout happens after the test runs, not just after it compiles. Fixes rust-lang/rust#51162
I run the cargo test command on nightly did not get any output on failing
assert_eq!()
in doctests.I expected to see this happen:
Output on stable(1.26)
Instead, this happened:
Output on nightly (rustc 1.28.0-nightly (5bf68db 2018-05-28))
We verified that it works on a nightly from 20-04-2018.
Meta
rustc --version --verbose
:rustc 1.28.0-nightly (5bf68db 2018-05-28)
binary: rustc
commit-hash: 5bf68db
commit-date: 2018-05-28
host: x86_64-unknown-linux-gnu
release: 1.28.0-nightly
LLVM version: 6.0
The text was updated successfully, but these errors were encountered: