-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
pkg : fix Kernel config read failed, error:Config not found #117
Signed-off-by: CFC4N <cfc4n.cs@gmail.com>
- Loading branch information
Showing
2 changed files
with
53 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
package ebpf | ||
|
||
import ( | ||
"testing" | ||
) | ||
|
||
func TestBpfConfig(t *testing.T) { | ||
configPaths = []string{ | ||
"/xxxxx/proc/config.gz", // android | ||
} | ||
m, e := GetSystemConfig() | ||
if e != nil { | ||
// 正常情况 是没有找到配置文件 | ||
t.Logf("GetSystemConfig error:%s", e.Error()) | ||
} | ||
|
||
configPaths = []string{ | ||
"/proc/config.gz", // android | ||
"/boot/config", // linux | ||
"/boot/config-%s", // linux | ||
} | ||
m, e = GetSystemConfig() | ||
if e != nil { | ||
t.Fatalf("GetSystemConfig error:%s", e.Error()) | ||
} | ||
for _, item := range configCheckItems { | ||
bc, found := m[item] | ||
if !found { | ||
// 没有这个配置项 | ||
t.Logf("Config not found, item:%s.", item) | ||
} | ||
|
||
//如果有,在判断配置项的值 | ||
if bc != "y" { | ||
// 没有开启 | ||
t.Logf("Config disabled, item :%s.", item) | ||
} | ||
} | ||
t.Logf("GetSystemConfig success") | ||
} |