From 8c4429408716d9890a98a48c246d616dbfea7e31 Mon Sep 17 00:00:00 2001
From: Jakob Unterwurzacher
Date: Sun, 6 Oct 2019 21:50:27 +0200
Subject: tests: use /var/tmp by default

On Fedora, /tmp is tmpfs, which behaves differently than ext4
(inode numbers are never reused, for example).

Use /var/tmp, which is ext4 on Fedora, to get a more realistic
test environment.

This also allows us to drop the xattr workaround.
---
 test.bash                             | 2 +-
 tests/test_helpers/helpers.go         | 8 --------
 tests/xattr/xattr_integration_test.go | 6 ------
 3 files changed, 1 insertion(+), 15 deletions(-)

diff --git a/test.bash b/test.bash
index 8cbbfb0..8cc40bc 100755
--- a/test.bash
+++ b/test.bash
@@ -1,7 +1,7 @@
 #!/bin/bash
 
 if [[ -z $TMPDIR ]]; then
-	TMPDIR=/tmp
+	TMPDIR=/var/tmp
 else
 	echo "Using TMPDIR=$TMPDIR"
 fi
diff --git a/tests/test_helpers/helpers.go b/tests/test_helpers/helpers.go
index df71e52..17d2f98 100644
--- a/tests/test_helpers/helpers.go
+++ b/tests/test_helpers/helpers.go
@@ -44,14 +44,6 @@ var DefaultPlainDir string
 // DefaultCipherDir is TmpDir + "/default-cipher"
 var DefaultCipherDir string
 
-// SwitchTMPDIR changes TMPDIR and hence the directory the test are performed in.
-// This is used when you want to perform tests on a special filesystem. The
-// xattr tests cannot run on tmpfs and use /var/tmp instead of /tmp.
-func SwitchTMPDIR(newDir string) {
-	os.Setenv("TMPDIR", newDir)
-	doInit()
-}
-
 func init() {
 	doInit()
 }
diff --git a/tests/xattr/xattr_integration_test.go b/tests/xattr/xattr_integration_test.go
index 29c3e84..b091830 100644
--- a/tests/xattr/xattr_integration_test.go
+++ b/tests/xattr/xattr_integration_test.go
@@ -23,12 +23,6 @@ import (
 )
 
 func TestMain(m *testing.M) {
-	// 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\n", test_helpers.TmpDir)
 		os.Exit(1)
-- 
cgit v1.2.3