diff options
-rw-r--r-- | tests/xattr/xattr_integration_test.go | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/tests/xattr/xattr_integration_test.go b/tests/xattr/xattr_integration_test.go index 58d62d9..c491f60 100644 --- a/tests/xattr/xattr_integration_test.go +++ b/tests/xattr/xattr_integration_test.go @@ -6,6 +6,7 @@ import ( "io/ioutil" "os" "strings" + "syscall" "testing" xattr "github.com/rfjakob/pkg-xattr" @@ -18,10 +19,10 @@ import ( var alternateTestParentDir = "/var/tmp/gocryptfs-xattr-test-parent" func TestMain(m *testing.M) { - if !xattr.Supported(test_helpers.TmpDir) { + if !xattrSupported(test_helpers.TmpDir) { test_helpers.SwitchTestParentDir(alternateTestParentDir) } - if !xattr.Supported(test_helpers.TmpDir) { + if !xattrSupported(test_helpers.TmpDir) { fmt.Printf("xattrs not supported on %q", test_helpers.TmpDir) os.Exit(1) } @@ -148,3 +149,15 @@ func TestXattrList(t *testing.T) { } } } + +func xattrSupported(path string) bool { + _, err := xattr.Get(path, "user.xattrSupported-dummy-value") + if err == nil { + return true + } + err2 := err.(*xattr.Error) + if err2.Err == syscall.EOPNOTSUPP { + return false + } + return true +} |