tests: clarify which process seems to be leaking fds

The tests check if they leak fds themselves, but we also
check if gocryptfs leaks fds. Clarify what is what in the
error message.
This commit is contained in:
Jakob Unterwurzacher 2019-10-06 18:48:09 +02:00
parent 44e5c9ab96
commit d361f6e35b
3 changed files with 3 additions and 3 deletions

View File

@ -26,7 +26,7 @@ func TestMain(m *testing.M) {
r := m.Run() r := m.Run()
after := test_helpers.ListFds(0) after := test_helpers.ListFds(0)
if len(before) != len(after) { if len(before) != len(after) {
fmt.Printf("fd leak? before, after:\n%v\n%v\n", before, after) fmt.Printf("fd leak in test process? before, after:\n%v\n%v\n", before, after)
os.Exit(1) os.Exit(1)
} }
os.Exit(r) os.Exit(r)

View File

@ -83,7 +83,7 @@ func TestMain(m *testing.M) {
// the gocryptfs FUSE process, but only in the tests that access it! // the gocryptfs FUSE process, but only in the tests that access it!
after := test_helpers.ListFds(0) after := test_helpers.ListFds(0)
if len(before) != len(after) { if len(before) != len(after) {
fmt.Printf("fd leak? before, after:\n%v\n%v\n", before, after) fmt.Printf("fd leak in test process? before, after:\n%v\n%v\n", before, after)
os.Exit(1) os.Exit(1)
} }
test_helpers.UnmountPanic(test_helpers.DefaultPlainDir) test_helpers.UnmountPanic(test_helpers.DefaultPlainDir)

View File

@ -175,7 +175,7 @@ func UnmountErr(dir string) (err error) {
err = cmd.Run() err = cmd.Run()
if err == nil { if err == nil {
if len(fdsNow) > len(fds)+maxCacheFds { if len(fdsNow) > len(fds)+maxCacheFds {
return fmt.Errorf("FD leak? pid=%d dir=%q, fds:\nold=%v \nnew=%v\n", pid, dir, fds, fdsNow) return fmt.Errorf("fd leak in gocryptfs process? pid=%d dir=%q, fds:\nold=%v \nnew=%v\n", pid, dir, fds, fdsNow)
} }
return nil return nil
} }