diff options
| author | Jouni Hogander <jouni.hogander@unikie.com> | 2020-11-10 15:01:26 +0200 |
|---|---|---|
| committer | Dmitry Vyukov <dvyukov@google.com> | 2020-12-10 12:57:35 +0100 |
| commit | cbdf514ebdff5b19bc93cdfcc81598587627330e (patch) | |
| tree | cec672b32afba297ff06bc3cd4d39205596cc78a /pkg/bisect | |
| parent | f86bec81e1bafa82d30486258de616fff295b5f7 (diff) | |
pkg/kconfig: store minimization results
Store config options identified using DebugTracer. Also change bisection
and configuration minimization code to use new DebugTracer.
Diffstat (limited to 'pkg/bisect')
| -rw-r--r-- | pkg/bisect/bisect.go | 14 | ||||
| -rw-r--r-- | pkg/bisect/bisect_test.go | 6 |
2 files changed, 6 insertions, 14 deletions
diff --git a/pkg/bisect/bisect.go b/pkg/bisect/bisect.go index 76c518e6c..07f47ccde 100644 --- a/pkg/bisect/bisect.go +++ b/pkg/bisect/bisect.go @@ -5,11 +5,10 @@ package bisect import ( "fmt" - "io" - "path/filepath" "time" "github.com/google/syzkaller/pkg/build" + "github.com/google/syzkaller/pkg/debugtracer" "github.com/google/syzkaller/pkg/hash" "github.com/google/syzkaller/pkg/instance" "github.com/google/syzkaller/pkg/mgrconfig" @@ -19,11 +18,10 @@ import ( ) type Config struct { - Trace io.Writer + Trace debugtracer.DebugTracer Fix bool BinDir string Ccache string - DebugDir string Timeout time.Duration Kernel KernelConfig Syzkaller SyzkallerConfig @@ -540,11 +538,7 @@ func (env *env) processResults(current *vcs.Commit, results []error) (bad, good } func (env *env) saveDebugFile(hash string, idx int, data []byte) { - if env.cfg.DebugDir == "" || len(data) == 0 { - return - } - osutil.MkdirAll(env.cfg.DebugDir) - osutil.WriteFile(filepath.Join(env.cfg.DebugDir, fmt.Sprintf("%v.%v", hash, idx)), data) + env.cfg.Trace.SaveFile(fmt.Sprintf("%v.%v", hash, idx), data) } func checkConfig(cfg *Config) error { @@ -564,5 +558,5 @@ func checkConfig(cfg *Config) error { } func (env *env) log(msg string, args ...interface{}) { - fmt.Fprintf(env.cfg.Trace, msg+"\n", args...) + env.cfg.Trace.Log(msg, args...) } diff --git a/pkg/bisect/bisect_test.go b/pkg/bisect/bisect_test.go index db4409a5c..e71903c98 100644 --- a/pkg/bisect/bisect_test.go +++ b/pkg/bisect/bisect_test.go @@ -4,13 +4,13 @@ package bisect import ( - "bytes" "fmt" "io/ioutil" "os" "strconv" "testing" + "github.com/google/syzkaller/pkg/debugtracer" "github.com/google/syzkaller/pkg/hash" "github.com/google/syzkaller/pkg/instance" "github.com/google/syzkaller/pkg/mgrconfig" @@ -122,10 +122,9 @@ func runBisection(t *testing.T, baseDir string, test BisectionTest) (*Result, er if err != nil { t.Fatal(err) } - trace := new(bytes.Buffer) cfg := &Config{ Fix: test.fix, - Trace: trace, + Trace: &debugtracer.TestTracer{T: t}, Manager: &mgrconfig.Config{ Derived: mgrconfig.Derived{ TargetOS: targets.TestOS, @@ -147,7 +146,6 @@ func runBisection(t *testing.T, baseDir string, test BisectionTest) (*Result, er test: test, } res, err := runImpl(cfg, r, inst) - t.Log(trace.String()) return res, err } |
