From e479779a7f39e66d3f76673f18308906e817be02 Mon Sep 17 00:00:00 2001 From: Eric Biggers Date: Wed, 12 May 2021 13:28:30 -0700 Subject: filesystem: skip TestHaveReadAccessTo() when running as root Root can read all files, so this test fails when running as root. Skip it instead. Resolves https://github.com/google/fscrypt/issues/288 --- filesystem/path_test.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/filesystem/path_test.go b/filesystem/path_test.go index 4152037..1c59dd5 100644 --- a/filesystem/path_test.go +++ b/filesystem/path_test.go @@ -23,6 +23,8 @@ import ( "io/ioutil" "os" "testing" + + "github.com/google/fscrypt/util" ) func TestDeviceNumber(t *testing.T) { @@ -56,6 +58,9 @@ func TestDeviceNumber(t *testing.T) { } func TestHaveReadAccessTo(t *testing.T) { + if util.IsUserRoot() { + t.Skip("This test cannot be run as root") + } file, err := ioutil.TempFile("", "fscrypt_test") if err != nil { t.Fatal(err) -- cgit v1.2.3