From a36f2cf61ce059bfcef8ed8fa99ab526a0771aad Mon Sep 17 00:00:00 2001 From: Thayne McCombs Date: Wed, 28 Dec 2022 23:28:41 -0700 Subject: [PATCH] Skip an executable test if running as root Fixes #1214 --- tests/tests.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tests/tests.rs b/tests/tests.rs index b77eb65..5036afd 100644 --- a/tests/tests.rs +++ b/tests/tests.rs @@ -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()