Skip to content

Commit

Permalink
pkg/util/ebpf : print CONFIG detail.
Browse files Browse the repository at this point in the history
Signed-off-by: CFC4N <cfc4n.cs@gmail.com>
  • Loading branch information
cfc4n committed Aug 19, 2022
1 parent c3a30dc commit f16f9da
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions pkg/util/ebpf/bpf_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ func TestBpfConfig(t *testing.T) {
t.Logf("GetSystemConfig error:%s", e.Error())
}

// 测试 config.gz 的解压,查找配置项
t.Log("TestBpfConfig with correct configuration (gzip compressed)")
configPaths = []string{
"config.gz", // test file from pixel 6 android 12
Expand All @@ -36,7 +37,25 @@ func TestBpfConfig(t *testing.T) {
if e != nil {
t.Fatalf("GetSystemConfig(gzip) error:%s", e.Error())
}
for _, item := range configCheckItems {
bc, found := m[item]
if !found {
// 没有这个配置项
t.Logf("Config not found, item:%s.", item)
} else {
t.Logf("Config found, item:%s, value:%s.", item, bc)
}

//如果有,在判断配置项的值
if bc != "y" {
// 没有开启
t.Logf("Config disabled, item :%s.", item)
} else {
t.Logf("Config enabled, item :%s.", item)
}
}

//
t.Log("TestBpfConfig with correct configuration")
configPaths = []string{
"/proc/config.gz", // android
Expand Down

0 comments on commit f16f9da

Please sign in to comment.