aboutsummaryrefslogtreecommitdiffstats
path: root/vm/vmimpl/vmimpl.go
diff options
context:
space:
mode:
authorDmitry Vyukov <dvyukov@google.com>2019-01-24 18:38:56 +0100
committerDmitry Vyukov <dvyukov@google.com>2019-01-24 18:56:19 +0100
commitfea4b504d8deaa5448203aae13bdb6ec3e6d33d9 (patch)
treeee8d1a67bd570297bd392eebe4a205260b2829c7 /vm/vmimpl/vmimpl.go
parent725ffbccf995a1264766a1e0666a05fcca323959 (diff)
vm/vmimpl: produce better error in WaitForSSH
Currently we squash VerboseError which leads to too lengthy build error titles. Handle verbose error more carefully.
Diffstat (limited to 'vm/vmimpl/vmimpl.go')
-rw-r--r--vm/vmimpl/vmimpl.go10
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)
}