aboutsummaryrefslogtreecommitdiffstats
path: root/pkg/instance/instance.go
diff options
context:
space:
mode:
authorDmitry Vyukov <dvyukov@google.com>2019-03-16 18:24:18 +0100
committerDmitry Vyukov <dvyukov@google.com>2019-03-17 18:06:44 +0100
commitdc89691385e8105f1c9fb3d30297470562aca3c1 (patch)
treec9af8b38c551c65e8b7bc1505d86049d447d6387 /pkg/instance/instance.go
parenta5e2500e1a54b144c6f3c3786a8a2851ee818074 (diff)
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.
Diffstat (limited to 'pkg/instance/instance.go')
-rw-r--r--pkg/instance/instance.go7
1 files changed, 6 insertions, 1 deletions
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{