aboutsummaryrefslogtreecommitdiffstats
path: root/pkg
diff options
context:
space:
mode:
authorDmitry Vyukov <dvyukov@google.com>2021-03-16 11:54:37 +0100
committerDmitry Vyukov <dvyukov@google.com>2021-03-18 09:17:51 +0100
commit2649114619f2c83ca9beb0e122445b1820cc1646 (patch)
treeeacfa2e6e79df04b19fc386f7669b27178a9208a /pkg
parenta32dae5902fec8911336f5fc7d1e8b2292589fde (diff)
pkg/mgrconfig: move Subsystem from pkg/cover
mgrconfig used to be "leaf" package that can be imported by anything. Recently it started importing pkg/cover for Subsystem definition. It leads to the following import cycle if I try to import pkg/host from pkg/cover: package github.com/google/syzkaller/pkg/bisect imports github.com/google/syzkaller/pkg/build imports github.com/google/syzkaller/pkg/mgrconfig imports github.com/google/syzkaller/pkg/cover imports github.com/google/syzkaller/pkg/host imports github.com/google/syzkaller/pkg/csource imports github.com/google/syzkaller/pkg/mgrconfig: import cycle not allowed Move Subsystem into pkg/mgrconfig itself.
Diffstat (limited to 'pkg')
-rw-r--r--pkg/cover/cover.go5
-rw-r--r--pkg/cover/html.go3
-rw-r--r--pkg/cover/report.go9
-rw-r--r--pkg/cover/report_test.go3
-rw-r--r--pkg/mgrconfig/config.go9
5 files changed, 15 insertions, 14 deletions
diff --git a/pkg/cover/cover.go b/pkg/cover/cover.go
index 572d5e5da..814ae4fb6 100644
--- a/pkg/cover/cover.go
+++ b/pkg/cover/cover.go
@@ -6,11 +6,6 @@ package cover
type Cover map[uint32]struct{}
-type Subsystem struct {
- Name string `json:"name"`
- Paths []string `json:"path"`
-}
-
func (cov *Cover) Merge(raw []uint32) {
c := *cov
if c == nil {
diff --git a/pkg/cover/html.go b/pkg/cover/html.go
index 1757964b5..b21b7a95a 100644
--- a/pkg/cover/html.go
+++ b/pkg/cover/html.go
@@ -18,6 +18,7 @@ import (
"strings"
"github.com/google/syzkaller/pkg/cover/backend"
+ "github.com/google/syzkaller/pkg/mgrconfig"
)
func (rg *ReportGenerator) DoHTML(w io.Writer, progs []Prog) error {
@@ -199,7 +200,7 @@ func (rg *ReportGenerator) DoCSVFiles(w io.Writer, progs []Prog) error {
return writer.WriteAll(d)
}
-func groupCoverByFilePrefixes(datas []fileStats, subsystems []Subsystem) map[string]map[string]string {
+func groupCoverByFilePrefixes(datas []fileStats, subsystems []mgrconfig.Subsystem) map[string]map[string]string {
d := make(map[string]map[string]string)
for _, subsystem := range subsystems {
diff --git a/pkg/cover/report.go b/pkg/cover/report.go
index 94540b6c8..b838d5f5f 100644
--- a/pkg/cover/report.go
+++ b/pkg/cover/report.go
@@ -8,6 +8,7 @@ import (
"sort"
"github.com/google/syzkaller/pkg/cover/backend"
+ "github.com/google/syzkaller/pkg/mgrconfig"
"github.com/google/syzkaller/sys/targets"
)
@@ -16,7 +17,7 @@ type ReportGenerator struct {
srcDir string
objDir string
buildDir string
- subsystem []Subsystem
+ subsystem []mgrconfig.Subsystem
*backend.Impl
}
@@ -27,13 +28,13 @@ type Prog struct {
var RestorePC = backend.RestorePC
-func MakeReportGenerator(target *targets.Target, vm, objDir, srcDir, buildDir string,
- subsystem []Subsystem, moduleObj []string, modules map[string]backend.KernelModule) (*ReportGenerator, error) {
+func MakeReportGenerator(target *targets.Target, vm, objDir, srcDir, buildDir string, subsystem []mgrconfig.Subsystem,
+ moduleObj []string, modules map[string]backend.KernelModule) (*ReportGenerator, error) {
impl, err := backend.Make(target, vm, objDir, srcDir, buildDir, moduleObj, modules)
if err != nil {
return nil, err
}
- subsystem = append(subsystem, Subsystem{
+ subsystem = append(subsystem, mgrconfig.Subsystem{
Name: "all",
Paths: []string{""},
})
diff --git a/pkg/cover/report_test.go b/pkg/cover/report_test.go
index 4b0dabc8e..239ca106f 100644
--- a/pkg/cover/report_test.go
+++ b/pkg/cover/report_test.go
@@ -22,6 +22,7 @@ import (
"time"
"github.com/google/syzkaller/pkg/cover/backend"
+ "github.com/google/syzkaller/pkg/mgrconfig"
"github.com/google/syzkaller/pkg/osutil"
"github.com/google/syzkaller/pkg/symbolizer"
_ "github.com/google/syzkaller/sys"
@@ -180,7 +181,7 @@ func generateReport(t *testing.T, target *targets.Target, test Test) ([]byte, []
}
defer os.RemoveAll(dir)
bin := buildTestBinary(t, target, test, dir)
- subsystem := []Subsystem{
+ subsystem := []mgrconfig.Subsystem{
{
Name: "sound",
Paths: []string{
diff --git a/pkg/mgrconfig/config.go b/pkg/mgrconfig/config.go
index 5400ad952..14cbd6599 100644
--- a/pkg/mgrconfig/config.go
+++ b/pkg/mgrconfig/config.go
@@ -5,8 +5,6 @@ package mgrconfig
import (
"encoding/json"
-
- "github.com/google/syzkaller/pkg/cover"
)
type Config struct {
@@ -55,7 +53,7 @@ type Config struct {
// { "name": "sound", "path": ["sound", "techpack/audio"]},
// { "name": "mydriver": "path": ["mydriver_path"]}
// ]
- KernelSubsystem []cover.Subsystem `json:"kernel_subsystem,omitempty"`
+ KernelSubsystem []Subsystem `json:"kernel_subsystem,omitempty"`
// Arbitrary optional tag that is saved along with crash reports (e.g. branch/commit).
Tag string `json:"tag,omitempty"`
// Location of the disk image file.
@@ -160,6 +158,11 @@ type Config struct {
Derived `json:"-"`
}
+type Subsystem struct {
+ Name string `json:"name"`
+ Paths []string `json:"path"`
+}
+
type covFilterCfg struct {
Files []string `json:"files"`
Functions []string `json:"functions"`