tests: drop "-z" from fusermount to catch forgotten fds
macos does not have lazy unmount, so let's not use it on linux either. If the unmount fails, run "lsof" to find the open file. Also fix the first bug we found this way.
This commit is contained in:
parent
4732e33a9a
commit
98f735ff6e
@ -796,6 +796,7 @@ func TestUtimesNanoFd(t *testing.T) {
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
defer f.Close()
|
||||
procPath := fmt.Sprintf("/proc/self/fd/%d", f.Fd())
|
||||
doTestUtimesNano(t, procPath)
|
||||
}
|
||||
|
@ -195,14 +195,18 @@ func MountOrFatal(t *testing.T, c string, p string, extraArgs ...string) {
|
||||
func UnmountPanic(dir string) {
|
||||
err := UnmountErr(dir)
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
panic(err)
|
||||
fmt.Printf("UnmountPanic: %v. Running lsof %s\n", err, dir)
|
||||
cmd := exec.Command("lsof", dir)
|
||||
cmd.Stdout = os.Stdout
|
||||
cmd.Stderr = os.Stderr
|
||||
cmd.Run()
|
||||
panic("UnmountPanic: unmount failed: " + err.Error())
|
||||
}
|
||||
}
|
||||
|
||||
// UnmountErr tries to unmount "dir" and returns the resulting error.
|
||||
func UnmountErr(dir string) error {
|
||||
cmd := exec.Command(UnmountScript, "-u", "-z", dir)
|
||||
cmd := exec.Command(UnmountScript, "-u", dir)
|
||||
cmd.Stdout = os.Stdout
|
||||
cmd.Stderr = os.Stderr
|
||||
return cmd.Run()
|
||||
|
Loading…
Reference in New Issue
Block a user