mirror of
https://github.com/reactos/syzkaller.git
synced 2025-02-07 20:38:52 +00:00
dashboard/app: allow reporting of BisectFix results
* Modify mail_bisect_result.txt to allow for sending fix bisection results. * Modify BisectResult to have a Fix field; introduce selectBisect for use within the template for choosing between BisectCause/BisectFix fields. * Modify bisectFromJob() to return BisectResult with Fix field set if relevant. * Modify the tests inside bisect_test.go to account for bisect fix related reporting emails. * Modify incomingMail() to ignore any emails from syzbot itself.
This commit is contained in:
parent
bcd7bcc296
commit
bad3cce26c
@ -363,8 +363,55 @@ https://goo.gl/tpsmEJ#testing-patches`,
|
||||
done.Build.ID = jobID
|
||||
c.expectOK(c.client2.JobDone(done))
|
||||
|
||||
// TODO: Reporting for BisectFix results not implemented
|
||||
// c.pollEmailBug()
|
||||
_, extBugID, err = email.RemoveAddrContext(msg4.Sender)
|
||||
c.expectOK(err)
|
||||
_, dbCrash, _ = c.loadBug(extBugID)
|
||||
reproSyzLink = externalLink(c.ctx, textReproSyz, dbCrash.ReproSyz)
|
||||
reproCLink = externalLink(c.ctx, textReproC, dbCrash.ReproC)
|
||||
dbJob, dbBuild, dbJobCrash = c.loadJob(jobID)
|
||||
kernelConfigLink = externalLink(c.ctx, textKernelConfig, dbBuild.KernelConfig)
|
||||
bisectCrashReportLink = externalLink(c.ctx, textCrashReport, dbJob.CrashReport)
|
||||
bisectCrashLogLink = externalLink(c.ctx, textCrashLog, dbJob.CrashLog)
|
||||
bisectLogLink = externalLink(c.ctx, textLog, dbJob.Log)
|
||||
crashLogLink = externalLink(c.ctx, textCrashLog, dbJobCrash.Log)
|
||||
|
||||
{
|
||||
msg := c.pollEmailBug()
|
||||
// Not mailed to commit author/cc because !MailMaintainers.
|
||||
// c.expectEQ(msg.To, []string{"test@syzkaller.com"})
|
||||
c.expectEQ(msg.Subject, crash4.Title)
|
||||
c.expectEQ(len(msg.Attachments), 0)
|
||||
c.expectEQ(msg.Body, fmt.Sprintf(`syzbot suspects this bug was fixed by commit:
|
||||
|
||||
commit 46e65cb4a0448942ec316b24d60446bbd5cc7827
|
||||
Author: Author Kernelov <author@kernel.org>
|
||||
Date: Wed Feb 9 04:05:06 2000 +0000
|
||||
|
||||
kernel: add a fix
|
||||
|
||||
bisection log: %[2]v
|
||||
start commit: 11111111 kernel_commit_title1
|
||||
git tree: repo1 branch1
|
||||
final crash: %[3]v
|
||||
console output: %[4]v
|
||||
kernel config: %[5]v
|
||||
dashboard link: https://testapp.appspot.com/bug?extid=%[1]v
|
||||
syz repro: %[6]v
|
||||
|
||||
If the bisection result looks correct, please reply with:
|
||||
|
||||
#syz fix: fix-commit-title
|
||||
|
||||
For information about bisection process see: https://goo.gl/tpsmEJ#bisection
|
||||
`, extBugID, bisectLogLink, bisectCrashReportLink, bisectCrashLogLink, kernelConfigLink, reproSyzLink, reproCLink))
|
||||
|
||||
syzRepro := []byte(fmt.Sprintf("%s#%s\n%s", syzReproPrefix, crash4.ReproOpts, crash4.ReproSyz))
|
||||
c.checkURLContents(bisectLogLink, []byte("bisectfix log 4"))
|
||||
c.checkURLContents(bisectCrashReportLink, []byte("bisectfix crash report 4"))
|
||||
c.checkURLContents(bisectCrashLogLink, []byte("bisectfix crash log 4"))
|
||||
c.checkURLContents(kernelConfigLink, []byte("config1"))
|
||||
c.checkURLContents(reproSyzLink, syzRepro)
|
||||
}
|
||||
|
||||
// No more bisection jobs.
|
||||
pollResp = c.client2.pollJobs(build.Manager)
|
||||
@ -803,6 +850,8 @@ func TestBugBisectionResults(t *testing.T) {
|
||||
},
|
||||
}
|
||||
c.expectOK(c.client2.JobDone(done))
|
||||
msg := c.client2.pollEmailBug()
|
||||
c.expectTrue(strings.Contains(msg.Body, "syzbot suspects this bug was fixed by commit:"))
|
||||
|
||||
// Fetch bug details
|
||||
var bugs []*Bug
|
||||
@ -917,4 +966,7 @@ func TestBugBisectionStatus(t *testing.T) {
|
||||
content, err = c.httpRequest("GET", url, "", AccessAdmin)
|
||||
c.expectEQ(err, nil)
|
||||
c.expectTrue(bytes.Contains(content, []byte("cause+fix")))
|
||||
|
||||
msg := c.client2.pollEmailBug()
|
||||
c.expectTrue(strings.Contains(msg.Body, "syzbot suspects this bug was fixed by commit:"))
|
||||
}
|
||||
|
@ -562,17 +562,14 @@ func pollCompletedJobs(c context.Context, typ string) ([]*dashapi.BugReport, err
|
||||
log.Criticalf(c, "no reporting for job %v", extJobID(keys[i]))
|
||||
continue
|
||||
}
|
||||
// TODO: this is temporary and will be removed once support for sending
|
||||
// JobBisectFix result emails is implemented.
|
||||
if job.Type == JobBisectFix {
|
||||
continue
|
||||
}
|
||||
reporting := config.Namespaces[job.Namespace].ReportingByName(job.Reporting)
|
||||
if reporting.Config.Type() != typ {
|
||||
continue
|
||||
}
|
||||
// TODO: this is temporal for gradual bisection rollout.
|
||||
// Notify only about successful bisection for now.
|
||||
// Note: If BisectFix results in a crash on HEAD, no notification is sent out. The following
|
||||
// check also accounts for that condition.
|
||||
if !appengine.IsDevAppServer() && job.Type != JobTestPatch && len(job.Commits) != 1 {
|
||||
continue
|
||||
}
|
||||
@ -686,6 +683,7 @@ func bisectFromJob(c context.Context, rep *dashapi.BugReport, job *Job) *dashapi
|
||||
LogLink: externalLink(c, textLog, job.Log),
|
||||
CrashLogLink: externalLink(c, textCrashLog, job.CrashLog),
|
||||
CrashReportLink: externalLink(c, textCrashReport, job.CrashReport),
|
||||
Fix: job.Type == JobBisectFix,
|
||||
}
|
||||
for _, com := range job.Commits {
|
||||
bisect.Commits = append(bisect.Commits, &dashapi.Commit{
|
||||
|
@ -1,27 +1,33 @@
|
||||
{{if .BisectCause.Commit}}syzbot has bisected this bug to:
|
||||
{{with $br := .}}{{with $bisect := selectBisect .}}{{if $bisect.Commit}}{{if $bisect.Fix}}syzbot suspects this bug was fixed by commit:
|
||||
{{else}}syzbot has bisected this bug to:
|
||||
{{end}}
|
||||
commit {{$bisect.Commit.Hash}}
|
||||
Author: {{$bisect.Commit.AuthorName}} <{{$bisect.Commit.Author}}>
|
||||
Date: {{formatKernelTime $bisect.Commit.Date}}
|
||||
|
||||
commit {{.BisectCause.Commit.Hash}}
|
||||
Author: {{.BisectCause.Commit.AuthorName}} <{{.BisectCause.Commit.Author}}>
|
||||
Date: {{formatKernelTime .BisectCause.Commit.Date}}
|
||||
|
||||
{{.BisectCause.Commit.Title}}
|
||||
{{else if .BisectCause.Commits}}Bisection is inconclusive: the first bad commit could be any of:
|
||||
{{range $com := .BisectCause.Commits}}
|
||||
{{$bisect.Commit.Title}}
|
||||
{{else if $bisect.Commits}}Bisection is inconclusive: the {{if $bisect.Fix}}fix{{else}}first bad{{end}} commit could be any of:
|
||||
{{range $com := $bisect.Commits}}
|
||||
{{formatShortHash $com.Hash}} {{$com.Title}}{{end}}
|
||||
{{else}}Bisection is inconclusive: the bug happens on the oldest tested release.
|
||||
{{end}}
|
||||
bisection log: {{.BisectCause.LogLink}}
|
||||
start commit: {{formatShortHash .KernelCommit}} {{formatCommitTableTitle .KernelCommitTitle}}
|
||||
git tree: {{.KernelRepoAlias}}
|
||||
{{if .BisectCause.CrashReportLink}}final crash: {{.BisectCause.CrashReportLink}}
|
||||
{{end}}{{if .BisectCause.CrashLogLink}}console output: {{.BisectCause.CrashLogLink}}
|
||||
{{end}}{{if .KernelConfigLink}}kernel config: {{.KernelConfigLink}}
|
||||
{{end}}dashboard link: {{.Link}}
|
||||
{{if .UserSpaceArch}}userspace arch: {{.UserSpaceArch}}
|
||||
{{end}}{{if .ReproSyzLink}}syz repro: {{.ReproSyzLink}}
|
||||
{{end}}{{if .ReproCLink}}C reproducer: {{.ReproCLink}}
|
||||
{{end}}{{if .BisectCause.Commit}}
|
||||
Reported-by: {{.CreditEmail}}
|
||||
Fixes: {{formatTagHash .BisectCause.Commit.Hash}} ("{{.BisectCause.Commit.Title}}")
|
||||
{{else}}Bisection is inconclusive: the bug happens on the {{if $bisect.Fix}}latest{{else}}oldest{{end}} tested release.
|
||||
{{end}}
|
||||
bisection log: {{$bisect.LogLink}}
|
||||
start commit: {{formatShortHash $br.KernelCommit}} {{formatCommitTableTitle $br.KernelCommitTitle}}
|
||||
git tree: {{$br.KernelRepoAlias}}
|
||||
{{if $bisect.CrashReportLink}}final crash: {{$bisect.CrashReportLink}}
|
||||
{{end}}{{if $bisect.CrashLogLink}}console output: {{$bisect.CrashLogLink}}
|
||||
{{end}}{{if $br.KernelConfigLink}}kernel config: {{$br.KernelConfigLink}}
|
||||
{{end}}dashboard link: {{$br.Link}}
|
||||
{{if $br.UserSpaceArch}}userspace arch: {{$br.UserSpaceArch}}
|
||||
{{end}}{{if $br.ReproSyzLink}}syz repro: {{$br.ReproSyzLink}}
|
||||
{{end}}{{if $br.ReproCLink}}C reproducer: {{$br.ReproCLink}}
|
||||
{{end}}{{if $bisect.Fix}}
|
||||
If the bisection result looks correct, please reply with:
|
||||
|
||||
#syz fix: fix-commit-title
|
||||
{{else}}{{if $bisect.Commit}}
|
||||
Reported-by: {{$br.CreditEmail}}
|
||||
Fixes: {{formatTagHash $bisect.Commit.Hash}} ("{{$bisect.Commit.Title}}")
|
||||
{{end}}{{end}}
|
||||
For information about bisection process see: https://goo.gl/tpsmEJ#bisection
|
||||
{{end}}{{end}}
|
@ -269,6 +269,10 @@ func incomingMail(c context.Context, r *http.Request) error {
|
||||
log.Warningf(c, "failed to parse email: %v", err)
|
||||
return nil
|
||||
}
|
||||
// Ignore any incoming emails from syzbot itself.
|
||||
if ownEmail(c) == msg.From {
|
||||
return nil
|
||||
}
|
||||
log.Infof(c, "received email: subject %q, from %q, cc %q, msg %q, bug %q, cmd %q, link %q",
|
||||
msg.Subject, msg.From, msg.Cc, msg.MessageID, msg.BugID, msg.Command, msg.Link)
|
||||
if msg.Command == email.CmdFix && msg.CommandArgs == "exact-commit-title" {
|
||||
|
@ -332,6 +332,7 @@ type BisectResult struct {
|
||||
LogLink string
|
||||
CrashLogLink string
|
||||
CrashReportLink string
|
||||
Fix bool
|
||||
}
|
||||
|
||||
type BugUpdate struct {
|
||||
|
@ -51,6 +51,14 @@ var Funcs = template.FuncMap{
|
||||
"formatTagHash": formatTagHash,
|
||||
"formatCommitTableTitle": formatCommitTableTitle,
|
||||
"formatList": formatStringList,
|
||||
"selectBisect": selectBisect,
|
||||
}
|
||||
|
||||
func selectBisect(rep *dashapi.BugReport) *dashapi.BisectResult {
|
||||
if rep.BisectFix != nil {
|
||||
return rep.BisectFix
|
||||
}
|
||||
return rep.BisectCause
|
||||
}
|
||||
|
||||
func link(url, text string) template.HTML {
|
||||
|
Loading…
x
Reference in New Issue
Block a user