33 lines
724 B
Go
33 lines
724 B
Go
// Copyright Safing ICS Technologies GmbH. Use of this source code is governed by the AGPL license that can be found in the LICENSE file.
|
|
|
|
package process
|
|
|
|
import (
|
|
"fmt"
|
|
"strconv"
|
|
"testing"
|
|
)
|
|
|
|
func TestGetHumanInfo(t *testing.T) {
|
|
// gather processes for testing
|
|
pids := readDirNames("/proc")
|
|
var allProcs []*Process
|
|
for _, pidString := range pids {
|
|
pid, err := strconv.ParseInt(pidString, 10, 32)
|
|
if err != nil {
|
|
continue
|
|
}
|
|
next, err := GetOrFindProcess(int(pid))
|
|
if err != nil {
|
|
continue
|
|
}
|
|
allProcs = append(allProcs, next)
|
|
}
|
|
|
|
// test
|
|
for _, process := range allProcs {
|
|
process.GetHumanInfo()
|
|
fmt.Printf("%d - %s - %s - %s\n", process.Pid, process.Path, process.Name, process.Icon)
|
|
}
|
|
}
|