-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathproc_pid_status_linux_test.go
70 lines (66 loc) · 1.7 KB
/
proc_pid_status_linux_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
package procstats
import "testing"
func TestProcPidStatusParse(t *testing.T) {
procSelfStatus := `Name: vim
Umask: 0022
State: R (running)
Tgid: 22987
Ngid: 0
Pid: 22987
PPid: 29507
TracerPid: 0
Uid: 1000 1000 1000 1000
Gid: 1000 1000 1000 1000
FDSize: 64
Groups: 10 18 19 27 78 85 102 999 1000 1001
NStgid: 22987
NSpid: 22987
NSpgid: 22987
NSsid: 29507
VmPeak: 2455528 kB
VmSize: 2455528 kB
VmLck: 0 kB
VmPin: 0 kB
VmHWM: 46661 kB
VmRSS: 46660 kB
RssAnon: 32276 kB
RssFile: 14384 kB
RssShmem: 0 kB
VmData: 288308 kB
VmStk: 132 kB
VmExe: 2656 kB
VmLib: 15660 kB
VmPTE: 620 kB
VmSwap: 0 kB
HugetlbPages: 0 kB
CoreDumping: 0
Threads: 32
SigQ: 0/78835
SigPnd: 0000000000000000
ShdPnd: 0000000000000000
SigBlk: 0000000000000000
SigIgn: 0000000000003000
SigCgt: 00000001ef824eff
CapInh: 0000000000000000
CapPrm: 0000000000000000
CapEff: 0000000000000000
CapBnd: 0000003fffffffff
CapAmb: 0000000000000000
NoNewPrivs: 0
Seccomp: 0
Speculation_Store_Bypass: vulnerable
Cpus_allowed: f
Cpus_allowed_list: 0-3
Mems_allowed: 00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000001
Mems_allowed_list: 0
voluntary_ctxt_switches: 1163
nonvoluntary_ctxt_switches: 597`
out := ProcPidStatus{}
if parseErr := procPidStatusParser.Parse([]byte(procSelfStatus), &out); parseErr != nil {
t.Fatalf("failed to parse: %s", parseErr)
}
if out.VMHWM != 46661*1024 {
t.Errorf("unexpected value for VmHWM: %d; expected %d", out.VMHWM,
46661*1024)
}
}