From 5ad1a162959d6df7712dc93cffe128322b11d7af Mon Sep 17 00:00:00 2001 From: Aleksandr Nogikh Date: Tue, 5 Nov 2024 17:33:59 +0100 Subject: pkg/repro: accept a cancellable context Refactor pkg/repro to accept a context.Context object. This will make it look more similar to other package interfaces and will eventually let us abort currently running repro jobs without having to shut down the whole application. Simplify the code by factoring out the parameters common both to RunSyzRepro() and RunCRepro(). --- pkg/instance/instance.go | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'pkg/instance/instance.go') diff --git a/pkg/instance/instance.go b/pkg/instance/instance.go index b21bbed9e..f2f024216 100644 --- a/pkg/instance/instance.go +++ b/pkg/instance/instance.go @@ -388,7 +388,12 @@ func (inst *inst) testInstance() error { return err } opts.Repeat = false - out, err := execProg.RunSyzProg(testProg, inst.cfg.Timeouts.NoOutputRunningTime, opts, vm.ExitNormal) + out, err := execProg.RunSyzProg(ExecParams{ + SyzProg: testProg, + Duration: inst.cfg.Timeouts.NoOutputRunningTime, + Opts: opts, + ExitConditions: vm.ExitNormal, + }) if err != nil { return &TestError{Title: err.Error()} } @@ -420,8 +425,11 @@ func (inst *inst) testRepro() ([]byte, error) { if err != nil { return nil, err } - out, err = transformError(execProg.RunSyzProg(inst.reproSyz, - inst.cfg.Timeouts.NoOutputRunningTime, opts, SyzExitConditions)) + out, err = transformError(execProg.RunSyzProg(ExecParams{ + SyzProg: inst.reproSyz, + Duration: inst.cfg.Timeouts.NoOutputRunningTime, + Opts: opts, + })) if err != nil { return out, err } -- cgit mrf-deployment