From 99ea3eaf5b071b31cb7eaf0770593a57ad0214ab Mon Sep 17 00:00:00 2001 From: Dmitry Vyukov Date: Mon, 4 Dec 2017 10:59:53 +0100 Subject: 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 --- pkg/report/linux.go | 4 ++++ pkg/report/report_test.go | 3 +++ 2 files changed, 7 insertions(+) (limited to 'pkg') 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) } -- cgit mrf-deployment