diff options
| author | Dmitry Vyukov <dvyukov@google.com> | 2026-02-17 15:43:11 +0100 |
|---|---|---|
| committer | Dmitry Vyukov <dvyukov@google.com> | 2026-02-19 09:07:17 +0000 |
| commit | 5fa76f921006ff7d47956b96a6cea333681444e4 (patch) | |
| tree | f7c0c762f412e1b19c02347dbdb7040f44bab2d2 /pkg/codesearch/codesearch.go | |
| parent | 746545b8b1e4c3a128db8652b340d3df90ce61db (diff) | |
pkg/aflow/tool/codesearcher: add end-to-end tests
Update #6811
Diffstat (limited to 'pkg/codesearch/codesearch.go')
| -rw-r--r-- | pkg/codesearch/codesearch.go | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/pkg/codesearch/codesearch.go b/pkg/codesearch/codesearch.go index 0e8fe6014..4243f1013 100644 --- a/pkg/codesearch/codesearch.go +++ b/pkg/codesearch/codesearch.go @@ -13,8 +13,10 @@ import ( "strconv" "strings" "syscall" + "testing" "github.com/google/syzkaller/pkg/aflow" + "github.com/google/syzkaller/pkg/clangtool/tooltest" "github.com/google/syzkaller/pkg/osutil" ) @@ -153,6 +155,11 @@ func NewIndex(databaseFile string, srcDirs []string) (*Index, error) { }, nil } +func NewTestIndex(t *testing.T, dir string) *Index { + db := tooltest.LoadOutput[Database](t, dir) + return &Index{db, []string{dir}} +} + func (index *Index) Command(cmd string, args []string) (string, error) { for _, meta := range Commands { if cmd == meta.Name { |
