vm/qemu: improve debug output

* vm/qemu: Improve debug output.

When running in debug mode, the number of VMs is reduced to 1.
State this in the debug output.

* vm/qemu: Don't start debug output with a capital letter.

As requested by Dimitry.

* vm: Provide debug message when reduing number of VMs.

Apply this change to all affected platforms for consistency.
Suggested by Dmitry.

* Add myself to AUTHORS/CONTRIBUTORS files.

* vm: Fix compilation issues missed in earlier commit.

* vm: Use logging to write debug message.
This commit is contained in:
Michael Tüxen 2018-11-30 18:12:03 +01:00 committed by Dmitry Vyukov
parent bc6b598a2d
commit 271b354c51
8 changed files with 16 additions and 6 deletions

View File

@ -27,3 +27,4 @@ Chi Pham
Anton Lindqvist
Greg Steuck
Shankara Pailoor
Michael Tuexen

View File

@ -38,3 +38,4 @@ Joey Jiao
Anton Lindqvist
Tobin Harding
Shankara Pailoor
Michael Tuexen

View File

@ -74,7 +74,8 @@ func ctor(env *vmimpl.Env) (vmimpl.Pool, error) {
if cfg.Count < 1 || cfg.Count > 1000 {
return nil, fmt.Errorf("invalid config param count: %v, want [1, 1000]", cfg.Count)
}
if env.Debug {
if env.Debug && cfg.Count > 1 {
log.Logf(0, "limiting number of VMs from %v to 1 in debug mode", cfg.Count)
cfg.Count = 1
}
if cfg.MachineType == "" {

View File

@ -18,6 +18,7 @@ import (
"time"
"github.com/google/syzkaller/pkg/config"
"github.com/google/syzkaller/pkg/log"
"github.com/google/syzkaller/pkg/osutil"
"github.com/google/syzkaller/vm/vmimpl"
)
@ -58,7 +59,8 @@ func ctor(env *vmimpl.Env) (vmimpl.Pool, error) {
if cfg.Count < 1 || cfg.Count > 128 {
return nil, fmt.Errorf("invalid config param count: %v, want [1, 128]", cfg.Count)
}
if env.Debug {
if env.Debug && cfg.Count > 1 {
log.Logf(0, "limiting number of VMs from %v to 1 in debug mode", cfg.Count)
cfg.Count = 1
}
if !osutil.IsExist(env.Image) {

View File

@ -62,7 +62,8 @@ func ctor(env *vmimpl.Env) (vmimpl.Pool, error) {
return nil, fmt.Errorf("bad target %q: %v", target, err)
}
}
if env.Debug {
if env.Debug && len(cfg.Targets) > 1 {
log.Logf(0, "limiting number of targets from %v to 1 in debug mode", len(cfg.Targets))
cfg.Targets = cfg.Targets[:1]
}
pool := &Pool{

View File

@ -16,6 +16,7 @@ import (
"time"
"github.com/google/syzkaller/pkg/config"
"github.com/google/syzkaller/pkg/log"
"github.com/google/syzkaller/pkg/osutil"
"github.com/google/syzkaller/vm/vmimpl"
)
@ -67,7 +68,8 @@ func ctor(env *vmimpl.Env) (vmimpl.Pool, error) {
if cfg.Count < 1 || cfg.Count > 128 {
return nil, fmt.Errorf("invalid config param count: %v, want [1, 128]", cfg.Count)
}
if env.Debug {
if env.Debug && cfg.Count > 1 {
log.Logf(0, "limiting number of VMs from %v to 1 in debug mode", cfg.Count)
cfg.Count = 1
}
if env.Image != "" {

View File

@ -180,7 +180,8 @@ func ctor(env *vmimpl.Env) (vmimpl.Pool, error) {
if cfg.Count < 1 || cfg.Count > 128 {
return nil, fmt.Errorf("invalid config param count: %v, want [1, 128]", cfg.Count)
}
if env.Debug {
if env.Debug && cfg.Count > 1 {
log.Logf(0, "limiting number of VMs from %v to 1 in debug mode", cfg.Count)
cfg.Count = 1
}
if _, err := exec.LookPath(cfg.Qemu); err != nil {

View File

@ -69,7 +69,8 @@ func ctor(env *vmimpl.Env) (vmimpl.Pool, error) {
if cfg.Count < 1 || cfg.Count > 128 {
return nil, fmt.Errorf("invalid config param count: %v, want [1-128]", cfg.Count)
}
if env.Debug {
if env.Debug && cfg.Count > 1 {
log.Logf(0, "limiting number of VMs from %v to 1 in debug mode", cfg.Count)
cfg.Count = 1
}
if cfg.Mem < 128 || cfg.Mem > 1048576 {