aboutsummaryrefslogtreecommitdiff
path: root/tests/matrix/matrix_test.go
diff options
context:
space:
mode:
authorJakob Unterwurzacher2019-10-06 19:04:16 +0200
committerJakob Unterwurzacher2019-10-06 19:37:51 +0200
commit1fb18f4a9ef2bbbc6e7c774fa064808a3952bb3f (patch)
tree5e27aa2b53c1af53e280dea269cf0039f499f888 /tests/matrix/matrix_test.go
parentd361f6e35bb97ef8f060131ea5b29f922e613c49 (diff)
tests: filter leaked fds by prefix
When running $ go test ./tests/matrix/ in isolation, it failed like this: fd leak? before, after: [0r=/dev/null 3w=/dev/null 5r=/proc/8078/fd (hidden:4)] [0r=/dev/null 3w=/dev/null 5w=/tmp/go-build366655199/b001/testlog.txt 7r=/proc/8078/fd (hidden:4)] Filter by prefix to get rid of this spurious test failure.
Diffstat (limited to 'tests/matrix/matrix_test.go')
-rw-r--r--tests/matrix/matrix_test.go6
1 files changed, 4 insertions, 2 deletions
diff --git a/tests/matrix/matrix_test.go b/tests/matrix/matrix_test.go
index e4424a7..af4769a 100644
--- a/tests/matrix/matrix_test.go
+++ b/tests/matrix/matrix_test.go
@@ -77,11 +77,13 @@ func TestMain(m *testing.M) {
opts = append(opts, fmt.Sprintf("-raw64=%v", testcase.raw64))
opts = append(opts, testcase.extraArgs...)
test_helpers.MountOrExit(test_helpers.DefaultCipherDir, test_helpers.DefaultPlainDir, opts...)
- before := test_helpers.ListFds(0)
+ before := test_helpers.ListFds(0, test_helpers.TmpDir)
r := m.Run()
// Catch fd leaks in the tests. NOTE: this does NOT catch leaks in
// the gocryptfs FUSE process, but only in the tests that access it!
- after := test_helpers.ListFds(0)
+ // All fds that point outside TmpDir are not interesting (the Go test
+ // infrastucture creates temporary log files we don't care about).
+ after := test_helpers.ListFds(0, test_helpers.TmpDir)
if len(before) != len(after) {
fmt.Printf("fd leak in test process? before, after:\n%v\n%v\n", before, after)
os.Exit(1)