diff options
| author | Eric Biggers <ebiggers@google.com> | 2021-05-12 13:28:30 -0700 |
|---|---|---|
| committer | Eric Biggers <ebiggers3@gmail.com> | 2021-05-12 14:43:41 -0700 |
| commit | e479779a7f39e66d3f76673f18308906e817be02 (patch) | |
| tree | 82da2347922b95a8b67bfd4067af17ec04386dad | |
| parent | 677ae754e12d570bdc48efaacae83c0fb8b72e8b (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.go | 5 |
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) |