MCPcopy Create free account
hub / github.com/rabbitstack/fibratus / TestMatchHash

Function TestMatchHash

pkg/util/loldrivers/client_test.go:48–81  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

46}
47
48func TestMatchHash(t *testing.T) {
49 absPath := func(path string) string {
50 abs, err := filepath.Abs(path)
51 if err != nil {
52 t.Fatal(err)
53 }
54 return abs
55 }
56
57 var tests = []struct {
58 driverPath string
59 wantsName string
60 ok bool
61 }{
62 {
63 absPath("_fixtures/d.sys"),
64 "d.sys",
65 true,
66 },
67 {
68 absPath("_fixtures/iomem.sys"),
69 "iomem64.sys",
70 true,
71 },
72 }
73
74 for _, tt := range tests {
75 t.Run(tt.driverPath, func(t *testing.T) {
76 ok, d := GetClient().MatchHash(tt.driverPath)
77 assert.True(t, ok == tt.ok)
78 assert.Equal(t, tt.wantsName, d.Filename)
79 })
80 }
81}
82
83func TestRefresh(t *testing.T) {
84 c = nil

Callers

nothing calls this directly

Calls 4

GetClientFunction · 0.85
MatchHashMethod · 0.80
EqualMethod · 0.80
RunMethod · 0.65

Tested by

no test coverage detected