aboutsummaryrefslogtreecommitdiff
path: root/tests/cli
diff options
context:
space:
mode:
authorJakob Unterwurzacher2018-04-07 15:46:41 +0200
committerJakob Unterwurzacher2018-04-07 15:46:41 +0200
commit9d7392a5be7e21aaaf2fb02f19b421c29e304632 (patch)
tree24d2e83a7fdb3887ac2891c5e6bc2efcf63b0e7e /tests/cli
parent22031d7e531985e9e94d694e74fb00da99de72a5 (diff)
tests: cli_test: fix fd leak
One fd leak found in TestMountBackground.
Diffstat (limited to 'tests/cli')
-rw-r--r--tests/cli/cli_test.go8
1 files changed, 8 insertions, 0 deletions
diff --git a/tests/cli/cli_test.go b/tests/cli/cli_test.go
index 2f27ec7..24bb029 100644
--- a/tests/cli/cli_test.go
+++ b/tests/cli/cli_test.go
@@ -3,6 +3,7 @@ package cli
// Test CLI operations like "-init", "-password" etc
import (
+ "fmt"
"io/ioutil"
"os"
"os/exec"
@@ -20,7 +21,13 @@ var testPw = []byte("test")
func TestMain(m *testing.M) {
test_helpers.ResetTmpDir(false)
+ before := test_helpers.ListFds()
r := m.Run()
+ after := test_helpers.ListFds()
+ if len(before) != len(after) {
+ fmt.Printf("fd leak? before, after:\n%v\n%v\n", before, after)
+ os.Exit(1)
+ }
os.Exit(r)
}
@@ -404,6 +411,7 @@ func TestMountBackground(t *testing.T) {
// We should get io.EOF when the child closes stdout
// and stderr.
if err != nil {
+ pr.Close()
c1 <- struct{}{}
return
}