Skip to content

Commit

Permalink
tests: use /var/tmp by default
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
rfjakob committed Oct 6, 2019
1 parent 00af4f4 commit 8c44294
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 15 deletions.
2 changes: 1 addition & 1 deletion test.bash
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/bash

if [[ -z $TMPDIR ]]; then
TMPDIR=/tmp
TMPDIR=/var/tmp
else
echo "Using TMPDIR=$TMPDIR"
fi
Expand Down
8 changes: 0 additions & 8 deletions tests/test_helpers/helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}
Expand Down
6 changes: 0 additions & 6 deletions tests/xattr/xattr_integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 8c44294

Please sign in to comment.