diff options
author | Zubin Mithra <zsm@chromium.org> | 2019-10-22 17:30:35 -0700 |
---|---|---|
committer | Dmitry Vyukov <dvyukov@google.com> | 2019-11-05 09:17:27 +0100 |
commit | 0f3ec414b986caeb05e198240389925eae978ab8 (patch) | |
tree | 204cd6a86cc0bd40fb90899a5b3b985dc2e37fa6 | |
parent | a77e6539d9a657d582fa3167b8bc049feb2bd1fb (diff) | |
download | syzkaller-0f3ec414b986caeb05e198240389925eae978ab8.tar.gz |
dashboard/app: add support for disabling fix bisection
* Allow fix bisection to be disabled on kernel repos to which force-pushes
occur.
* Pending fix bisection jobs for KernelRepo with FixBisectionDisabled will have
to be deleted manually.
* Add TestFixBisectionsDisabled.
Closes #1365
-rw-r--r-- | dashboard/app/app_test.go | 7 | ||||
-rw-r--r-- | dashboard/app/config.go | 2 | ||||
-rw-r--r-- | dashboard/app/jobs.go | 20 | ||||
-rw-r--r-- | dashboard/app/jobs_test.go | 40 |
4 files changed, 67 insertions, 2 deletions
diff --git a/dashboard/app/app_test.go b/dashboard/app/app_test.go index 89ef7ff12..61773bd6c 100644 --- a/dashboard/app/app_test.go +++ b/dashboard/app/app_test.go @@ -98,6 +98,13 @@ var testConfig = &GlobalConfig{ Alias: "repo10alias", CC: []string{"maintainers@repo10.org", "bugs@repo10.org"}, }, + { + URL: "git://syzkaller.org", + Branch: "branch20", + Alias: "repo20", + CC: []string{"maintainers@repo20.org", "bugs@repo20.org"}, + FixBisectionDisabled: true, + }, }, Managers: map[string]ConfigManager{ "restricted-manager": { diff --git a/dashboard/app/config.go b/dashboard/app/config.go index 46a2b9597..1f5b3c0a5 100644 --- a/dashboard/app/config.go +++ b/dashboard/app/config.go @@ -154,6 +154,8 @@ type KernelRepo struct { ReportingPriority int // Additional CC list to add to all bugs reported on this repo. CC []string + // Determines if fix bisection should be disabled on this repo. + FixBisectionDisabled bool } var ( diff --git a/dashboard/app/jobs.go b/dashboard/app/jobs.go index 3a158840c..e7c908f2d 100644 --- a/dashboard/app/jobs.go +++ b/dashboard/app/jobs.go @@ -266,7 +266,7 @@ func findBugsForBisection(c context.Context, managers map[string]bool, reproLeve if !shouldBisectBug(bug, managers) { continue } - crash, crashKey, err := bisectCrashForBug(c, keys[bi], managers) + crash, crashKey, err := bisectCrashForBug(c, bug, keys[bi], managers, jobType) if err != nil { return nil, nil, err } @@ -293,7 +293,7 @@ func shouldBisectBug(bug *Bug, managers map[string]bool) bool { return false } -func bisectCrashForBug(c context.Context, bugKey *db.Key, managers map[string]bool) ( +func bisectCrashForBug(c context.Context, bug *Bug, bugKey *db.Key, managers map[string]bool, jobType JobType) ( *Crash, *db.Key, error) { crashes, crashKeys, err := queryCrashesForBug(c, bugKey, maxCrashes) if err != nil { @@ -303,11 +303,27 @@ func bisectCrashForBug(c context.Context, bugKey *db.Key, managers map[string]bo if crash.ReproSyz == 0 || !managers[crash.Manager] { continue } + if ok, err := shouldBisectCrash(c, bug, crash, jobType); err != nil { + return nil, nil, err + } else if !ok { + continue + } return crash, crashKeys[ci], nil } return nil, nil, nil } +func shouldBisectCrash(c context.Context, bug *Bug, crash *Crash, jobType JobType) (bool, error) { + if jobType != JobBisectFix { + return true, nil + } + build, err := loadBuild(c, bug.Namespace, crash.BuildID) + if err != nil { + return false, err + } + return !kernelRepoInfo(build).FixBisectionDisabled, nil +} + func createBisectJobForBug(c context.Context, bug0 *Bug, crash *Crash, bugKey, crashKey *db.Key, jobType JobType) ( *Job, *db.Key, error) { build, err := loadBuild(c, bug0.Namespace, crash.BuildID) diff --git a/dashboard/app/jobs_test.go b/dashboard/app/jobs_test.go index 7966c0228..b845c948b 100644 --- a/dashboard/app/jobs_test.go +++ b/dashboard/app/jobs_test.go @@ -639,3 +639,43 @@ func TestFixBisectionsListed(t *testing.T) { c.expectEQ(err, nil) c.expectTrue(!bytes.Contains(content, []byte("All fix bisections"))) } + +// Test that fix bisections do not occur if Repo has NoFixBisections set. +func TestFixBisectionsDisabled(t *testing.T) { + c := NewCtx(t) + defer c.Close() + + // Upload a crash report + build := testBuild(20) + build.KernelRepo = "git://syzkaller.org" + c.client2.UploadBuild(build) + crash := testCrashWithRepro(build, 20) + c.client2.ReportCrash(crash) + c.client2.pollEmailBug() + + // Receive the JobBisectCause. + resp := c.client2.pollJobs(build.Manager) + c.client2.expectNE(resp.ID, "") + c.client2.expectEQ(resp.Type, dashapi.JobBisectCause) + done := &dashapi.JobDoneReq{ + ID: resp.ID, + Error: []byte("testBisectFixRetry:JobBisectCause"), + } + c.client2.expectOK(c.client2.JobDone(done)) + + // Advance time by 30 days and read out any notification emails. + { + c.advanceTime(30 * 24 * time.Hour) + msg := c.client2.pollEmailBug() + c.expectEQ(msg.Subject, "title20") + c.expectTrue(strings.Contains(msg.Body, "Sending this report upstream.")) + + msg = c.client2.pollEmailBug() + c.expectEQ(msg.Subject, "title20") + c.expectTrue(strings.Contains(msg.Body, "syzbot found the following crash")) + } + + // Ensure that we do not get a JobBisectFix. + resp = c.client2.pollJobs(build.Manager) + c.client2.expectEQ(resp.ID, "") +} |