Repository navigation
[rustdoc] Move the creation of IndividualTestOptions into the test runner closure to ensure the temporary folder is removed right after the test is done running
#164202
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| /// ``` | ||
| /// assert!(true); | ||
| /// ``` | ||
| pub fn a() {} | ||
|
|
||
| /// ``` | ||
| /// let count = std::fs::read_dir(std::env::temp_dir()) | ||
| /// .unwrap() | ||
| /// .filter(|entry| { | ||
| /// entry.as_ref().unwrap().file_name().to_str().unwrap().starts_with("rustdoctest") | ||
| /// }) | ||
| /// .count(); | ||
| /// // It's 2 and not one because rustdoc creates a temp dir where it puts the `rustdoc-cfgs` | ||
| /// // file which contains the list of flags to be passed down to the doctests. It lives | ||
| /// // until all doctests have been run. | ||
| /// assert_eq!(count, 2); | ||
| /// ``` | ||
| pub fn b() {} | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| // This test ensures that a temporary doctest directory is removed as soon as the doctest | ||
| // was run to prevent "No space left on device". To ensure it works, we use a file with two | ||
| // doctests, run without the "merged doctests" feature (hence the "2021" edition) with | ||
| // one thread to prevent potential concurrent cleanups. | ||
| // Regression test for <https://github.com/rust-lang/rust/issues/164145>. | ||
|
|
||
| //@ ignore-cross-compile | ||
| //@ only-linux | ||
|
|
||
| use run_make_support::{is_windows, path, rfs, rustdoc}; | ||
|
|
||
| fn main() { | ||
| let tmp = path("tmp"); | ||
| rfs::create_dir(&tmp); | ||
|
|
||
| let mut cmd = rustdoc() | ||
| .env("TMPDIR", &tmp) | ||
| .input("lib.rs") | ||
| .edition("2021") | ||
| .arg("--test") | ||
| .arg("--test-args=--test-threads=1") | ||
| .run(); | ||
| } |
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
|
|
||
| running 1 test | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This change is because we used to try to make the temporary directly ahead of the |
||
| test $DIR/issue-98690.rs - (line 9) ... FAILED | ||
|
|
||
| failures: | ||
|
|
||
| ---- $DIR/issue-98690.rs - (line 9) stdout ---- | ||
| Couldn't create directory for doctest executables: Permission denied (os error 13) | ||
|
|
||
|
|
||
| failures: | ||
| $DIR/issue-98690.rs - (line 9) | ||
|
|
||
| test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out; finished in $TIME | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is 2 the right number here? Shouldn't it be 1 if the previous test got cleaned up?
View changes since the review
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We create a first temp dir where we write the
rustdoc-cfgsfile which contains the list of all args to be passed to the doctests. But I'll write a code comment to explain it.