aboutsummaryrefslogtreecommitdiffstats
path: root/pkg
diff options
context:
space:
mode:
authorDmitry Vyukov <dvyukov@google.com>2017-12-04 10:59:53 +0100
committerDmitry Vyukov <dvyukov@google.com>2017-12-04 10:59:53 +0100
commit99ea3eaf5b071b31cb7eaf0770593a57ad0214ab (patch)
tree9721f2bc92313b402e41cafccc8a72513adbec74 /pkg
parentc92879679c05ddf4364d1cd5dea947407f35b2f8 (diff)
pkg/report: test that Report is never empty
If Parse detects a crash, it must provide something in the Report field. If Report is empty, something is wrong with parsing. Update #457
Diffstat (limited to 'pkg')
-rw-r--r--pkg/report/linux.go4
-rw-r--r--pkg/report/report_test.go3
2 files changed, 7 insertions, 0 deletions
diff --git a/pkg/report/linux.go b/pkg/report/linux.go
index 56d21cf5b..cb51b0c15 100644
--- a/pkg/report/linux.go
+++ b/pkg/report/linux.go
@@ -176,6 +176,10 @@ func (ctx *linux) Parse(output []byte) *Report {
rep.Title = funcRe.ReplaceAllString(rep.Title, "$1")
// CPU numbers are not interesting.
rep.Title = cpuRe.ReplaceAllLiteralString(rep.Title, "CPU")
+ // TODO: broken: https://github.com/google/syzkaller/issues/457
+ if len(rep.Report) == 0 {
+ rep.Report = []byte("NO REPORT")
+ }
return rep
}
diff --git a/pkg/report/report_test.go b/pkg/report/report_test.go
index 98a7725ac..81fdaf085 100644
--- a/pkg/report/report_test.go
+++ b/pkg/report/report_test.go
@@ -83,6 +83,9 @@ func testParse(t *testing.T, os string, tests []ParseTest) {
if title != "" && test.Desc == "" {
t.Fatalf("found bogus crash message '%v' in:\n%v", title, test.Log)
}
+ if title != "" && len(rep.Report) == 0 {
+ t.Fatalf("found crash message %q but report is empty:\n%v", title, test.Log)
+ }
if title != test.Desc {
t.Fatalf("extracted bad crash message:\n%+q\nwant:\n%+q", title, test.Desc)
}