summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--internal/syscallcompat/main_test.go3
-rwxr-xr-xtest.bash2
-rw-r--r--tests/test_helpers/helpers.go4
3 files changed, 5 insertions, 4 deletions
diff --git a/internal/syscallcompat/main_test.go b/internal/syscallcompat/main_test.go
index 43db0e1..ddf6bc4 100644
--- a/internal/syscallcompat/main_test.go
+++ b/internal/syscallcompat/main_test.go
@@ -16,7 +16,8 @@ func TestMain(m *testing.M) {
fmt.Println(err)
os.Exit(1)
}
- parent := "/tmp/gocryptfs-test-parent"
+ // Cannot import test_helpers because of import cycle
+ parent := fmt.Sprintf("/tmp/gocryptfs-test-parent-%d", os.Getuid())
err = os.MkdirAll(parent, 0700)
if err != nil {
fmt.Println(err)
diff --git a/test.bash b/test.bash
index bb77a86..8cbbfb0 100755
--- a/test.bash
+++ b/test.bash
@@ -10,7 +10,7 @@ set -eu
cd "$(dirname "$0")"
MYNAME=$(basename "$0")
-TESTDIR=$TMPDIR/gocryptfs-test-parent
+TESTDIR=$TMPDIR/gocryptfs-test-parent-$UID
mkdir -p $TESTDIR
LOCKFILE=$TESTDIR/$MYNAME.lock
diff --git a/tests/test_helpers/helpers.go b/tests/test_helpers/helpers.go
index fd36f76..7275997 100644
--- a/tests/test_helpers/helpers.go
+++ b/tests/test_helpers/helpers.go
@@ -59,8 +59,8 @@ func init() {
func doInit() {
X255 = string(bytes.Repeat([]byte("X"), 255))
MountInfo = make(map[string]mountInfo)
-
- testParentDir := os.TempDir() + "/gocryptfs-test-parent"
+ // Something like /tmp/gocryptfs-test-parent-1234
+ testParentDir := fmt.Sprintf("%s/gocryptfs-test-parent-%d", os.TempDir(), os.Getuid())
os.MkdirAll(testParentDir, 0700)
var err error
TmpDir, err = ioutil.TempDir(testParentDir, "")