summaryrefslogtreecommitdiff
path: root/tests/xattr/xattr_integration_test.go
diff options
context:
space:
mode:
authorJakob Unterwurzacher2018-10-10 22:24:20 +0200
committerJakob Unterwurzacher2018-10-10 22:24:20 +0200
commit5a1ebdb4f7449759656a1344d3c63ba3798e2782 (patch)
treea551606ba0c53521fee1b93c71ee268682493644 /tests/xattr/xattr_integration_test.go
parente4f1a32a9a109805107fc0655006f2eedf75c52c (diff)
tests: respect TMPDIR if set
Setting TMPDIR now allows to run the tests against a directory of your choice, making it easier to test different filesystems.
Diffstat (limited to 'tests/xattr/xattr_integration_test.go')
-rw-r--r--tests/xattr/xattr_integration_test.go13
1 files changed, 6 insertions, 7 deletions
diff --git a/tests/xattr/xattr_integration_test.go b/tests/xattr/xattr_integration_test.go
index 6d4c0c3..a989060 100644
--- a/tests/xattr/xattr_integration_test.go
+++ b/tests/xattr/xattr_integration_test.go
@@ -16,16 +16,15 @@ import (
"github.com/rfjakob/gocryptfs/tests/test_helpers"
)
-// On modern Linux distributions, /tmp may be on tmpfs,
-// which does not support user xattrs. Try /var/tmp instead.
-var alternateTestParentDir = "/var/tmp/gocryptfs-xattr-test-parent"
-
func TestMain(m *testing.M) {
- if !xattrSupported(test_helpers.TmpDir) {
- test_helpers.SwitchTestParentDir(alternateTestParentDir)
+ // On modern Linux distributions, /tmp may be on tmpfs,
+ // which does not support user xattrs. Try /var/tmp instead
+ if !xattrSupported(test_helpers.TmpDir) && os.TempDir() == "/tmp" {
+ fmt.Printf("Switching from /tmp to /var/tmp for xattr tests\n")
+ test_helpers.SwitchTMPDIR("/var/tmp")
}
if !xattrSupported(test_helpers.TmpDir) {
- fmt.Printf("xattrs not supported on %q", test_helpers.TmpDir)
+ fmt.Printf("xattrs not supported on %q\n", test_helpers.TmpDir)
os.Exit(1)
}
test_helpers.ResetTmpDir(true)