pkg/report: pass vm type to NewReporter

For the case when VM type affects output.
Will be needed for gvisor. It is kinda linux, but kinda not.
This commit is contained in:
Dmitry Vyukov 2018-06-20 15:31:06 +02:00
parent 87bfb99cfe
commit 9a7d0a5412
9 changed files with 16 additions and 16 deletions

View File

@ -118,8 +118,8 @@ func (env *Env) Test(numVMs int, reproSyz, reproOpts, reproC []byte) ([]error, e
if err := mgrconfig.Complete(env.cfg); err != nil {
return nil, err
}
reporter, err := report.NewReporter(env.cfg.TargetOS, env.cfg.KernelSrc,
filepath.Dir(env.cfg.Vmlinux), nil, env.cfg.ParsedIgnores)
reporter, err := report.NewReporter(env.cfg.TargetOS, env.cfg.Type,
env.cfg.KernelSrc, filepath.Dir(env.cfg.Vmlinux), nil, env.cfg.ParsedIgnores)
if err != nil {
return nil, err
}

View File

@ -12,14 +12,14 @@ import (
)
func TestLinuxIgnores(t *testing.T) {
reporter, err := NewReporter("linux", "", "", nil, nil)
reporter, err := NewReporter("linux", "", "", "", nil, nil)
if err != nil {
t.Fatal(err)
}
ignores1 := []*regexp.Regexp{
regexp.MustCompile("BUG: bug3"),
}
reporter1, err := NewReporter("linux", "", "", nil, ignores1)
reporter1, err := NewReporter("linux", "", "", "", nil, ignores1)
if err != nil {
t.Fatal(err)
}
@ -27,7 +27,7 @@ func TestLinuxIgnores(t *testing.T) {
regexp.MustCompile("BUG: bug3"),
regexp.MustCompile("BUG: bug1"),
}
reporter2, err := NewReporter("linux", "", "", nil, ignores2)
reporter2, err := NewReporter("linux", "", "", "", nil, ignores2)
if err != nil {
t.Fatal(err)
}
@ -36,7 +36,7 @@ func TestLinuxIgnores(t *testing.T) {
regexp.MustCompile("BUG: bug1"),
regexp.MustCompile("BUG: bug2"),
}
reporter3, err := NewReporter("linux", "", "", nil, ignores3)
reporter3, err := NewReporter("linux", "", "", "", nil, ignores3)
if err != nil {
t.Fatal(err)
}

View File

@ -45,12 +45,12 @@ type Report struct {
Maintainers []string
}
// NewReporter creates reporter for the specified OS:
// NewReporter creates reporter for the specified OS/vmType:
// kernelSrc: path to kernel sources directory
// kernelObj: path to kernel build directory (can be empty for in-tree build)
// symbols: kernel symbols (result of pkg/symbolizer.ReadSymbols on kernel object file)
// ignores: optional list of regexps to ignore (must match first line of crash message)
func NewReporter(os, kernelSrc, kernelObj string, symbols map[string][]symbolizer.Symbol,
func NewReporter(os, vmType, kernelSrc, kernelObj string, symbols map[string][]symbolizer.Symbol,
ignores []*regexp.Regexp) (Reporter, error) {
ctor := ctors[os]
if ctor == nil {

View File

@ -214,7 +214,7 @@ func forEachFile(t *testing.T, dir string, fn func(t *testing.T, reporter Report
if err != nil {
t.Fatal(err)
}
reporter, err := NewReporter(os, "", "", nil, nil)
reporter, err := NewReporter(os, "", "", "", nil, nil)
if err != nil {
t.Fatal(err)
}

View File

@ -835,8 +835,8 @@ func (mgr *Manager) getReporter() report.Reporter {
kernelSrc = mgr.cfg.KernelSrc
kernelObj = filepath.Dir(mgr.cfg.Vmlinux)
}
mgr.reporter, err = report.NewReporter(mgr.cfg.TargetOS, kernelSrc, kernelObj,
allSymbols, mgr.cfg.ParsedIgnores)
mgr.reporter, err = report.NewReporter(mgr.cfg.TargetOS, mgr.cfg.Type,
kernelSrc, kernelObj, allSymbols, mgr.cfg.ParsedIgnores)
if err != nil {
log.Fatalf("%v", err)
}

View File

@ -44,8 +44,8 @@ func main() {
if err != nil {
log.Fatalf("%v", err)
}
reporter, err := report.NewReporter(cfg.TargetOS, cfg.KernelSrc,
filepath.Dir(cfg.Vmlinux), nil, cfg.ParsedIgnores)
reporter, err := report.NewReporter(cfg.TargetOS, cfg.Type,
cfg.KernelSrc, filepath.Dir(cfg.Vmlinux), nil, cfg.ParsedIgnores)
if err != nil {
log.Fatalf("%v", err)
}

View File

@ -40,7 +40,7 @@ func parseReport(os, file string) {
fmt.Printf("Error: %v\n", err)
return
}
reporter, err := report.NewReporter(os, "", "", nil, nil)
reporter, err := report.NewReporter(os, "", "", "", nil, nil)
if err != nil {
fmt.Printf("Error: %v\n", err)
return

View File

@ -57,7 +57,7 @@ func main() {
for i := range vmIndexes {
vmIndexes[i] = i
}
reporter, err := report.NewReporter(cfg.TargetOS, cfg.KernelSrc, "", nil, cfg.ParsedIgnores)
reporter, err := report.NewReporter(cfg.TargetOS, cfg.Type, cfg.KernelSrc, "", nil, cfg.ParsedIgnores)
if err != nil {
log.Fatalf("%v", err)
}

View File

@ -26,7 +26,7 @@ func main() {
flag.PrintDefaults()
os.Exit(1)
}
reporter, err := report.NewReporter(*flagOS, *flagKernelSrc, *flagKernelObj, nil, nil)
reporter, err := report.NewReporter(*flagOS, "", *flagKernelSrc, *flagKernelObj, nil, nil)
if err != nil {
fmt.Fprintf(os.Stderr, "failed to create reporter: %v\n", err)
os.Exit(1)