rust/tests/run-make/issue-107495-archive-permissions/rmake.rs
Nicholas Nethercote 84ac80f192 Reformat use declarations.
The previous commit updated `rustfmt.toml` appropriately. This commit is
the outcome of running `x fmt --all` with the new formatting options.
2024-07-29 08:26:52 +10:00

31 lines
549 B
Rust

#![feature(rustc_private)]
#[cfg(unix)]
extern crate libc;
#[cfg(unix)]
use std::os::unix::fs::PermissionsExt;
use std::path::Path;
use run_make_support::{aux_build, rfs};
fn main() {
#[cfg(unix)]
unsafe {
libc::umask(0o002);
}
aux_build().arg("foo.rs").run();
verify(Path::new("libfoo.rlib"));
}
fn verify(path: &Path) {
let perm = rfs::metadata(path).permissions();
assert!(!perm.readonly());
// Check that the file is readable for everyone
#[cfg(unix)]
assert_eq!(perm.mode(), 0o100664);
}