Skip to content

Commit 8c44294

Browse files
committed
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.
1 parent 00af4f4 commit 8c44294

File tree

3 files changed

+1
-15
lines changed

3 files changed

+1
-15
lines changed

test.bash

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/bin/bash
22

33
if [[ -z $TMPDIR ]]; then
4-
TMPDIR=/tmp
4+
TMPDIR=/var/tmp
55
else
66
echo "Using TMPDIR=$TMPDIR"
77
fi

tests/test_helpers/helpers.go

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -44,14 +44,6 @@ var DefaultPlainDir string
4444
// DefaultCipherDir is TmpDir + "/default-cipher"
4545
var DefaultCipherDir string
4646

47-
// SwitchTMPDIR changes TMPDIR and hence the directory the test are performed in.
48-
// This is used when you want to perform tests on a special filesystem. The
49-
// xattr tests cannot run on tmpfs and use /var/tmp instead of /tmp.
50-
func SwitchTMPDIR(newDir string) {
51-
os.Setenv("TMPDIR", newDir)
52-
doInit()
53-
}
54-
5547
func init() {
5648
doInit()
5749
}

tests/xattr/xattr_integration_test.go

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,6 @@ import (
2323
)
2424

2525
func TestMain(m *testing.M) {
26-
// On modern Linux distributions, /tmp may be on tmpfs,
27-
// which does not support user xattrs. Try /var/tmp instead
28-
if !xattrSupported(test_helpers.TmpDir) && os.TempDir() == "/tmp" {
29-
fmt.Printf("Switching from /tmp to /var/tmp for xattr tests\n")
30-
test_helpers.SwitchTMPDIR("/var/tmp")
31-
}
3226
if !xattrSupported(test_helpers.TmpDir) {
3327
fmt.Printf("xattrs not supported on %q\n", test_helpers.TmpDir)
3428
os.Exit(1)

0 commit comments

Comments
 (0)