aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrey Konovalov <andreyknvl@google.com>2017-11-24 17:22:21 +0100
committerDmitry Vyukov <dvyukov@google.com>2017-11-29 13:23:31 +0100
commitc2a67000b6eca9974241542011a866bd4ebc16e3 (patch)
tree7f701ac62e8a6138d794c65f9afd5b6da7f994fd
parent3a80fe350da4f5fc054c06fe279cc7ea734eb28b (diff)
pkg/repro: rerun repro when report is corrupted
-rw-r--r--pkg/repro/repro.go27
1 files changed, 22 insertions, 5 deletions
diff --git a/pkg/repro/repro.go b/pkg/repro/repro.go
index 3c0c8965f..35dd51628 100644
--- a/pkg/repro/repro.go
+++ b/pkg/repro/repro.go
@@ -37,9 +37,10 @@ type Result struct {
Stats Stats
// Title, Log and Report of the final crash that we reproduced.
// Can be different from what we started reproducing.
- Title string
- Log []byte
- Report []byte
+ Title string
+ Log []byte
+ Report []byte
+ Corrupted bool
}
type context struct {
@@ -52,6 +53,7 @@ type context struct {
title string
log []byte
report []byte
+ corrupted bool
}
type instance struct {
@@ -151,11 +153,25 @@ func Run(crashLog []byte, cfg *mgrconfig.Config, reporter report.Reporter, vmPoo
return nil, err
}
if res != nil {
- ctx.reproLog(3, "repro crashed as:\n%s", string(ctx.report))
- res.Stats = ctx.stats
+ ctx.reproLog(3, "repro crashed as (corrupted=%v):\n%s", ctx.corrupted, ctx.report)
+ // Try to rerun the repro if the report is corrupted.
+ for attempts := 0; ctx.corrupted && attempts < 3; attempts++ {
+ ctx.reproLog(3, "report is corrupted, running repro again\n")
+ if res.CRepro {
+ _, err = ctx.testCProg(res.Prog, res.Duration, res.Opts)
+ } else {
+ _, err = ctx.testProg(res.Prog, res.Duration, res.Opts)
+ }
+ if err != nil {
+ return nil, err
+ }
+ }
+ ctx.reproLog(3, "final repro crashed as (corrupted=%v):\n%s", ctx.corrupted, ctx.report)
res.Title = ctx.title
res.Log = ctx.log
res.Report = ctx.report
+ res.Corrupted = ctx.corrupted
+ res.Stats = ctx.stats
}
close(ctx.bootRequests)
@@ -608,6 +624,7 @@ func (ctx *context) testImpl(inst *vm.Instance, command string, duration time.Du
ctx.title = rep.Title
ctx.log = output
ctx.report = rep.Report
+ ctx.corrupted = rep.Corrupted
ctx.reproLog(2, "program crashed: %v", rep.Title)
return true, nil
}