mirror of
https://github.com/evilsocket/opensnitch.git
synced 2025-03-04 08:34:40 +01:00
tests: fixed TestLookupPidInProc
We expect to find at least one process that its inode 1 points to /dev/null. The returned pid shouldn't be -1.
This commit is contained in:
parent
95e4afac8e
commit
1e45a4c98b
1 changed files with 2 additions and 8 deletions
|
@ -22,16 +22,10 @@ func TestLookupPidDescriptors(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestLookupPidInProc(t *testing.T) {
|
||||
pidsFd := lookupPidDescriptors(fmt.Sprint("/proc/", myPid, "/fd/"))
|
||||
|
||||
if len(pidsFd) == 0 {
|
||||
t.Error("lookupPidInProc() pids length should not be 0", pidsFd)
|
||||
}
|
||||
|
||||
// we expect that the inode 1 points to /dev/null
|
||||
expect := "/dev/null"
|
||||
foundPid := lookupPidInProc("/proc/", expect, "", 1)
|
||||
if foundPid != myPid {
|
||||
t.Error("lookupPidInProc() found PID (x) should be (y)", foundPid, myPid)
|
||||
if foundPid == -1 {
|
||||
t.Error("lookupPidInProc() should not return -1")
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue