From 1fb18f4a9ef2bbbc6e7c774fa064808a3952bb3f Mon Sep 17 00:00:00 2001 From: Jakob Unterwurzacher Date: Sun, 6 Oct 2019 19:04:16 +0200 Subject: 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. --- tests/matrix/matrix_test.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'tests/matrix') 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) -- cgit v1.2.3