aboutsummaryrefslogtreecommitdiffstats
path: root/pkg/fuzzer/queue
diff options
context:
space:
mode:
Diffstat (limited to 'pkg/fuzzer/queue')
-rw-r--r--pkg/fuzzer/queue/queue.go8
-rw-r--r--pkg/fuzzer/queue/queue_test.go29
2 files changed, 36 insertions, 1 deletions
diff --git a/pkg/fuzzer/queue/queue.go b/pkg/fuzzer/queue/queue.go
index ca2d76092..20509dcb7 100644
--- a/pkg/fuzzer/queue/queue.go
+++ b/pkg/fuzzer/queue/queue.go
@@ -566,7 +566,13 @@ func (t *tee) Next() *Request {
return nil
}
t.queue.Submit(&Request{
- Prog: req.Prog.Clone(),
+ // It makes little sense to copy other fields if these requests
+ // are to be executed in a different environment.
+ Type: req.Type,
+ ExecOpts: req.ExecOpts,
+ Prog: req.Prog.Clone(),
+ BinaryFile: req.BinaryFile,
+ GlobPattern: req.GlobPattern,
})
return req
}
diff --git a/pkg/fuzzer/queue/queue_test.go b/pkg/fuzzer/queue/queue_test.go
index d1909e50c..49bb92159 100644
--- a/pkg/fuzzer/queue/queue_test.go
+++ b/pkg/fuzzer/queue/queue_test.go
@@ -6,6 +6,8 @@ package queue
import (
"testing"
+ "github.com/google/syzkaller/pkg/flatrpc"
+ "github.com/google/syzkaller/prog"
"github.com/stretchr/testify/assert"
)
@@ -50,3 +52,30 @@ func TestGlobFiles(t *testing.T) {
r.Output = []byte{'a', 'b', 0, 'c', 0}
assert.Equal(t, r.GlobFiles(), []string{"ab", "c"})
}
+
+func TestTee(t *testing.T) {
+ base, dup := Plain(), Plain()
+
+ tee := Tee(base, dup)
+ req := &Request{
+ Prog: &prog.Prog{},
+ Type: flatrpc.RequestTypeProgram,
+ ExecOpts: flatrpc.ExecOpts{SandboxArg: 10},
+ BinaryFile: "file",
+ GlobPattern: "pattern",
+ // These must be ignored.
+ ReturnOutput: true,
+ Important: true,
+ }
+ base.Submit(req)
+
+ origReq := tee.Next()
+ assert.Equal(t, req, origReq)
+ copy := dup.Next()
+ assert.Equal(t, req.Type, copy.Type)
+ assert.Equal(t, req.ExecOpts, copy.ExecOpts)
+ assert.Equal(t, req.BinaryFile, copy.BinaryFile)
+ assert.Equal(t, req.GlobPattern, copy.GlobPattern)
+ assert.Empty(t, copy.ReturnOutput)
+ assert.Empty(t, copy.Important)
+}