use rfs in rustdoc io rmake test

This commit is contained in:
Rémy Rakic 2024-08-11 09:34:26 +00:00
parent f4cb0de44e
commit dcd6170c89

View File

@ -14,22 +14,20 @@
// `mkfs.ext4 -d`, as well as mounting a loop device for the rootfs.
//@ ignore-windows - the `set_readonly` functions doesn't work on folders.
use std::fs;
use run_make_support::{path, rustdoc};
use run_make_support::{path, rfs, rustdoc};
fn main() {
let out_dir = path("rustdoc-io-error");
fs::create_dir(&out_dir).unwrap();
let mut permissions = fs::metadata(&out_dir).unwrap().permissions();
rfs::create_dir(&out_dir);
let mut permissions = rfs::metadata(&out_dir).permissions();
let original_permissions = permissions.clone();
permissions.set_readonly(true);
fs::set_permissions(&out_dir, permissions).unwrap();
rfs::set_permissions(&out_dir, permissions);
let output = rustdoc().input("foo.rs").output(&out_dir).env("RUST_BACKTRACE", "1").run_fail();
fs::set_permissions(&out_dir, original_permissions).unwrap();
rfs::set_permissions(&out_dir, original_permissions);
output
.assert_exit_code(1)