Skip to content

Commit 2253094

Browse files
committed
tools/syz-aflow: enable downloading bugs by ExtID or ID
Originally we only supported downloading by ExtID. This change enables downloading by ID as well
1 parent cf894e0 commit 2253094

File tree

1 file changed

+24
-13
lines changed

1 file changed

+24
-13
lines changed

tools/syz-aflow/aflow.go

Lines changed: 24 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -30,18 +30,17 @@ import (
3030

3131
func main() {
3232
var (
33-
flagFlow = flag.String("workflow", "", "workflow to execute")
34-
flagInput = flag.String("input", "", "input json file with workflow arguments")
35-
flagWorkdir = flag.String("workdir", "", "directory for kernel checkout, kernel builds, etc")
36-
flagModel = flag.String("model", "", "use this LLM model, if empty use default models")
37-
flagCacheSize = flag.String("cache-size", "10GB", "max cache size (e.g. 100MB, 5GB, 1TB)")
38-
flagDownloadBug = flag.String("download-bug", "", "extid of a bug to download from the dashboard"+
39-
" and save into -input file")
40-
flagAuth = flag.Bool("auth", false, "use gcloud auth token for downloading bugs (set it up with"+
41-
" gcloud auth application-default login)")
33+
flagFlow = flag.String("workflow", "", "workflow to execute")
34+
flagInput = flag.String("input", "", "input json file with workflow arguments")
35+
flagWorkdir = flag.String("workdir", "", "directory for kernel checkout, kernel builds, etc")
36+
flagModel = flag.String("model", "", "use this LLM model, if empty use default models")
37+
flagCacheSize = flag.String("cache-size", "10GB", "max cache size (e.g. 100MB, 5GB, 1TB)")
38+
flagDownloadBugByExtID = flag.String("download-bug-by-extid", "", "extid of a bug to download from the dashboard and save into -input file")
39+
flagDownloadBugByID = flag.String("download-bug-by-id", "", "id of a bug to download from the dashboard and save into -input file")
40+
flagAuth = flag.Bool("auth", false, "use gcloud auth token for downloading bugs (set it up with gcloud auth application-default login)")
4241
)
4342
defer tool.Init()()
44-
if *flagDownloadBug != "" {
43+
if *flagDownloadBugByExtID != "" || *flagDownloadBugByID != "" {
4544
token := ""
4645
if *flagAuth {
4746
var err error
@@ -50,7 +49,13 @@ func main() {
5049
tool.Fail(err)
5150
}
5251
}
53-
if err := downloadBug(*flagDownloadBug, *flagInput, token); err != nil {
52+
var err error
53+
if *flagDownloadBugByExtID != "" {
54+
err = downloadBug(true, *flagDownloadBugByExtID, *flagInput, token)
55+
} else {
56+
err = downloadBug(false, *flagDownloadBugByID, *flagInput, token)
57+
}
58+
if err != nil {
5459
tool.Fail(err)
5560
}
5661
return
@@ -104,11 +109,17 @@ func onEvent(span *trajectory.Span) error {
104109
return nil
105110
}
106111

107-
func downloadBug(extID, inputFile, token string) error {
112+
func downloadBug(useExtID bool, id, inputFile, token string) error {
108113
if inputFile == "" {
109114
return fmt.Errorf("-download-bug requires -input flag")
110115
}
111-
resp, err := get(fmt.Sprintf("/bug?extid=%v&json=1", extID), token)
116+
var resp string
117+
var err error
118+
if useExtID {
119+
resp, err = get(fmt.Sprintf("/bug?extid=%v&json=1", id), token)
120+
} else {
121+
resp, err = get(fmt.Sprintf("/bug?id=%v&json=1", id), token)
122+
}
112123
if err != nil {
113124
return err
114125
}

0 commit comments

Comments
 (0)