run_make_support::scoped_run

Function test_while_readonly

Source
pub fn test_while_readonly<P, F>(path: P, closure: F)
where P: AsRef<Path>, F: FnOnce() + UnwindSafe,
Expand description

Ensure that the path P is read-only while the test runs, and restore original permissions at the end so compiletest can clean up. This will panic on Windows if the path is a directory (as it would otherwise do nothing)

§Pitfalls

  • Some CI runners are ran as root which may bypass read-only permission restrictions. Unclear exactly when such scenarios occur.

§FIXME

FIXME(Oneirical): This will no longer be required after compiletest receives the ability to manipulate read-only files. See https://github.com/rust-lang/rust/issues/126334.