From 0d5abf15b74358009a02efb629f7bc7c84841a1f Mon Sep 17 00:00:00 2001 From: Aleksandr Nogikh Date: Tue, 7 Jun 2022 17:37:55 +0000 Subject: all: remember console output for all patch tests Currently syzbot only saves a log if there was a build/test error. Closes #3185 --- pkg/bisect/bisect.go | 7 ++++--- pkg/bisect/bisect_test.go | 29 +++++++++++++++-------------- 2 files changed, 19 insertions(+), 17 deletions(-) (limited to 'pkg/bisect') diff --git a/pkg/bisect/bisect.go b/pkg/bisect/bisect.go index b2ec3dd46..9c02a747f 100644 --- a/pkg/bisect/bisect.go +++ b/pkg/bisect/bisect.go @@ -488,15 +488,16 @@ func (env *env) test() (*testResult, error) { return res, nil } -func (env *env) processResults(current *vcs.Commit, results []error) (bad, good int, rep *report.Report) { +func (env *env) processResults(current *vcs.Commit, results []instance.EnvTestResult) ( + bad, good int, rep *report.Report) { var verdicts []string for i, res := range results { - if res == nil { + if res.Error == nil { good++ verdicts = append(verdicts, "OK") continue } - switch err := res.(type) { + switch err := res.Error.(type) { case *instance.TestError: if err.Boot { verdicts = append(verdicts, fmt.Sprintf("boot failed: %v", err)) diff --git a/pkg/bisect/bisect_test.go b/pkg/bisect/bisect_test.go index eebe48e37..75135650e 100644 --- a/pkg/bisect/bisect_test.go +++ b/pkg/bisect/bisect_test.go @@ -48,25 +48,24 @@ func (env *testEnv) BuildKernel(compilerBin, cCache, userspaceDir, cmdlineFile, return "", details, nil } -func (env *testEnv) Test(numVMs int, reproSyz, reproOpts, reproC []byte) ([]error, error) { +func (env *testEnv) Test(numVMs int, reproSyz, reproOpts, reproC []byte) ([]instance.EnvTestResult, error) { commit := env.headCommit() if commit >= env.test.brokenStart && commit <= env.test.brokenEnd || env.config == "baseline-skip" { return nil, fmt.Errorf("broken build") } + var ret []instance.EnvTestResult if (env.config == "baseline-repro" || env.config == "new-minimized-config" || env.config == "original config") && (!env.test.fix && commit >= env.test.culprit || env.test.fix && commit < env.test.culprit) { - var errors []error if env.test.flaky { - errors = crashErrors(1, numVMs-1, "crash occurs") + ret = crashErrors(1, numVMs-1, "crash occurs") } else { - errors = crashErrors(numVMs, 0, "crash occurs") + ret = crashErrors(numVMs, 0, "crash occurs") } - return errors, nil + return ret, nil } - - return make([]error, numVMs), nil + return make([]instance.EnvTestResult, numVMs), nil } func (env *testEnv) headCommit() int { @@ -504,17 +503,19 @@ func checkTest(t *testing.T, test BisectionTest) { } } -func crashErrors(crashing, nonCrashing int, title string) []error { - var errors []error +func crashErrors(crashing, nonCrashing int, title string) []instance.EnvTestResult { + var ret []instance.EnvTestResult for i := 0; i < crashing; i++ { - errors = append(errors, &instance.CrashError{ - Report: &report.Report{ - Title: fmt.Sprintf("crashes at %v", title), + ret = append(ret, instance.EnvTestResult{ + Error: &instance.CrashError{ + Report: &report.Report{ + Title: fmt.Sprintf("crashes at %v", title), + }, }, }) } for i := 0; i < nonCrashing; i++ { - errors = append(errors, nil) + ret = append(ret, instance.EnvTestResult{}) } - return errors + return ret } -- cgit mrf-deployment