sk-matrix-project/app/wails/lib/system/system_test.go

55 lines
984 B
Go

package system
import (
"changeme/backend/utils"
"fmt"
"path/filepath"
"testing"
)
func TestCpu(t *testing.T) {
fmt.Println(GetCpuInfo())
}
func TestMemory(t *testing.T) {
fmt.Println(GetVirtualMemory())
fmt.Println(GetSwapMemory())
}
func TestDisk(t *testing.T) {
partitions := GetDiskPartitions()
fmt.Println(partitions)
for _, partition := range partitions {
fmt.Println(GetDiskUsage(partition.Device))
}
fmt.Println(GetIOCounters())
}
func TestNetwork(t *testing.T) {
fmt.Println(GetNetWorkConnection())
}
func TestProcess(t *testing.T) {
processList := GetAllProcessPid()
for _, pid := range processList {
fmt.Println(GetProcessInfo(pid))
}
}
func TestScanDir(t *testing.T) {
fmt.Println(filepath.IsAbs("E:"), filepath.IsAbs("E:/"))
path, err := filepath.Abs("E:/")
if err != nil {
fmt.Println(err)
}
data, err := ScanDir(path)
if err != nil {
fmt.Println(err)
}
for _, entry := range data {
fmt.Printf("%+v\n", utils.Json(entry))
}
}