mirror of
https://github.com/reactos/syzkaller.git
synced 2024-11-23 11:29:46 +00:00
dashboard/app: fix infinite emails
We override crash with the crash used for bisection to make the information more consistent. However if bisection crash only have syz repro and there is now another crash with C repro, then we always think that we have not reported C repro and continue sending the same report again and again. Don't override the crash with bisection crash in such case.
This commit is contained in:
parent
acbc5b7d05
commit
8e1b6f6446
@ -7,6 +7,7 @@ package dash
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
@ -547,3 +548,83 @@ func TestBisectCauseExternal(t *testing.T) {
|
|||||||
c.expectEQ(bisect.Type, dashapi.ReportBisectCause)
|
c.expectEQ(bisect.Type, dashapi.ReportBisectCause)
|
||||||
c.expectEQ(bisect.Title, rep.Title)
|
c.expectEQ(bisect.Title, rep.Title)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestBisectCauseReproSyz(t *testing.T) {
|
||||||
|
c := NewCtx(t)
|
||||||
|
defer c.Close()
|
||||||
|
|
||||||
|
build := testBuild(1)
|
||||||
|
c.client2.UploadBuild(build)
|
||||||
|
crash := testCrashWithRepro(build, 1)
|
||||||
|
crash.ReproC = nil
|
||||||
|
c.client2.ReportCrash(crash)
|
||||||
|
|
||||||
|
pollResp := c.client2.pollJobs(build.Manager)
|
||||||
|
jobID := pollResp.ID
|
||||||
|
done := &dashapi.JobDoneReq{
|
||||||
|
ID: jobID,
|
||||||
|
Build: *build,
|
||||||
|
Log: []byte("bisect log"),
|
||||||
|
CrashTitle: "bisect crash title",
|
||||||
|
CrashLog: []byte("bisect crash log"),
|
||||||
|
}
|
||||||
|
done.Build.ID = jobID
|
||||||
|
c.expectOK(c.client2.JobDone(done))
|
||||||
|
|
||||||
|
crash.ReproC = []byte("int main")
|
||||||
|
c.client2.ReportCrash(crash)
|
||||||
|
|
||||||
|
msg := c.client2.pollEmailBug()
|
||||||
|
if !strings.Contains(msg.Body, "syzbot found the following crash") {
|
||||||
|
t.Fatalf("wrong email header:\n%v", msg.Body)
|
||||||
|
}
|
||||||
|
if !strings.Contains(msg.Body, "Bisection is inconclusive") {
|
||||||
|
t.Fatalf("report does not contain bisection results:\n%v", msg.Body)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestBisectCauseReproSyz2(t *testing.T) {
|
||||||
|
c := NewCtx(t)
|
||||||
|
defer c.Close()
|
||||||
|
|
||||||
|
build := testBuild(1)
|
||||||
|
c.client2.UploadBuild(build)
|
||||||
|
crash := testCrashWithRepro(build, 1)
|
||||||
|
crash.ReproC = nil
|
||||||
|
c.client2.ReportCrash(crash)
|
||||||
|
|
||||||
|
pollResp := c.client2.pollJobs(build.Manager)
|
||||||
|
jobID := pollResp.ID
|
||||||
|
done := &dashapi.JobDoneReq{
|
||||||
|
ID: jobID,
|
||||||
|
Build: *build,
|
||||||
|
Log: []byte("bisect log"),
|
||||||
|
CrashTitle: "bisect crash title",
|
||||||
|
CrashLog: []byte("bisect crash log"),
|
||||||
|
}
|
||||||
|
done.Build.ID = jobID
|
||||||
|
c.expectOK(c.client2.JobDone(done))
|
||||||
|
|
||||||
|
msg := c.client2.pollEmailBug()
|
||||||
|
if !strings.Contains(msg.Body, "syzbot found the following crash") {
|
||||||
|
t.Fatalf("wrong email header:\n%v", msg.Body)
|
||||||
|
}
|
||||||
|
if !strings.Contains(msg.Body, "Bisection is inconclusive") {
|
||||||
|
t.Fatalf("report does not contain bisection results:\n%v", msg.Body)
|
||||||
|
}
|
||||||
|
|
||||||
|
crash.ReproC = []byte("int main")
|
||||||
|
c.client2.ReportCrash(crash)
|
||||||
|
|
||||||
|
msg = c.client2.pollEmailBug()
|
||||||
|
if !strings.Contains(msg.Body, "syzbot has found a reproducer for the following crash") {
|
||||||
|
t.Fatalf("wrong email header:\n%v", msg.Body)
|
||||||
|
}
|
||||||
|
// Do we need bisection results in this email as well?
|
||||||
|
// We already mailed them, so we could not mail them here.
|
||||||
|
// But if we don't include bisection results, need to check that CC is correct
|
||||||
|
// (includes bisection CC).
|
||||||
|
if !strings.Contains(msg.Body, "Bisection is inconclusive") {
|
||||||
|
t.Fatalf("report still contains bisection results:\n%v", msg.Body)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -303,10 +303,16 @@ func createBugReport(c context.Context, bug *Bug, crash *Crash, crashKey *db.Key
|
|||||||
var job *Job
|
var job *Job
|
||||||
if bug.BisectCause == BisectYes {
|
if bug.BisectCause == BisectYes {
|
||||||
// If we have bisection results, report the crash/repro used for bisection.
|
// If we have bisection results, report the crash/repro used for bisection.
|
||||||
job, crash, _, crashKey, err = loadBisectJob(c, bug)
|
job1, crash1, _, crashKey1, err := loadBisectJob(c, bug)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
job = job1
|
||||||
|
if crash1.ReproC != 0 || crash.ReproC == 0 {
|
||||||
|
// Don't override the crash in this case,
|
||||||
|
// otherwise we will always think that we haven't reported the C repro.
|
||||||
|
crash, crashKey = crash1, crashKey1
|
||||||
|
}
|
||||||
}
|
}
|
||||||
crashLog, _, err := getText(c, textCrashLog, crash.Log)
|
crashLog, _, err := getText(c, textCrashLog, crash.Log)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
Loading…
Reference in New Issue
Block a user