36b3af2e3d
PR Check / Code Quality: Format (push) Failing after 1s
PR Check / Code Quality: Lint (darwin) (push) Failing after 0s
PR Check / Code Quality: Lint (freebsd) (push) Failing after 1s
PR Check / Code Quality: Lint (windows) (push) Failing after 1s
PR Check / Code Quality: Lint (linux) (push) Failing after 1s
PR Check / Security: Vulnerability Scan (push) Failing after 0s
Update Documentation / update-docs (push) Failing after 2s
PR Check / Code Quality: Vendor (push) Failing after 1s
PR Check / Code Quality: Coverage (push) Failing after 0s
PR Check / Tests: Unit (macos-latest) (push) Has been cancelled
PR Check / Tests: Unit (ubuntu-24.04) (push) Has been cancelled
PR Check / Tests: Unit (ubuntu-24.04-arm) (push) Has been cancelled
PR Check / Tests: Unit (windows-latest) (push) Has been cancelled
24 lines
651 B
Go
24 lines
651 B
Go
//go:build linux
|
|
|
|
package proc
|
|
|
|
import "testing"
|
|
|
|
func TestIsInterestingFile(t *testing.T) {
|
|
uninteresting := []string{
|
|
"socket:[12345]", "pipe:[678]", "anon_inode:[eventfd]", "/memfd:foo",
|
|
"/proc/self/status", "/sys/kernel/x", "/dev/null", "/dev/tty1", "/dev/pts/0",
|
|
}
|
|
for _, p := range uninteresting {
|
|
if isInterestingFile(p) {
|
|
t.Errorf("isInterestingFile(%q) = true, want false (kernel/internal fd)", p)
|
|
}
|
|
}
|
|
interesting := []string{"/home/user/notes.txt", "/var/log/app.log", "/etc/hosts"}
|
|
for _, p := range interesting {
|
|
if !isInterestingFile(p) {
|
|
t.Errorf("isInterestingFile(%q) = false, want true (real file)", p)
|
|
}
|
|
}
|
|
}
|