aboutsummaryrefslogtreecommitdiffstats
path: root/dashboard
diff options
context:
space:
mode:
authorDmitry Vyukov <dvyukov@google.com>2018-01-18 09:29:25 +0100
committerDmitry Vyukov <dvyukov@google.com>2018-01-18 10:01:26 +0100
commit0d1e95d2bafd3fb8cf589e3c6b9f5a116fdce673 (patch)
tree5b32ef32fa0900b970f763802256616241f03001 /dashboard
parentb134896b20b5f52e418e0221bf356d6f7a8be47b (diff)
dashboard/app: rearrange attachment order
Some email clients show attachments inline. Config is large, make it the last attachment. As suggested by Theodore Ts'o in https://groups.google.com/d/msg/syzkaller/5hjgr2v_oww/fn5QW6dvDQAJ
Diffstat (limited to 'dashboard')
-rw-r--r--dashboard/app/email_test.go48
-rw-r--r--dashboard/app/jobs_test.go28
-rw-r--r--dashboard/app/reporting_email.go13
3 files changed, 45 insertions, 44 deletions
diff --git a/dashboard/app/email_test.go b/dashboard/app/email_test.go
index e8666426a..522ebc7d4 100644
--- a/dashboard/app/email_test.go
+++ b/dashboard/app/email_test.go
@@ -43,10 +43,10 @@ func TestEmailReport(t *testing.T) {
c.expectEQ(msg.To, []string{to})
c.expectEQ(msg.Subject, crash.Title)
c.expectEQ(len(msg.Attachments), 2)
- c.expectEQ(msg.Attachments[0].Name, "config.txt")
- c.expectEQ(msg.Attachments[0].Data, build.KernelConfig)
- c.expectEQ(msg.Attachments[1].Name, "raw.log.txt")
- c.expectEQ(msg.Attachments[1].Data, crash.Log)
+ c.expectEQ(msg.Attachments[0].Name, "raw.log.txt")
+ c.expectEQ(msg.Attachments[0].Data, crash.Log)
+ c.expectEQ(msg.Attachments[1].Name, "config.txt")
+ c.expectEQ(msg.Attachments[1].Data, build.KernelConfig)
body := fmt.Sprintf(`Hello,
syzbot hit the following crash on repo1/branch1 commit
@@ -148,12 +148,12 @@ For more options, visit https://groups.google.com/d/optout.
c.expectEQ(msg.To, to)
c.expectEQ(msg.Subject, crash.Title)
c.expectEQ(len(msg.Attachments), 3)
- c.expectEQ(msg.Attachments[0].Name, "config.txt")
- c.expectEQ(msg.Attachments[0].Data, build.KernelConfig)
- c.expectEQ(msg.Attachments[1].Name, "raw.log.txt")
- c.expectEQ(msg.Attachments[1].Data, crash.Log)
- c.expectEQ(msg.Attachments[2].Name, "repro.syz.txt")
- c.expectEQ(msg.Attachments[2].Data, syzRepro)
+ c.expectEQ(msg.Attachments[0].Name, "raw.log.txt")
+ c.expectEQ(msg.Attachments[0].Data, crash.Log)
+ c.expectEQ(msg.Attachments[1].Name, "repro.syz.txt")
+ c.expectEQ(msg.Attachments[1].Data, syzRepro)
+ c.expectEQ(msg.Attachments[2].Name, "config.txt")
+ c.expectEQ(msg.Attachments[2].Data, build.KernelConfig)
c.expectEQ(msg.Headers["In-Reply-To"], []string{"<1234>"})
body := fmt.Sprintf(`syzbot has found reproducer for the following crash on repo1/branch1 commit
kernel_commit1 (Sat Feb 3 04:05:06 0001 +0000)
@@ -198,12 +198,12 @@ report1
c.expectEQ(msg.To, []string{"bar@foo.com", "bugs@syzkaller.com", "foo@bar.com"})
c.expectEQ(msg.Subject, crash.Title)
c.expectEQ(len(msg.Attachments), 3)
- c.expectEQ(msg.Attachments[0].Name, "config.txt")
- c.expectEQ(msg.Attachments[0].Data, build.KernelConfig)
- c.expectEQ(msg.Attachments[1].Name, "raw.log.txt")
- c.expectEQ(msg.Attachments[1].Data, crash.Log)
- c.expectEQ(msg.Attachments[2].Name, "repro.syz.txt")
- c.expectEQ(msg.Attachments[2].Data, syzRepro)
+ c.expectEQ(msg.Attachments[0].Name, "raw.log.txt")
+ c.expectEQ(msg.Attachments[0].Data, crash.Log)
+ c.expectEQ(msg.Attachments[1].Name, "repro.syz.txt")
+ c.expectEQ(msg.Attachments[1].Data, syzRepro)
+ c.expectEQ(msg.Attachments[2].Name, "config.txt")
+ c.expectEQ(msg.Attachments[2].Data, build.KernelConfig)
body := fmt.Sprintf(`Hello,
syzbot hit the following crash on repo1/branch1 commit
@@ -284,14 +284,14 @@ Content-Type: text/plain
c.expectEQ(msg.To, []string{"another@another.com", "bar@foo.com", "bugs@syzkaller.com", "foo@bar.com", "new@new.com", "qux@qux.com"})
c.expectEQ(msg.Subject, crash.Title)
c.expectEQ(len(msg.Attachments), 4)
- c.expectEQ(msg.Attachments[0].Name, "config.txt")
- c.expectEQ(msg.Attachments[0].Data, build2.KernelConfig)
- c.expectEQ(msg.Attachments[1].Name, "raw.log.txt")
- c.expectEQ(msg.Attachments[1].Data, crash.Log)
- c.expectEQ(msg.Attachments[2].Name, "repro.syz.txt")
- c.expectEQ(msg.Attachments[2].Data, syzRepro)
- c.expectEQ(msg.Attachments[3].Name, "repro.c.txt")
- c.expectEQ(msg.Attachments[3].Data, crash.ReproC)
+ c.expectEQ(msg.Attachments[0].Name, "raw.log.txt")
+ c.expectEQ(msg.Attachments[0].Data, crash.Log)
+ c.expectEQ(msg.Attachments[1].Name, "repro.syz.txt")
+ c.expectEQ(msg.Attachments[1].Data, syzRepro)
+ c.expectEQ(msg.Attachments[2].Name, "repro.c.txt")
+ c.expectEQ(msg.Attachments[2].Data, crash.ReproC)
+ c.expectEQ(msg.Attachments[3].Name, "config.txt")
+ c.expectEQ(msg.Attachments[3].Data, build2.KernelConfig)
body := fmt.Sprintf(`syzbot has found reproducer for the following crash on repo2/branch2 commit
kernel_commit2 (Sat Feb 3 04:05:06 0001 +0000)
kernel_commit_title2
diff --git a/dashboard/app/jobs_test.go b/dashboard/app/jobs_test.go
index cb7d0cd9a..f4a5a16be 100644
--- a/dashboard/app/jobs_test.go
+++ b/dashboard/app/jobs_test.go
@@ -116,12 +116,12 @@ func TestJob(t *testing.T) {
c.expectEQ(msg.To, []string{"default@sender.com", list})
c.expectEQ(msg.Subject, crash.Title)
c.expectEQ(len(msg.Attachments), 3)
- c.expectEQ(msg.Attachments[0].Name, "config.txt")
- c.expectEQ(msg.Attachments[0].Data, build.KernelConfig)
- c.expectEQ(msg.Attachments[1].Name, "patch.diff")
- c.expectEQ(msg.Attachments[1].Data, []byte(patch))
- c.expectEQ(msg.Attachments[2].Name, "raw.log.txt")
- c.expectEQ(msg.Attachments[2].Data, jobDoneReq.CrashLog)
+ c.expectEQ(msg.Attachments[0].Name, "patch.diff")
+ c.expectEQ(msg.Attachments[0].Data, []byte(patch))
+ c.expectEQ(msg.Attachments[1].Name, "raw.log.txt")
+ c.expectEQ(msg.Attachments[1].Data, jobDoneReq.CrashLog)
+ c.expectEQ(msg.Attachments[2].Name, "config.txt")
+ c.expectEQ(msg.Attachments[2].Data, build.KernelConfig)
body := `Hello,
syzbot has tested the proposed patch but the reproducer still triggered crash:
@@ -156,10 +156,10 @@ Raw console output is attached.
{
msg := <-c.emailSink
c.expectEQ(len(msg.Attachments), 2)
- c.expectEQ(msg.Attachments[0].Name, "config.txt")
- c.expectEQ(msg.Attachments[0].Data, build.KernelConfig)
- c.expectEQ(msg.Attachments[1].Name, "patch.diff")
- c.expectEQ(msg.Attachments[1].Data, []byte(patch))
+ c.expectEQ(msg.Attachments[0].Name, "patch.diff")
+ c.expectEQ(msg.Attachments[0].Data, []byte(patch))
+ c.expectEQ(msg.Attachments[1].Name, "config.txt")
+ c.expectEQ(msg.Attachments[1].Data, build.KernelConfig)
body := `Hello,
syzbot tried to test the proposed patch but build/boot failed:
@@ -194,10 +194,10 @@ Kernel config is attached.
{
msg := <-c.emailSink
c.expectEQ(len(msg.Attachments), 2)
- c.expectEQ(msg.Attachments[0].Name, "config.txt")
- c.expectEQ(msg.Attachments[0].Data, build.KernelConfig)
- c.expectEQ(msg.Attachments[1].Name, "patch.diff")
- c.expectEQ(msg.Attachments[1].Data, []byte(patch))
+ c.expectEQ(msg.Attachments[0].Name, "patch.diff")
+ c.expectEQ(msg.Attachments[0].Data, []byte(patch))
+ c.expectEQ(msg.Attachments[1].Name, "config.txt")
+ c.expectEQ(msg.Attachments[1].Data, build.KernelConfig)
body := fmt.Sprintf(`Hello,
syzbot has tested the proposed patch and the reproducer did not trigger crash:
diff --git a/dashboard/app/reporting_email.go b/dashboard/app/reporting_email.go
index d7e0b10df..0a0f1ed10 100644
--- a/dashboard/app/reporting_email.go
+++ b/dashboard/app/reporting_email.go
@@ -144,12 +144,7 @@ func emailReport(c context.Context, rep *dashapi.BugReport, templ string) error
}
to = email.MergeEmailLists(to, rep.CC)
var attachments []aemail.Attachment
- if len(rep.KernelConfig) != 0 {
- attachments = append(attachments, aemail.Attachment{
- Name: "config.txt",
- Data: rep.KernelConfig,
- })
- }
+ // Note: order of attachments is important. Some email clients show them inline.
if len(rep.Patch) != 0 {
attachments = append(attachments, aemail.Attachment{
Name: "patch.diff",
@@ -174,6 +169,12 @@ func emailReport(c context.Context, rep *dashapi.BugReport, templ string) error
Data: rep.ReproC,
})
}
+ if len(rep.KernelConfig) != 0 {
+ attachments = append(attachments, aemail.Attachment{
+ Name: "config.txt",
+ Data: rep.KernelConfig,
+ })
+ }
// Build error output and failing VM boot log can be way too long to inline.
const maxInlineError = 16 << 10
errorText, errorTruncated := rep.Error, false