Lines Matching full:env
52 type env struct { struct
56 inst *instance.Env
71 env := &env{
76 env.log("searching for fixing commit since %v", cfg.Kernel.Commit)
78 env.log("searching for guilty commit starting from %v", cfg.Kernel.Commit)
81 res, err := env.bisect()
82 env.log("revisions tested: %v, total time: %v (build: %v, test: %v)",
83 env.numTests, time.Since(start), env.buildTime, env.testTime)
85 env.log("error: %v", err)
89 env.log("the crash is still unfixed")
96 env.log("first %v commit: %v %v", what, res.Hash, res.Title)
97 env.log("cc: %q", res.CC)
101 func (env *env) bisect() (*vcs.Commit, error) { argument
102 cfg := env.cfg
104 if env.inst, err = instance.NewEnv(&cfg.Manager); err != nil {
107 if env.head, err = env.repo.Poll(cfg.Kernel.Repo, cfg.Kernel.Branch); err != nil {
114 env.log("building syzkaller on %v", cfg.Syzkaller.Commit)
115 if err := env.inst.BuildSyzkaller(cfg.Syzkaller.Repo, cfg.Syzkaller.Commit); err != nil {
118 if _, err := env.repo.SwitchCommit(cfg.Kernel.Commit); err != nil {
121 if res, err := env.test(); err != nil {
126 res, bad, good, err := env.commitRange()
136 return env.repo.Bisect(bad, good, cfg.Trace, func() (vcs.BisectResult, error) {
137 res, err := env.test()
149 func (env *env) commitRange() (*vcs.Commit, string, string, error) { argument
150 if env.cfg.Fix {
151 return env.commitRangeForFix()
153 return env.commitRangeForBug()
156 func (env *env) commitRangeForFix() (*vcs.Commit, string, string, error) { argument
157 env.log("testing current HEAD %v", env.head.Hash)
158 if _, err := env.repo.SwitchCommit(env.head.Hash); err != nil {
161 res, err := env.test()
168 return nil, env.head.Hash, env.cfg.Kernel.Commit, nil
171 func (env *env) commitRangeForBug() (*vcs.Commit, string, string, error) { argument
172 cfg := env.cfg
173 tags, err := env.repo.PreviousReleaseTags(cfg.Kernel.Commit)
191 env.log("testing release %v", tag)
192 commit, err := env.repo.SwitchCommit(tag)
196 res, err := env.test()
213 func (env *env) test() (vcs.BisectResult, error) { argument
214 cfg := env.cfg
215 env.numTests++
216 current, err := env.repo.HeadCommit()
220 be, err := env.buildEnvForCommit(current.Hash)
228 env.log("testing commit %v with %v", current.Hash, compilerID)
234 err = env.inst.BuildKernel(be.compiler, cfg.Kernel.Userspace,
236 env.buildTime += time.Since(buildStart)
239 env.log("%v", verr.Title)
240 env.saveDebugFile(current.Hash, 0, verr.Output)
242 env.log("%v", err)
247 results, err := env.inst.Test(8, cfg.Repro.Syz, cfg.Repro.Opts, cfg.Repro.C)
248 env.testTime += time.Since(testStart)
250 env.log("failed: %v", err)
253 bad, good := env.processResults(current, results)
263 func (env *env) processResults(current *vcs.Commit, results []error) (bad, good int) { argument
282 env.saveDebugFile(current.Hash, i, output)
290 env.saveDebugFile(current.Hash, i, output)
300 env.log("all runs: %v", verdicts[0])
303 env.log("run #%v: %v", i, verdict)
310 func (env *env) buildEnvForCommit(commit string) (*buildEnv, error) { argument
311 cfg := env.cfg
312 tags, err := env.repo.PreviousReleaseTags(commit)
336 func (env *env) saveDebugFile(hash string, idx int, data []byte) { argument
337 if env.cfg.DebugDir == "" || len(data) == 0 {
340 osutil.WriteFile(filepath.Join(env.cfg.DebugDir, fmt.Sprintf("%v.%v", hash, idx)), data)
343 func (env *env) log(msg string, args ...interface{}) { argument
344 fmt.Fprintf(env.cfg.Trace, msg+"\n", args...)