diff options
Diffstat (limited to 'tests/test_helpers')
-rw-r--r-- | tests/test_helpers/helpers.go | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/tests/test_helpers/helpers.go b/tests/test_helpers/helpers.go index 7e1f4e8..5c71d30 100644 --- a/tests/test_helpers/helpers.go +++ b/tests/test_helpers/helpers.go @@ -54,10 +54,18 @@ func ResetTmpDir(plaintextNames bool) { d := filepath.Join(TmpDir, e.Name()) err = os.Remove(d) if err != nil { - if testing.Verbose() { - fmt.Printf("%v, trying umount\n", d, err) + pe := err.(*os.PathError) + if pe.Err == syscall.EBUSY { + if testing.Verbose() { + fmt.Printf("Remove failed: %v. Maybe still mounted?\n", pe) + } + err = UnmountErr(d) + if err != nil { + panic(err) + } + } else if pe.Err != syscall.ENOTEMPTY { + panic("Unhandled error: " + pe.Err.Error()) } - UnmountErr(d) err = os.RemoveAll(d) if err != nil { panic(err) |