aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Biggers <ebiggers@google.com>2021-05-12 13:28:30 -0700
committerEric Biggers <ebiggers3@gmail.com>2021-05-12 14:43:41 -0700
commite479779a7f39e66d3f76673f18308906e817be02 (patch)
tree82da2347922b95a8b67bfd4067af17ec04386dad
parent677ae754e12d570bdc48efaacae83c0fb8b72e8b (diff)
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
-rw-r--r--filesystem/path_test.go5
1 files changed, 5 insertions, 0 deletions
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)