| 1 | package ebpf |
| 2 | |
| 3 | import ( |
| 4 | "os" |
| 5 | "testing" |
| 6 | |
| 7 | "github.com/go-quicktest/qt" |
| 8 | "golang.org/x/sys/windows" |
| 9 | ) |
| 10 | |
| 11 | func TestWindowsProgramTypeForGUID(t *testing.T) { |
| 12 | sampleGUID := windows.GUID{ |
| 13 | Data1: 0xf788ef4a, Data2: 0x207d, Data3: 0x4dc3, |
| 14 | Data4: [...]byte{0x85, 0xcf, 0x0f, 0x2e, 0xa1, 0x07, 0x21, 0x3c}, |
| 15 | } |
| 16 | |
| 17 | _, err := WindowsProgramTypeForGUID("{00000000-0000-0000-0000-000000000001}") |
| 18 | qt.Assert(t, qt.ErrorIs(err, os.ErrNotExist)) |
| 19 | |
| 20 | programType, err := WindowsProgramTypeForGUID(sampleGUID.String()) |
| 21 | qt.Assert(t, qt.IsNil(err)) |
| 22 | qt.Assert(t, qt.Equals(WindowsSample, programType)) |
| 23 | } |
| 24 | |
| 25 | func TestWindowsAttachTypeForGUID(t *testing.T) { |
| 26 | sampleGUID := windows.GUID{ |
| 27 | Data1: 0xf788ef4b, Data2: 0x207d, Data3: 0x4dc3, |
| 28 | Data4: [...]byte{0x85, 0xcf, 0x0f, 0x2e, 0xa1, 0x07, 0x21, 0x3c}, |
| 29 | } |
| 30 | |
| 31 | _, err := WindowsAttachTypeForGUID("{00000000-0000-0000-0000-000000000001}") |
| 32 | qt.Assert(t, qt.ErrorIs(err, os.ErrNotExist)) |
| 33 | |
| 34 | attachType, err := WindowsAttachTypeForGUID(sampleGUID.String()) |
| 35 | qt.Assert(t, qt.IsNil(err)) |
| 36 | qt.Assert(t, qt.Equals(AttachWindowsSample, attachType)) |
| 37 | } |