Skip to content
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

Migrate run-make/rustdoc-io-error to rmake.rs #124807

Merged
merged 2 commits into from
Jun 20, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
1 change: 0 additions & 1 deletion src/tools/tidy/src/allowed_run_make_makefiles.txt
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,6 @@ run-make/rlib-format-packed-bundled-libs-3/Makefile
run-make/rlib-format-packed-bundled-libs/Makefile
run-make/rmeta-preferred/Makefile
run-make/rustc-macro-dep-files/Makefile
run-make/rustdoc-io-error/Makefile
run-make/sanitizer-cdylib-link/Makefile
run-make/sanitizer-dylib-link/Makefile
run-make/sanitizer-staticlib-link/Makefile
Expand Down
20 changes: 0 additions & 20 deletions tests/run-make/rustdoc-io-error/Makefile

This file was deleted.

31 changes: 31 additions & 0 deletions tests/run-make/rustdoc-io-error/rmake.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
// This test verifies that rustdoc doesn't ICE when it encounters an IO error
// while generating files. Ideally this would be a rustdoc-ui test, so we could
// verify the error message as well.
//
// It operates by creating a temporary directory and modifying its
// permissions so that it is not writable. We have to take special care to set
// the permissions back to normal so that it's able to be deleted later.
jieyouxu marked this conversation as resolved.
Show resolved Hide resolved

// On windows, the `set_readonly` functions doesn't work on folders.
//@ ignore-windows

use run_make_support::{path, rustdoc};
use std::fs;

fn main() {
let out_dir = path("rustdoc-io-error");
let output = fs::create_dir(&out_dir).unwrap();
let mut permissions = fs::metadata(&out_dir).unwrap().permissions();
let original_permissions = permissions.clone();

permissions.set_readonly(true);
fs::set_permissions(&out_dir, permissions).unwrap();
jieyouxu marked this conversation as resolved.
Show resolved Hide resolved

let output = rustdoc().input("foo.rs").output(&out_dir).env("RUST_BACKTRACE", "1").run_fail();

fs::set_permissions(&out_dir, original_permissions).unwrap();

output
.assert_exit_code(1)
.assert_stderr_contains("error: couldn't generate documentation: Permission denied");
}
Loading