Skip to content

Make rustdoc-tempdir-removal run-make tests work on other platforms than linux #140800

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

Merged
merged 1 commit into from
May 9, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions tests/run-make/rustdoc-tempdir-removal/rmake.rs
Original file line number Diff line number Diff line change
@@ -1,14 +1,22 @@
// This test ensures that no temporary folder is "left behind" when doctests fail for any reason.

//@ only-linux
//@ ignore-cross-compile

use std::path::Path;

use run_make_support::{path, rfs, rustdoc};

fn run_doctest_and_check_tmpdir(tmp_dir: &Path, doctest: &str, edition: &str) {
let output =
rustdoc().input(doctest).env("TMPDIR", tmp_dir).arg("--test").edition(edition).run_fail();
let mut runner = rustdoc();
runner.input(doctest).arg("--test").edition(edition);
let output = if cfg!(unix) {
runner.env("TMPDIR", tmp_dir)
} else if cfg!(windows) {
runner.env("TEMP", tmp_dir).env("TMP", tmp_dir)
} else {
panic!("unsupported OS")
}
.run_fail();

output.assert_exit_code(101).assert_stdout_contains(
"test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out",
Expand Down
Loading