diff options
| author | Dmitry Vyukov <dvyukov@google.com> | 2018-12-24 09:41:43 +0100 |
|---|---|---|
| committer | Dmitry Vyukov <dvyukov@google.com> | 2018-12-24 09:59:56 +0100 |
| commit | 88f59346334b1ec60ea3cc78af174856aee31866 (patch) | |
| tree | e9c27e73b53b9328683c54182f82694e210e6c0f /pkg/instance/instance.go | |
| parent | b025ab82d228e52573e1501e2abd1c64ff00f268 (diff) | |
vm: allow fine-grained control over program exit conditions
Currently we only support canExit flag.
However there are actually 3 separate conditions:
- program can exit normally
- program can timeout (e.g. fuzzer test or runtest can't)
- program can exit with error (e.g. C test can)
Allow to specify these 3 conditions separately.
Diffstat (limited to 'pkg/instance/instance.go')
| -rw-r--r-- | pkg/instance/instance.go | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/pkg/instance/instance.go b/pkg/instance/instance.go index 1d35efa75..64d135429 100644 --- a/pkg/instance/instance.go +++ b/pkg/instance/instance.go @@ -265,11 +265,11 @@ func (inst *inst) testInstance() error { cmd := FuzzerCmd(fuzzerBin, executorBin, "test", inst.cfg.TargetOS, inst.cfg.TargetArch, fwdAddr, inst.cfg.Sandbox, 0, 0, false, false, true, false) - outc, errc, err := inst.vm.Run(5*time.Minute, nil, cmd) + outc, errc, err := inst.vm.Run(10*time.Minute, nil, cmd) if err != nil { return fmt.Errorf("failed to run binary in VM: %v", err) } - rep := inst.vm.MonitorExecution(outc, errc, inst.reporter, true) + rep := inst.vm.MonitorExecution(outc, errc, inst.reporter, vm.ExitNormal) if rep != nil { if err := inst.reporter.Symbolize(rep); err != nil { // TODO(dvyukov): send such errors to dashboard. @@ -350,7 +350,8 @@ func (inst *inst) testProgram(command string, testTime time.Duration) error { if err != nil { return fmt.Errorf("failed to run binary in VM: %v", err) } - rep := inst.vm.MonitorExecution(outc, errc, inst.reporter, true) + rep := inst.vm.MonitorExecution(outc, errc, inst.reporter, + vm.ExitTimeout|vm.ExitNormal|vm.ExitError) if rep == nil { return nil } |
