From fea4b504d8deaa5448203aae13bdb6ec3e6d33d9 Mon Sep 17 00:00:00 2001 From: Dmitry Vyukov Date: Thu, 24 Jan 2019 18:38:56 +0100 Subject: vm/vmimpl: produce better error in WaitForSSH Currently we squash VerboseError which leads to too lengthy build error titles. Handle verbose error more carefully. --- vm/vmimpl/vmimpl.go | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'vm/vmimpl/vmimpl.go') diff --git a/vm/vmimpl/vmimpl.go b/vm/vmimpl/vmimpl.go index e5efe19c2..f83d39d57 100644 --- a/vm/vmimpl/vmimpl.go +++ b/vm/vmimpl/vmimpl.go @@ -17,6 +17,7 @@ import ( "time" "github.com/google/syzkaller/pkg/log" + "github.com/google/syzkaller/pkg/osutil" ) // Pool represents a set of test machines (VMs, physical devices, etc) of particular type. @@ -76,6 +77,15 @@ type BootError struct { Output []byte } +func MakeBootError(err error, output []byte) error { + switch err1 := err.(type) { + case *osutil.VerboseError: + return BootError{err1.Title, append(err1.Output, output...)} + default: + return BootError{err.Error(), output} + } +} + func (err BootError) Error() string { return fmt.Sprintf("%v\n%s", err.Title, err.Output) } -- cgit mrf-deployment