aboutsummaryrefslogtreecommitdiff
path: root/tests/xattr/xattr_integration_test.go
diff options
context:
space:
mode:
authorJakob Unterwurzacher2018-03-26 21:54:17 +0200
committerJakob Unterwurzacher2018-03-26 21:54:17 +0200
commitb1f362d28af28e35ae8d24813ad00a8f033ed861 (patch)
treecaa8387b14d1682bf0bf97533a102d0fbd332bac /tests/xattr/xattr_integration_test.go
parentdb778aae7db844e77b602816a4fd0aeab5d6857e (diff)
tests: replace xattr.Supported
This function has been deprecated by the pkg/xattr upstream, so write our own.
Diffstat (limited to 'tests/xattr/xattr_integration_test.go')
-rw-r--r--tests/xattr/xattr_integration_test.go17
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
+}