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

Function TestEventSourceStartTraces

internal/etw/source_test.go:69–149  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

67}
68
69func TestEventSourceStartTraces(t *testing.T) {
70 psnap := new(ps.SnapshotterMock)
71 psnap.On("Write", mock.Anything).Return(nil)
72 psnap.On("AddThread", mock.Anything).Return(nil)
73 psnap.On("AddModule", mock.Anything).Return(nil)
74 psnap.On("AddMmap", mock.Anything).Return(nil)
75 psnap.On("RemoveMmap", mock.Anything, mock.Anything).Return(nil)
76 psnap.On("RemoveThread", mock.Anything, mock.Anything).Return(nil)
77 psnap.On("RemoveModule", mock.Anything, mock.Anything).Return(nil)
78 psnap.On("FindModule", mock.Anything).Return(false, nil)
79 psnap.On("FindAndPut", mock.Anything).Return(&pstypes.PS{})
80 psnap.On("Find", mock.Anything).Return(true, &pstypes.PS{})
81 psnap.On("Remove", mock.Anything).Return(nil)
82
83 hsnap := new(handle.SnapshotterMock)
84 hsnap.On("FindByObject", mock.Anything).Return(htypes.Handle{}, false)
85 hsnap.On("FindHandles", mock.Anything).Return([]htypes.Handle{}, nil)
86
87 var tests = []struct {
88 name string
89 cfg *config.Config
90 wantSessions int
91 wantFlags []etw.EventTraceFlags
92 }{
93 {"start kernel logger session",
94 &config.Config{
95 EventSource: config.EventSourceConfig{
96 EnableThreadEvents: true,
97 EnableNetEvents: true,
98 EnableFileIOEvents: true,
99 EnableVAMapEvents: true,
100 BufferSize: 1024,
101 FlushTimer: time.Millisecond * 2300,
102 },
103 Filters: &config.Filters{},
104 },
105 2,
106 []etw.EventTraceFlags{0x6018203, 0},
107 },
108 {"start kernel and security telemetry logger sessions",
109 &config.Config{
110 EventSource: config.EventSourceConfig{
111 EnableThreadEvents: true,
112 EnableNetEvents: true,
113 EnableFileIOEvents: true,
114 EnableVAMapEvents: true,
115 EnableHandleEvents: true,
116 EnableRegistryEvents: true,
117 BufferSize: 1024,
118 FlushTimer: time.Millisecond * 2300,
119 EnableAuditAPIEvents: true,
120 },
121 Filters: &config.Filters{},
122 },
123 2,
124 []etw.EventTraceFlags{0x6038203, 0x80000040},
125 },
126 }

Callers

nothing calls this directly

Calls 11

OpenMethod · 0.95
CloseMethod · 0.95
ControlTraceFunction · 0.92
GetTraceSystemFlagsFunction · 0.92
NewEventSourceFunction · 0.85
EqualMethod · 0.80
HandleMethod · 0.80
IsKernelTraceMethod · 0.80
RunMethod · 0.65
InitMethod · 0.45
IsValidMethod · 0.45

Tested by

no test coverage detected