From de040344f89656862b5bbd306b8a9c143dae3dea Mon Sep 17 00:00:00 2001 From: Aleksandr Nogikh Date: Mon, 2 Aug 2021 17:08:58 +0000 Subject: pkg/report: separate reporter wrapper from OS-specific implementations Currently a number of report post-processing activities are implemented as a decorator over the interface that defines OS-specific implementations. Following exactly the same interface is too restrictive in this case as adding extra parameters to the post-processing forces the developer to adjust all implementations thay may not need these parameters at all. Untie the wrapper from the Reporter interface. Use a package-private reporterImpl interface for the OS-specific implementations, while having an exported Reporter structure. Make sure that Reporter is stored and passed as a pointer. --- tools/syz-crush/crush.go | 2 +- tools/syz-runtest/runtest.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'tools') diff --git a/tools/syz-crush/crush.go b/tools/syz-crush/crush.go index 5b2dcfffd..b795becc8 100644 --- a/tools/syz-crush/crush.go +++ b/tools/syz-crush/crush.go @@ -166,7 +166,7 @@ func storeCrash(cfg *mgrconfig.Config, rep *report.Report) { } } -func runInstance(cfg *mgrconfig.Config, reporter report.Reporter, +func runInstance(cfg *mgrconfig.Config, reporter *report.Reporter, vmPool *vm.Pool, index int, timeout time.Duration, runType FileType) *report.Report { log.Printf("vm-%v: starting", index) inst, err := vmPool.Create(index) diff --git a/tools/syz-runtest/runtest.go b/tools/syz-runtest/runtest.go index 8ef15af38..98b433b04 100644 --- a/tools/syz-runtest/runtest.go +++ b/tools/syz-runtest/runtest.go @@ -132,7 +132,7 @@ func main() { type Manager struct { cfg *mgrconfig.Config vmPool *vm.Pool - reporter report.Reporter + reporter *report.Reporter requests chan *runtest.RunRequest checkResult *rpctype.CheckArgs checkResultReady chan bool -- cgit mrf-deployment