aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTaras Madan <tarasmadan@google.com>2023-10-26 11:58:05 +0200
committerTaras Madan <tarasmadan@google.com>2023-10-26 10:44:12 +0000
commit23afc60f9d53873eed6f06fcb586bfb7bb4726a0 (patch)
tree5c41082bf4f0f071720d3e6b8c777afc8d235f2c
parentb67a3ce3b99706380622c73e97aa2cbc3bbf2987 (diff)
dashboard/app: deduplicate syz test string
To unblock #4285.
-rw-r--r--dashboard/app/email_test.go14
-rw-r--r--dashboard/app/jobs_test.go20
2 files changed, 18 insertions, 16 deletions
diff --git a/dashboard/app/email_test.go b/dashboard/app/email_test.go
index b79bdcb16..d005bd229 100644
--- a/dashboard/app/email_test.go
+++ b/dashboard/app/email_test.go
@@ -996,7 +996,7 @@ func TestBugFromSubjectInference(t *testing.T) {
// First try to ping some non-existing bug.
subject := "Re: unknown-bug"
c.incomingEmail("bugs@syzkaller.com",
- "#syz test: git://git.git/git.git kernel-branch\n"+sampleGitPatch,
+ syzTestGitBranchSamplePatch,
EmailOptOrigFrom("test@requester.com"),
EmailOptFrom(mailingList), EmailOptSubject(subject),
)
@@ -1007,7 +1007,7 @@ func TestBugFromSubjectInference(t *testing.T) {
// Now try to test the exiting bug, but with the wrong mailing list.
subject = "Re: " + crashTitle
c.incomingEmail("bugs@syzkaller.com",
- "#syz test: git://git.git/git.git kernel-branch\n"+sampleGitPatch,
+ syzTestGitBranchSamplePatch,
EmailOptOrigFrom("test@requester.com"),
EmailOptFrom("<unknown-list@syzkaller.com>"), EmailOptSubject(subject),
)
@@ -1016,7 +1016,7 @@ func TestBugFromSubjectInference(t *testing.T) {
// Now try to test the exiting bug with the proper mailing list.
c.incomingEmail("bugs@syzkaller.com",
- "#syz test: git://git.git/git.git kernel-branch\n"+sampleGitPatch,
+ syzTestGitBranchSamplePatch,
EmailOptFrom(mailingList), EmailOptOrigFrom("test@requester.com"),
EmailOptSubject(subject),
)
@@ -1026,7 +1026,7 @@ func TestBugFromSubjectInference(t *testing.T) {
// Test that a different type of email headers is also parsed fine.
c.incomingEmail("bugs@syzkaller.com",
- "#syz test: git://git.git/git.git kernel-branch\n"+sampleGitPatch,
+ syzTestGitBranchSamplePatch,
EmailOptSender(mailingList), EmailOptFrom("test@requester.com"),
EmailOptSubject(subject),
)
@@ -1038,7 +1038,7 @@ func TestBugFromSubjectInference(t *testing.T) {
// Ensure that the inference fails with the proper title.
c.incomingEmail("bugs@syzkaller.com",
- "#syz test: git://git.git/git.git kernel-branch\n"+sampleGitPatch,
+ syzTestGitBranchSamplePatch,
EmailOptSender(mailingList), EmailOptFrom("test@requester.com"),
EmailOptSubject(subject),
)
@@ -1058,7 +1058,7 @@ func TestBugFromSubjectInference(t *testing.T) {
// Make sure syzbot can understand the (2) version.
subject = "Re: " + crashTitle + " (2)"
c.incomingEmail("bugs@syzkaller.com",
- "#syz test: git://git.git/git.git kernel-branch\n"+sampleGitPatch,
+ syzTestGitBranchSamplePatch,
EmailOptFrom(mailingList), EmailOptOrigFrom("<test@requester.com>"),
EmailOptSubject(subject),
)
@@ -1138,7 +1138,7 @@ func TestEmailPatchTestingAccess(t *testing.T) {
sender := c.pollEmailBug().Sender
c.incomingEmail(sender,
- "#syz test: git://git.git/git.git kernel-branch\n"+sampleGitPatch,
+ syzTestGitBranchSamplePatch,
EmailOptFrom("user@kernel.org"), EmailOptSubject("Re: "+crash.Title),
)
diff --git a/dashboard/app/jobs_test.go b/dashboard/app/jobs_test.go
index d2e81de75..43e393c77 100644
--- a/dashboard/app/jobs_test.go
+++ b/dashboard/app/jobs_test.go
@@ -22,6 +22,8 @@ const sampleGitPatch = `--- a/mm/kasan/kasan.c
+ current->kasan_depth--;
`
+const syzTestGitBranchSamplePatch = "#syz test: git://git.git/git.git kernel-branch\n" + sampleGitPatch
+
// nolint: funlen
func TestJob(t *testing.T) {
c := NewCtx(t)
@@ -45,7 +47,7 @@ func TestJob(t *testing.T) {
c.incomingEmail(sender, "bla-bla-bla", EmailOptFrom("maintainer@kernel.org"),
EmailOptCC([]string{mailingList, "kernel@mailing.list"}))
- c.incomingEmail(sender, "#syz test: git://git.git/git.git kernel-branch\n"+sampleGitPatch,
+ c.incomingEmail(sender, syzTestGitBranchSamplePatch,
EmailOptFrom("test@requester.com"), EmailOptCC([]string{mailingList}))
body := c.pollEmailBug().Body
t.Logf("body: %s", body)
@@ -78,20 +80,20 @@ func TestJob(t *testing.T) {
body = c.pollEmailBug().Body
c.expectEQ(strings.Contains(body, "does not look like a valid git repo"), true)
- c.incomingEmail(sender, "#syz test: git://git.git/git.git kernel-branch\n"+sampleGitPatch,
+ c.incomingEmail(sender, syzTestGitBranchSamplePatch,
EmailOptFrom("\"foo\" <blOcKed@dOmain.COM>"))
c.expectNoEmail()
pollResp := client.pollJobs(build.Manager)
c.expectEQ(pollResp.ID, "")
// This submits actual test request.
- c.incomingEmail(sender, "#syz test: git://git.git/git.git kernel-branch\n"+sampleGitPatch,
+ c.incomingEmail(sender, syzTestGitBranchSamplePatch,
EmailOptMessageID(1), EmailOptFrom("test@requester.com"),
EmailOptCC([]string{"somebody@else.com", "test@syzkaller.com"}))
c.expectNoEmail()
// A dup of the same request with the same Message-ID.
- c.incomingEmail(sender, "#syz test: git://git.git/git.git kernel-branch\n"+sampleGitPatch,
+ c.incomingEmail(sender, syzTestGitBranchSamplePatch,
EmailOptMessageID(1), EmailOptFrom("test@requester.com"),
EmailOptCC([]string{"somebody@else.com", "test@syzkaller.com"}))
c.expectNoEmail()
@@ -157,7 +159,7 @@ patch: %[1]v
}
// Testing fails with an error.
- c.incomingEmail(sender, "#syz test: git://git.git/git.git kernel-branch\n"+sampleGitPatch, EmailOptMessageID(2))
+ c.incomingEmail(sender, syzTestGitBranchSamplePatch, EmailOptMessageID(2))
pollResp = client.pollJobs(build.Manager)
c.expectEQ(pollResp.Type, dashapi.JobTestPatch)
jobDoneReq = &dashapi.JobDoneReq{
@@ -194,7 +196,7 @@ patch: %[1]v
}
// Testing fails with a huge error that can't be inlined in email.
- c.incomingEmail(sender, "#syz test: git://git.git/git.git kernel-branch\n"+sampleGitPatch, EmailOptMessageID(3))
+ c.incomingEmail(sender, syzTestGitBranchSamplePatch, EmailOptMessageID(3))
pollResp = client.pollJobs(build.Manager)
c.expectEQ(pollResp.Type, dashapi.JobTestPatch)
jobDoneReq = &dashapi.JobDoneReq{
@@ -236,7 +238,7 @@ patch: %[3]v
c.checkURLContents(kernelConfigLink, build.KernelConfig)
}
- c.incomingEmail(sender, "#syz test: git://git.git/git.git kernel-branch\n"+sampleGitPatch, EmailOptMessageID(4))
+ c.incomingEmail(sender, syzTestGitBranchSamplePatch, EmailOptMessageID(4))
pollResp = client.pollJobs(build.Manager)
c.expectEQ(pollResp.Type, dashapi.JobTestPatch)
jobDoneReq = &dashapi.JobDoneReq{
@@ -295,7 +297,7 @@ func TestBootErrorPatch(t *testing.T) {
sender = c.pollEmailBug().Sender
mailingList := c.config().Namespaces["test2"].Reporting[1].Config.(*EmailConfig).Email
- c.incomingEmail(sender, "#syz test: git://git.git/git.git kernel-branch\n"+sampleGitPatch,
+ c.incomingEmail(sender, syzTestGitBranchSamplePatch,
EmailOptFrom("test@requester.com"), EmailOptCC([]string{mailingList}))
c.expectNoEmail()
pollResp := c.client2.pollJobs(build.Manager)
@@ -320,7 +322,7 @@ func TestTestErrorPatch(t *testing.T) {
sender = c.pollEmailBug().Sender
mailingList := c.config().Namespaces["test2"].Reporting[1].Config.(*EmailConfig).Email
- c.incomingEmail(sender, "#syz test: git://git.git/git.git kernel-branch\n"+sampleGitPatch,
+ c.incomingEmail(sender, syzTestGitBranchSamplePatch,
EmailOptFrom("test@requester.com"), EmailOptCC([]string{mailingList}))
c.expectNoEmail()
pollResp := c.client2.pollJobs(build.Manager)