Commit 5cc7a5c7b389066ab7398006819ab31b67b3a187

Edward Thomson 2016-04-11T13:39:31

tests: skip the unreadable file tests as root When running as root, skip the unreadable file tests, because, well, they're probably _not_ unreadable to root unless you've got some crazy NSA clearance-level honoring operating system shit going on.

diff --git a/tests/repo/iterator.c b/tests/repo/iterator.c
index c18e24a..6b5795b 100644
--- a/tests/repo/iterator.c
+++ b/tests/repo/iterator.c
@@ -1020,6 +1020,11 @@ void test_repo_iterator__unreadable_dir(void)
 	if (!cl_is_chmod_supported())
 		return;
 
+#ifndef GIT_WIN32
+	if (geteuid() == 0)
+		cl_skip();
+#endif
+
 	g_repo = cl_git_sandbox_init("empty_standard_repo");
 
 	cl_must_pass(p_mkdir("empty_standard_repo/r", 0777));
diff --git a/tests/status/worktree.c b/tests/status/worktree.c
index 6b82378..5d3b4d5 100644
--- a/tests/status/worktree.c
+++ b/tests/status/worktree.c
@@ -1006,6 +1006,9 @@ void test_status_worktree__unreadable(void)
 	git_status_options opts = GIT_STATUS_OPTIONS_INIT;
 	status_entry_counts counts = {0};
 
+	if (geteuid() == 0)
+		cl_skip();
+
 	/* Create directory with no read permission */
 	cl_git_pass(git_futils_mkdir_r("empty_standard_repo/no_permission", 0777));
 	cl_git_mkfile("empty_standard_repo/no_permission/foo", "dummy");