Merge pull request #1217 from tmccombs/skip-executable-test-if-root

Skip an executable test if running as root
This commit is contained in:
David Peter 2022-12-29 14:16:01 +01:00 committed by GitHub
commit de611c8835
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1202,6 +1202,13 @@ fn test_type() {
fn test_type_executable() {
use std::os::unix::fs::OpenOptionsExt;
// This test assumes the current user isn't root
// (otherwise if the executable bit is set for any level, it is executable for the current
// user)
if users::get_current_uid() == 0 {
return;
}
let te = TestEnv::new(DEFAULT_DIRS, DEFAULT_FILES);
fs::OpenOptions::new()