You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
gopsutil/v3/process/process_linux_test.go

30 lines
551 B
Go

// +build linux
package process
import (
"context"
"io/ioutil"
"strconv"
"testing"
"github.com/shirou/gopsutil/v3/internal/common"
)
func Test_fillFromStatusWithContext(t *testing.T) {
pids, err := ioutil.ReadDir("testdata/linux/")
if err != nil {
t.Error(err)
}
f := common.MockEnv("HOST_PROC", "testdata/linux")
defer f()
for _, pid := range pids {
pid, _ := strconv.ParseInt(pid.Name(), 0, 32)
p, _ := NewProcess(int32(pid))
if err := p.fillFromStatusWithContext(context.Background()); err != nil {
t.Error(err)
}
}
}