From 6c8b90a1abc330c4e05307ddb268b084a02cd2a3 Mon Sep 17 00:00:00 2001 From: Taras Madan Date: Thu, 21 Aug 2025 11:35:15 +0200 Subject: vm: extract all the crashes from the log --- pkg/build/netbsd.go | 6 +++--- pkg/instance/execprog.go | 6 +++++- pkg/manager/diff.go | 7 +++++-- pkg/manager/repro.go | 1 + 4 files changed, 14 insertions(+), 6 deletions(-) (limited to 'pkg') diff --git a/pkg/build/netbsd.go b/pkg/build/netbsd.go index 21564e1aa..199ebc424 100644 --- a/pkg/build/netbsd.go +++ b/pkg/build/netbsd.go @@ -158,13 +158,13 @@ func (ctx netbsd) copyKernelToDisk(targetArch, vmType, outputDir, kernel string) commands = append(commands, "sync") // Run sync so that the copied image is stored properly. ctxTimeout, cancel := context.WithTimeout(context.Background(), time.Minute) defer cancel() - _, rep, err := inst.Run(ctxTimeout, reporter, strings.Join(commands, ";")) + _, reps, err := inst.Run(ctxTimeout, reporter, strings.Join(commands, ";")) if err != nil { return fmt.Errorf("error syncing the instance %w", err) } // Make sure that the command has executed properly. - if rep != nil { - return fmt.Errorf("error executing sync: %v", rep.Title) + if len(reps) > 0 { + return fmt.Errorf("error executing sync: %v", reps[0].Title) } return nil } diff --git a/pkg/instance/execprog.go b/pkg/instance/execprog.go index 0b9f9ebf7..7c97819f4 100644 --- a/pkg/instance/execprog.go +++ b/pkg/instance/execprog.go @@ -126,10 +126,14 @@ func (inst *ExecProgInstance) runCommand(command string, duration time.Duration, } ctxTimeout, cancel := context.WithTimeout(context.Background(), duration) defer cancel() - output, rep, err := inst.VMInstance.Run(ctxTimeout, inst.reporter, command, + output, reps, err := inst.VMInstance.Run(ctxTimeout, inst.reporter, command, vm.WithExitCondition(exitCondition), optionalBeforeContext, ) + var rep *report.Report + if len(reps) > 0 { + rep = reps[0] + } if err != nil { return nil, fmt.Errorf("failed to run command in VM: %w", err) } diff --git a/pkg/manager/diff.go b/pkg/manager/diff.go index 57340314e..8b57e5807 100644 --- a/pkg/manager/diff.go +++ b/pkg/manager/diff.go @@ -675,7 +675,7 @@ func (kc *kernelContext) runInstance(ctx context.Context, inst *vm.Instance, cmd := fmt.Sprintf("%v runner %v %v %v", executorBin, inst.Index(), host, port) ctxTimeout, cancel := context.WithTimeout(ctx, kc.cfg.Timeouts.VMRunningTime) defer cancel() - _, rep, err := inst.Run(ctxTimeout, kc.reporter, cmd, + _, reps, err := inst.Run(ctxTimeout, kc.reporter, cmd, vm.WithExitCondition(vm.ExitTimeout), vm.WithInjectExecuting(injectExec), vm.WithEarlyFinishCb(func() { @@ -685,7 +685,10 @@ func (kc *kernelContext) runInstance(ctx context.Context, inst *vm.Instance, kc.serv.StopFuzzing(inst.Index()) }), ) - return rep, err + if len(reps) > 0 { + return reps[0], err + } + return nil, err } func (kc *kernelContext) triageProgress() float64 { diff --git a/pkg/manager/repro.go b/pkg/manager/repro.go index e7034b186..184945c5c 100644 --- a/pkg/manager/repro.go +++ b/pkg/manager/repro.go @@ -31,6 +31,7 @@ type Crash struct { Manual bool FullRepro bool // used by the diff fuzzer to do a full scale reproduction *report.Report + TailReports []*report.Report } func (c *Crash) FullTitle() string { -- cgit mrf-deployment