mirror of https://github.com/shirou/gopsutil
make test directory and moved in it.
parent
f5a85e6b55
commit
dc78f4bcbe
@ -1,26 +1,26 @@
|
|||||||
// +build linux
|
package test
|
||||||
|
|
||||||
package gopsutil
|
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
|
"github.com/shirou/gopsutil"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestLoad(t *testing.T) {
|
func TestLoad(t *testing.T) {
|
||||||
v, err := LoadAvg()
|
v, err := gopsutil.LoadAvg()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Errorf("error %v", err)
|
t.Errorf("error %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
empty := &LoadAvgStat{}
|
empty := &gopsutil.LoadAvgStat{}
|
||||||
if v == empty {
|
if v == empty {
|
||||||
t.Errorf("error load: %v", v)
|
t.Errorf("error load: %v", v)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestLoadAvgStat_String(t *testing.T) {
|
func TestLoadAvgStat_String(t *testing.T) {
|
||||||
v := LoadAvgStat{
|
v := gopsutil.LoadAvgStat{
|
||||||
Load1: 10.1,
|
Load1: 10.1,
|
||||||
Load5: 20.1,
|
Load5: 20.1,
|
||||||
Load15: 30.1,
|
Load15: 30.1,
|
@ -1,17 +1,19 @@
|
|||||||
// +build linux freebsd
|
// +build linux freebsd
|
||||||
|
|
||||||
package gopsutil
|
package test
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"os"
|
"os"
|
||||||
"syscall"
|
"syscall"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
|
"github.com/shirou/gopsutil"
|
||||||
)
|
)
|
||||||
|
|
||||||
func Test_SendSignal(t *testing.T) {
|
func Test_SendSignal(t *testing.T) {
|
||||||
checkPid := os.Getpid()
|
checkPid := os.Getpid()
|
||||||
|
|
||||||
p, _ := NewProcess(int32(checkPid))
|
p, _ := gopsutil.NewProcess(int32(checkPid))
|
||||||
err := p.SendSignal(syscall.SIGCONT)
|
err := p.SendSignal(syscall.SIGCONT)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Errorf("send signal %v", err)
|
t.Errorf("send signal %v", err)
|
Loading…
Reference in New Issue