|
|
@ -5,9 +5,10 @@ package process
|
|
|
|
import (
|
|
|
|
import (
|
|
|
|
"context"
|
|
|
|
"context"
|
|
|
|
"io/ioutil"
|
|
|
|
"io/ioutil"
|
|
|
|
"os"
|
|
|
|
|
|
|
|
"strconv"
|
|
|
|
"strconv"
|
|
|
|
"testing"
|
|
|
|
"testing"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"github.com/shirou/gopsutil/v3/internal/common"
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
func Test_fillFromStatusWithContext(t *testing.T) {
|
|
|
|
func Test_fillFromStatusWithContext(t *testing.T) {
|
|
|
@ -15,10 +16,8 @@ func Test_fillFromStatusWithContext(t *testing.T) {
|
|
|
|
if err != nil {
|
|
|
|
if err != nil {
|
|
|
|
t.Error(err)
|
|
|
|
t.Error(err)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
original := os.Getenv("HOST_PROC")
|
|
|
|
f := common.MockEnv("HOST_PROC", "testdata/linux")
|
|
|
|
os.Setenv("HOST_PROC", "testdata/linux")
|
|
|
|
defer f()
|
|
|
|
defer os.Setenv("HOST_PROC", original)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for _, pid := range pids {
|
|
|
|
for _, pid := range pids {
|
|
|
|
pid, _ := strconv.ParseInt(pid.Name(), 0, 32)
|
|
|
|
pid, _ := strconv.ParseInt(pid.Name(), 0, 32)
|
|
|
|
p, _ := NewProcess(int32(pid))
|
|
|
|
p, _ := NewProcess(int32(pid))
|
|
|
|