(t *testing.T)
| 30 | ) |
| 31 | |
| 32 | func TestStackwalkDecorator(t *testing.T) { |
| 33 | q := NewQueue(50, false, true) |
| 34 | cd := NewStackwalkDecorator(q) |
| 35 | |
| 36 | e := &Event{ |
| 37 | Type: CreateFile, |
| 38 | Tid: 2484, |
| 39 | PID: 859, |
| 40 | CPU: 1, |
| 41 | Seq: 2, |
| 42 | Name: "CreateFile", |
| 43 | Timestamp: time.Now(), |
| 44 | Category: File, |
| 45 | Params: Params{ |
| 46 | params.FileObject: {Name: params.FileObject, Type: params.Uint64, Value: uint64(12456738026482168384)}, |
| 47 | params.FilePath: {Name: params.FilePath, Type: params.UnicodeString, Value: "C:\\Windows\\system32\\user32.dll"}, |
| 48 | params.FileType: {Name: params.FileType, Type: params.AnsiString, Value: "file"}, |
| 49 | params.FileOperation: {Name: params.FileOperation, Type: params.Enum, Value: uint32(1), Enum: fs.FileCreateDispositions}, |
| 50 | }, |
| 51 | } |
| 52 | |
| 53 | e1 := &Event{ |
| 54 | Type: CreateFile, |
| 55 | Tid: 2484, |
| 56 | PID: 859, |
| 57 | CPU: 1, |
| 58 | Seq: 3, |
| 59 | Name: "CreateFile", |
| 60 | Timestamp: time.Now(), |
| 61 | Category: File, |
| 62 | Params: Params{ |
| 63 | params.FileObject: {Name: params.FileObject, Type: params.Uint64, Value: uint64(12456738026482168384)}, |
| 64 | params.FilePath: {Name: params.FilePath, Type: params.UnicodeString, Value: "C:\\Windows\\system32\\kernel32.dll"}, |
| 65 | params.FileType: {Name: params.FileType, Type: params.AnsiString, Value: "file"}, |
| 66 | params.FileOperation: {Name: params.FileOperation, Type: params.Enum, Value: uint32(1), Enum: fs.FileCreateDispositions}, |
| 67 | }, |
| 68 | } |
| 69 | |
| 70 | cd.Push(e) |
| 71 | cd.Push(e1) |
| 72 | |
| 73 | assert.Len(t, cd.buckets[e.StackID()], 2) |
| 74 | |
| 75 | sw := &Event{ |
| 76 | Type: StackWalk, |
| 77 | Tid: 2484, |
| 78 | PID: 859, |
| 79 | CPU: 1, |
| 80 | Seq: 4, |
| 81 | Name: "StackWalk", |
| 82 | Timestamp: time.Now(), |
| 83 | Params: Params{ |
| 84 | params.Callstack: {Name: params.Callstack, Type: params.Slice, Value: []va.Address{0x7ffb5eb70dc4, 0x7ffb5c191deb, 0x7ffb3138592e}}, |
| 85 | }, |
| 86 | } |
| 87 | |
| 88 | evt := cd.Pop(sw) |
| 89 | assert.Len(t, cd.buckets[e.StackID()], 1) |
nothing calls this directly
no test coverage detected