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

Function TestGetFileInfo

pkg/fs/file_test.go:61–106  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

59}
60
61func TestGetFileInfo(t *testing.T) {
62 var tests = []struct {
63 path string
64 fileinfo *FileInfo
65 err error
66 }{
67 {
68 `C:\System32\cmd.exe`,
69 &FileInfo{IsExecutable: true},
70 nil,
71 },
72 {
73 `C:\System32\kernel32.dll`,
74 &FileInfo{IsDLL: true},
75 nil,
76 },
77 {
78 `C:\Temp\afs.sys`,
79 &FileInfo{IsDriver: true},
80 nil,
81 },
82 {
83 `../pe/_fixtures/054299e09cea38df2b84e6b29348b418.bin`,
84 &FileInfo{IsDriver: true},
85 nil,
86 },
87 {
88 `C:\WINDOWS\SoftwareDistribution\Temp\combase.dll`,
89 nil,
90 ErrSkippedFile(`C:\WINDOWS\SoftwareDistribution\Temp\combase.dll`),
91 },
92 {
93 `../pe/_fixtures/mscorlib.dll`,
94 &FileInfo{IsDLL: true, IsDotnet: true},
95 nil,
96 },
97 }
98
99 for _, tt := range tests {
100 t.Run(tt.path, func(t *testing.T) {
101 fileinfo, err := GetFileInfo(tt.path)
102 require.Equal(t, tt.err, err)
103 assert.Equal(t, tt.fileinfo, fileinfo)
104 })
105 }
106}

Callers

nothing calls this directly

Calls 3

GetFileInfoFunction · 0.85
EqualMethod · 0.80
RunMethod · 0.65

Tested by

no test coverage detected