aboutsummaryrefslogtreecommitdiffstats
path: root/vm
diff options
context:
space:
mode:
authorDmitry Vyukov <dvyukov@google.com>2018-05-03 14:41:34 +0200
committerDmitry Vyukov <dvyukov@google.com>2018-05-03 14:41:34 +0200
commit9fe5658a1b7320b756d02cf2075dc5c735f86ff4 (patch)
treec7960e2ef3f7cef6cb8e63df115c4e07574f7024 /vm
parent39302300d91e4875a2e2f475bb7938dfc86a5e20 (diff)
gometalinter: check dot imports
Update #538
Diffstat (limited to 'vm')
-rw-r--r--vm/adb/adb.go26
-rw-r--r--vm/gce/gce.go22
-rw-r--r--vm/isolated/isolated.go36
-rw-r--r--vm/qemu/qemu.go8
4 files changed, 46 insertions, 46 deletions
diff --git a/vm/adb/adb.go b/vm/adb/adb.go
index 853f541e1..d2fc73c76 100644
--- a/vm/adb/adb.go
+++ b/vm/adb/adb.go
@@ -18,7 +18,7 @@ import (
"time"
"github.com/google/syzkaller/pkg/config"
- . "github.com/google/syzkaller/pkg/log"
+ "github.com/google/syzkaller/pkg/log"
"github.com/google/syzkaller/pkg/osutil"
"github.com/google/syzkaller/vm/vmimpl"
)
@@ -138,16 +138,16 @@ func findConsole(adb, dev string) string {
}
con, err := findConsoleImpl(adb, dev)
if err != nil {
- Logf(0, "failed to associate adb device %v with console: %v", dev, err)
- Logf(0, "falling back to 'adb shell dmesg -w'")
- Logf(0, "note: some bugs may be detected as 'lost connection to test machine' with no kernel output")
+ log.Logf(0, "failed to associate adb device %v with console: %v", dev, err)
+ log.Logf(0, "falling back to 'adb shell dmesg -w'")
+ log.Logf(0, "note: some bugs may be detected as 'lost connection to test machine' with no kernel output")
con = "adb"
devToConsole[dev] = con
return con
}
devToConsole[dev] = con
consoleToDev[con] = dev
- Logf(0, "associating adb device %v with console %v", dev, con)
+ log.Logf(0, "associating adb device %v with console %v", dev, con)
return con
}
@@ -231,7 +231,7 @@ func (inst *instance) Forward(port int) (string, error) {
func (inst *instance) adb(args ...string) ([]byte, error) {
if inst.debug {
- Logf(0, "executing adb %+v", args)
+ log.Logf(0, "executing adb %+v", args)
}
rpipe, wpipe, err := os.Pipe()
if err != nil {
@@ -251,7 +251,7 @@ func (inst *instance) adb(args ...string) ([]byte, error) {
select {
case <-time.After(time.Minute):
if inst.debug {
- Logf(0, "adb hanged")
+ log.Logf(0, "adb hanged")
}
cmd.Process.Kill()
case <-done:
@@ -261,13 +261,13 @@ func (inst *instance) adb(args ...string) ([]byte, error) {
close(done)
out, _ := ioutil.ReadAll(rpipe)
if inst.debug {
- Logf(0, "adb failed: %v\n%s", err, out)
+ log.Logf(0, "adb failed: %v\n%s", err, out)
}
return nil, fmt.Errorf("adb %+v failed: %v\n%s", args, err, out)
}
close(done)
if inst.debug {
- Logf(0, "adb returned")
+ log.Logf(0, "adb returned")
}
out, _ := ioutil.ReadAll(rpipe)
return out, nil
@@ -320,11 +320,11 @@ func (inst *instance) checkBatteryLevel() error {
return err
}
if val >= minLevel {
- Logf(0, "device %v: battery level %v%%, OK", inst.device, val)
+ log.Logf(0, "device %v: battery level %v%%, OK", inst.device, val)
return nil
}
for {
- Logf(0, "device %v: battery level %v%%, waiting for %v%%", inst.device, val, requiredLevel)
+ log.Logf(0, "device %v: battery level %v%%, waiting for %v%%", inst.device, val, requiredLevel)
if !vmimpl.SleepInterruptible(time.Minute) {
return nil
}
@@ -400,7 +400,7 @@ func (inst *instance) Run(timeout time.Duration, stop <-chan bool, command strin
return nil, nil, err
}
if inst.debug {
- Logf(0, "starting: adb shell %v", command)
+ log.Logf(0, "starting: adb shell %v", command)
}
adb := osutil.Command(inst.adbBin, "-s", inst.device, "shell", "cd /data; "+command)
adb.Stdout = adbWpipe
@@ -437,7 +437,7 @@ func (inst *instance) Run(timeout time.Duration, stop <-chan bool, command strin
signal(vmimpl.ErrTimeout)
case <-inst.closed:
if inst.debug {
- Logf(0, "instance closed")
+ log.Logf(0, "instance closed")
}
signal(fmt.Errorf("instance closed"))
case err := <-merger.Err:
diff --git a/vm/gce/gce.go b/vm/gce/gce.go
index 782712c4a..7f3281382 100644
--- a/vm/gce/gce.go
+++ b/vm/gce/gce.go
@@ -26,7 +26,7 @@ import (
"github.com/google/syzkaller/pkg/gce"
"github.com/google/syzkaller/pkg/gcs"
"github.com/google/syzkaller/pkg/kd"
- . "github.com/google/syzkaller/pkg/log"
+ "github.com/google/syzkaller/pkg/log"
"github.com/google/syzkaller/pkg/osutil"
"github.com/google/syzkaller/vm/vmimpl"
)
@@ -94,17 +94,17 @@ func ctor(env *vmimpl.Env) (vmimpl.Pool, error) {
if err != nil {
return nil, fmt.Errorf("failed to init gce: %v", err)
}
- Logf(0, "GCE initialized: running on %v, internal IP %v, project %v, zone %v, net %v/%v",
+ log.Logf(0, "GCE initialized: running on %v, internal IP %v, project %v, zone %v, net %v/%v",
GCE.Instance, GCE.InternalIP, GCE.ProjectID, GCE.ZoneID, GCE.Network, GCE.Subnetwork)
if cfg.GCE_Image == "" {
cfg.GCE_Image = env.Name
gcsImage := filepath.Join(cfg.GCS_Path, env.Name+"-image.tar.gz")
- Logf(0, "uploading image to %v...", gcsImage)
+ log.Logf(0, "uploading image to %v...", gcsImage)
if err := uploadImageToGCS(env.Image, gcsImage); err != nil {
return nil, err
}
- Logf(0, "creating GCE image %v...", cfg.GCE_Image)
+ log.Logf(0, "creating GCE image %v...", cfg.GCE_Image)
if err := GCE.DeleteImage(cfg.GCE_Image); err != nil {
return nil, fmt.Errorf("failed to delete GCE image: %v", err)
}
@@ -137,11 +137,11 @@ func (pool *Pool) Create(workdir string, index int) (vmimpl.Instance, error) {
return nil, fmt.Errorf("failed to read file: %v", err)
}
- Logf(0, "deleting instance: %v", name)
+ log.Logf(0, "deleting instance: %v", name)
if err := pool.GCE.DeleteInstance(name, true); err != nil {
return nil, err
}
- Logf(0, "creating instance: %v", name)
+ log.Logf(0, "creating instance: %v", name)
ip, err := pool.GCE.CreateInstance(name, pool.cfg.Machine_Type, pool.cfg.GCE_Image, string(gceKeyPub))
if err != nil {
return nil, err
@@ -160,7 +160,7 @@ func (pool *Pool) Create(workdir string, index int) (vmimpl.Instance, error) {
sshKey = gceKey
sshUser = "syzkaller"
}
- Logf(0, "wait instance to boot: %v (%v)", name, ip)
+ log.Logf(0, "wait instance to boot: %v (%v)", name, ip)
if err := pool.waitInstanceBoot(name, ip, sshKey, sshUser, gceKey); err != nil {
return nil, err
}
@@ -327,13 +327,13 @@ func (inst *instance) Run(timeout time.Duration, stop <-chan bool, command strin
} else if merr, ok := err.(vmimpl.MergerError); ok && merr.R == conRpipe {
// Console connection must never fail. If it does, it's either
// instance preemption or a GCE bug. In either case, not a kernel bug.
- Logf(1, "%v: gce console connection failed with %v", inst.name, merr.Err)
+ log.Logf(1, "%v: gce console connection failed with %v", inst.name, merr.Err)
err = vmimpl.ErrTimeout
} else {
// Check if the instance was terminated due to preemption or host maintenance.
time.Sleep(5 * time.Second) // just to avoid any GCE races
if !inst.GCE.IsInstanceRunning(inst.name) {
- Logf(1, "%v: ssh exited but instance is not running", inst.name)
+ log.Logf(1, "%v: ssh exited but instance is not running", inst.name)
err = vmimpl.ErrTimeout
}
}
@@ -475,11 +475,11 @@ func uploadImageToGCS(localImage, gcsImage string) error {
func runCmd(debug bool, bin string, args ...string) ([]byte, error) {
if debug {
- Logf(0, "running command: %v %#v", bin, args)
+ log.Logf(0, "running command: %v %#v", bin, args)
}
output, err := osutil.RunCmd(time.Minute, "", bin, args...)
if debug {
- Logf(0, "result: %v\n%s", err, output)
+ log.Logf(0, "result: %v\n%s", err, output)
}
return output, err
}
diff --git a/vm/isolated/isolated.go b/vm/isolated/isolated.go
index b746c91b5..449228192 100644
--- a/vm/isolated/isolated.go
+++ b/vm/isolated/isolated.go
@@ -14,7 +14,7 @@ import (
"time"
"github.com/google/syzkaller/pkg/config"
- . "github.com/google/syzkaller/pkg/log"
+ "github.com/google/syzkaller/pkg/log"
"github.com/google/syzkaller/pkg/osutil"
"github.com/google/syzkaller/vm/vmimpl"
)
@@ -117,7 +117,7 @@ func (inst *instance) Forward(port int) (string, error) {
func (inst *instance) ssh(command string) ([]byte, error) {
if inst.debug {
- Logf(0, "executing ssh %+v", command)
+ log.Logf(0, "executing ssh %+v", command)
}
rpipe, wpipe, err := osutil.LongPipe()
@@ -127,7 +127,7 @@ func (inst *instance) ssh(command string) ([]byte, error) {
args := append(inst.sshArgs("-p"), inst.target, command)
if inst.debug {
- Logf(0, "running command: ssh %#v", args)
+ log.Logf(0, "running command: ssh %#v", args)
}
cmd := osutil.Command("ssh", args...)
cmd.Stdout = wpipe
@@ -143,7 +143,7 @@ func (inst *instance) ssh(command string) ([]byte, error) {
select {
case <-time.After(time.Second * 30):
if inst.debug {
- Logf(0, "ssh hanged")
+ log.Logf(0, "ssh hanged")
}
cmd.Process.Kill()
case <-done:
@@ -153,39 +153,39 @@ func (inst *instance) ssh(command string) ([]byte, error) {
close(done)
out, _ := ioutil.ReadAll(rpipe)
if inst.debug {
- Logf(0, "ssh failed: %v\n%s", err, out)
+ log.Logf(0, "ssh failed: %v\n%s", err, out)
}
return nil, fmt.Errorf("ssh %+v failed: %v\n%s", args, err, out)
}
close(done)
if inst.debug {
- Logf(0, "ssh returned")
+ log.Logf(0, "ssh returned")
}
out, _ := ioutil.ReadAll(rpipe)
return out, nil
}
func (inst *instance) repair() error {
- Logf(2, "isolated: trying to ssh")
+ log.Logf(2, "isolated: trying to ssh")
if err := inst.waitForSSH(30 * 60); err == nil {
if inst.cfg.Target_Reboot {
- Logf(2, "isolated: trying to reboot")
+ log.Logf(2, "isolated: trying to reboot")
inst.ssh("reboot") // reboot will return an error, ignore it
if err := inst.waitForReboot(5 * 60); err != nil {
- Logf(2, "isolated: machine did not reboot")
+ log.Logf(2, "isolated: machine did not reboot")
return err
}
- Logf(2, "isolated: rebooted wait for comeback")
+ log.Logf(2, "isolated: rebooted wait for comeback")
if err := inst.waitForSSH(30 * 60); err != nil {
- Logf(2, "isolated: machine did not comeback")
+ log.Logf(2, "isolated: machine did not comeback")
return err
}
- Logf(2, "isolated: reboot succeeded")
+ log.Logf(2, "isolated: reboot succeeded")
} else {
- Logf(2, "isolated: ssh succeeded")
+ log.Logf(2, "isolated: ssh succeeded")
}
} else {
- Logf(2, "isolated: ssh failed")
+ log.Logf(2, "isolated: ssh failed")
return fmt.Errorf("SSH failed")
}
@@ -238,7 +238,7 @@ func (inst *instance) Copy(hostSrc string) (string, error) {
args := append(inst.sshArgs("-P"), hostSrc, inst.target+":"+vmDst)
cmd := osutil.Command("scp", args...)
if inst.debug {
- Logf(0, "running command: scp %#v", args)
+ log.Logf(0, "running command: scp %#v", args)
cmd.Stdout = os.Stdout
cmd.Stderr = os.Stdout
}
@@ -281,9 +281,9 @@ func (inst *instance) Run(timeout time.Duration, stop <-chan bool, command strin
args = append(args, "-R", proxy)
}
args = append(args, inst.target, "cd "+inst.cfg.Target_Dir+" && exec "+command)
- Logf(0, "running command: ssh %#v", args)
+ log.Logf(0, "running command: ssh %#v", args)
if inst.debug {
- Logf(0, "running command: ssh %#v", args)
+ log.Logf(0, "running command: ssh %#v", args)
}
cmd := osutil.Command("ssh", args...)
cmd.Stdout = wpipe
@@ -320,7 +320,7 @@ func (inst *instance) Run(timeout time.Duration, stop <-chan bool, command strin
signal(vmimpl.ErrTimeout)
case <-inst.closed:
if inst.debug {
- Logf(0, "instance closed")
+ log.Logf(0, "instance closed")
}
signal(fmt.Errorf("instance closed"))
case err := <-merger.Err:
diff --git a/vm/qemu/qemu.go b/vm/qemu/qemu.go
index b44f4198c..f82c88e1f 100644
--- a/vm/qemu/qemu.go
+++ b/vm/qemu/qemu.go
@@ -16,7 +16,7 @@ import (
"time"
"github.com/google/syzkaller/pkg/config"
- . "github.com/google/syzkaller/pkg/log"
+ "github.com/google/syzkaller/pkg/log"
"github.com/google/syzkaller/pkg/osutil"
"github.com/google/syzkaller/vm/vmimpl"
)
@@ -306,7 +306,7 @@ func (inst *instance) Boot() error {
)
}
if inst.debug {
- Logf(0, "running command: %v %#v", inst.cfg.Qemu, args)
+ log.Logf(0, "running command: %v %#v", inst.cfg.Qemu, args)
}
qemu := osutil.Command(inst.cfg.Qemu, args...)
qemu.Stdout = inst.wpipe
@@ -396,7 +396,7 @@ func (inst *instance) Copy(hostSrc string) (string, error) {
args := append(inst.sshArgs("-P"), hostSrc, inst.sshuser+"@localhost:"+vmDst)
cmd := osutil.Command("scp", args...)
if inst.debug {
- Logf(0, "running command: scp %#v", args)
+ log.Logf(0, "running command: scp %#v", args)
cmd.Stdout = os.Stdout
cmd.Stderr = os.Stdout
}
@@ -428,7 +428,7 @@ func (inst *instance) Run(timeout time.Duration, stop <-chan bool, command strin
args := append(inst.sshArgs("-p"), inst.sshuser+"@localhost", command)
if inst.debug {
- Logf(0, "running command: ssh %#v", args)
+ log.Logf(0, "running command: ssh %#v", args)
}
cmd := osutil.Command("ssh", args...)
cmd.Stdout = wpipe