From 15cd805dc08f92878ded0dbab88c809ea4b1733a Mon Sep 17 00:00:00 2001 From: Matt Van Horn <455140+mvanhorn@users.noreply.github.com> Date: Wed, 11 Mar 2026 17:47:02 -0700 Subject: [PATCH] Skip testCreateParentDirectories_noPermission when running as root When running tests as root, filesystem permission checks are bypassed, so MoreFiles.createParentDirectories succeeds instead of throwing IOException. Skip the test in this case, similar to the existing Windows skip. Fixes #7328 --- guava-tests/test/com/google/common/io/MoreFilesTest.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/guava-tests/test/com/google/common/io/MoreFilesTest.java b/guava-tests/test/com/google/common/io/MoreFilesTest.java index 4bde486ed3c0..69310d394579 100644 --- a/guava-tests/test/com/google/common/io/MoreFilesTest.java +++ b/guava-tests/test/com/google/common/io/MoreFilesTest.java @@ -300,6 +300,9 @@ public void testCreateParentDirectories_noPermission() { if (isWindows()) { return; // TODO: b/136041958 - Create/find a directory that we don't have permissions on? } + if ("root".equals(System.getProperty("user.name"))) { + return; // Root bypasses filesystem permission checks, so the test expectation doesn't hold. + } Path file = root().resolve("parent/nonexistent.file"); Path parent = file.getParent(); assertFalse(Files.exists(parent));