-
Notifications
You must be signed in to change notification settings - Fork 12.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto merge of #52181 - QuietMisdreavus:panicked-tester, r=GuillaumeGomez
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
- Loading branch information
Showing
5 changed files
with
132 additions
and
55 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT | ||
// file at the top-level directory of this distribution and at | ||
// http://rust-lang.org/COPYRIGHT. | ||
// | ||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or | ||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license | ||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your | ||
// option. This file may not be copied, modified, or distributed | ||
// except according to those terms. | ||
|
||
// Issue #51162: A failed doctest was not printing its stdout/stderr | ||
// FIXME: if/when the output of the test harness can be tested on its own, this test should be | ||
// adapted to use that, and that normalize line can go away | ||
|
||
// compile-flags:--test | ||
// normalize-stdout-test: "src/test/rustdoc-ui" -> "$$DIR" | ||
// failure-status: 101 | ||
|
||
// doctest fails at runtime | ||
/// ``` | ||
/// panic!("oh no"); | ||
/// ``` | ||
pub struct SomeStruct; | ||
|
||
// doctest fails at compile time | ||
/// ``` | ||
/// no | ||
/// ``` | ||
pub struct OtherStruct; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
|
||
running 2 tests | ||
test $DIR/failed-doctest-output.rs - OtherStruct (line 26) ... FAILED | ||
test $DIR/failed-doctest-output.rs - SomeStruct (line 20) ... FAILED | ||
|
||
failures: | ||
|
||
---- $DIR/failed-doctest-output.rs - OtherStruct (line 26) stdout ---- | ||
error[E0425]: cannot find value `no` in this scope | ||
--> $DIR/failed-doctest-output.rs:27:1 | ||
| | ||
3 | no | ||
| ^^ not found in this scope | ||
|
||
thread '$DIR/failed-doctest-output.rs - OtherStruct (line 26)' panicked at 'couldn't compile the test', librustdoc/test.rs:332:13 | ||
note: Run with `RUST_BACKTRACE=1` for a backtrace. | ||
|
||
---- $DIR/failed-doctest-output.rs - SomeStruct (line 20) stdout ---- | ||
thread '$DIR/failed-doctest-output.rs - SomeStruct (line 20)' panicked at 'test executable failed: | ||
|
||
thread 'main' panicked at 'oh no', $DIR/failed-doctest-output.rs:3:1 | ||
note: Run with `RUST_BACKTRACE=1` for a backtrace. | ||
|
||
', librustdoc/test.rs:367:17 | ||
|
||
|
||
failures: | ||
$DIR/failed-doctest-output.rs - OtherStruct (line 26) | ||
$DIR/failed-doctest-output.rs - SomeStruct (line 20) | ||
|
||
test result: FAILED. 0 passed; 2 failed; 0 ignored; 0 measured; 0 filtered out | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters