From dc89691385e8105f1c9fb3d30297470562aca3c1 Mon Sep 17 00:00:00 2001 From: Dmitry Vyukov Date: Sat, 16 Mar 2019 18:24:18 +0100 Subject: pkg/instance: fix boot error detection Currently we truncate output up to rep.EndPos after unexpected reboot. But report sets EndPos to the _last_ report in output, so if there are any other errors they are all skipped after truncation to EndPos. Truncate just one line instead. --- pkg/instance/instance.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'pkg/instance') diff --git a/pkg/instance/instance.go b/pkg/instance/instance.go index 342668cd3..ac553c2b9 100644 --- a/pkg/instance/instance.go +++ b/pkg/instance/instance.go @@ -6,6 +6,7 @@ package instance import ( + "bytes" "encoding/json" "fmt" "net" @@ -208,7 +209,11 @@ func (inst *inst) test() error { rep := inst.reporter.Parse(testErr.Output) if rep != nil && rep.Title == report.UnexpectedKernelReboot { // Avoid detecting any boot crash as "unexpected kernel reboot". - rep = inst.reporter.Parse(testErr.Output[rep.EndPos:]) + output := testErr.Output[rep.EndPos:] + if pos := bytes.IndexByte(testErr.Output[rep.StartPos:], '\n'); pos != -1 { + output = testErr.Output[rep.StartPos+pos:] + } + rep = inst.reporter.Parse(output) } if rep == nil { rep = &report.Report{ -- cgit mrf-deployment