tests: ListFds(): filter out pipe and eventpoll fds
These are created on demand by the Go runtime and are usually not interesting.
This commit is contained in:
parent
b1819143c5
commit
d5a74d2a3e
|
@ -8,6 +8,7 @@ import (
|
||||||
"os/exec"
|
"os/exec"
|
||||||
"os/signal"
|
"os/signal"
|
||||||
"runtime"
|
"runtime"
|
||||||
|
"strings"
|
||||||
"syscall"
|
"syscall"
|
||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
@ -182,6 +183,7 @@ func ListFds(pid int) []string {
|
||||||
log.Panic(err)
|
log.Panic(err)
|
||||||
}
|
}
|
||||||
var out []string
|
var out []string
|
||||||
|
hidden := 0
|
||||||
for _, n := range names {
|
for _, n := range names {
|
||||||
fdPath := dir + "/" + n
|
fdPath := dir + "/" + n
|
||||||
fi, err := os.Lstat(fdPath)
|
fi, err := os.Lstat(fdPath)
|
||||||
|
@ -200,7 +202,16 @@ func ListFds(pid int) []string {
|
||||||
// fd was closed in the meantime
|
// fd was closed in the meantime
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
if strings.HasPrefix(target, "pipe:") || strings.HasPrefix(target, "anon_inode:[eventpoll]") {
|
||||||
|
// The Go runtime creates pipes on demand for splice(), which
|
||||||
|
// creates spurious test failures. Ignore all pipes.
|
||||||
|
// Also get rid of the "eventpoll" fd that is always there and not
|
||||||
|
// interesting.
|
||||||
|
hidden++
|
||||||
|
continue
|
||||||
|
}
|
||||||
out = append(out, n+"="+target)
|
out = append(out, n+"="+target)
|
||||||
}
|
}
|
||||||
|
out = append(out, fmt.Sprintf("(hidden:%d)", hidden))
|
||||||
return out
|
return out
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue