diff options
Diffstat (limited to 'vm/vmimpl/vmimpl.go')
| -rw-r--r-- | vm/vmimpl/vmimpl.go | 10 |
1 files changed, 10 insertions, 0 deletions
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) } |
