diff options
Diffstat (limited to 'tests/cli')
-rw-r--r-- | tests/cli/cli_test.go | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/tests/cli/cli_test.go b/tests/cli/cli_test.go index 51b52c6..fa0b576 100644 --- a/tests/cli/cli_test.go +++ b/tests/cli/cli_test.go @@ -535,3 +535,30 @@ func TestComma(t *testing.T) { } test_helpers.UnmountPanic(mnt) } + +// Mount with idle timeout 10ms and check that the process exits by itself +// within 5 seconds. +func TestIdle(t *testing.T) { + dir := test_helpers.InitFS(t) + mnt := dir + ".mnt" + err := os.Mkdir(mnt, 0700) + if err != nil { + t.Fatal(err) + } + cmd := exec.Command(test_helpers.GocryptfsBinary, + "-q", "-nosyslog", "-fg", "-extpass", "echo test", "-i", "10ms", dir, mnt) + cmd.Stdout = os.Stdout + cmd.Stderr = os.Stderr + if err := cmd.Start(); err != nil { + t.Fatal(err) + } + timer := time.AfterFunc(5*time.Second, func() { + t.Error("timeout waiting for umount") + cmd.Process.Kill() + }) + err = cmd.Wait() + timer.Stop() + if err != nil { + t.Error(err) + } +} |