aboutsummaryrefslogtreecommitdiffstats
path: root/prog/size_test.go
diff options
context:
space:
mode:
authorDmitry Vyukov <dvyukov@google.com>2017-09-05 13:31:14 +0200
committerDmitry Vyukov <dvyukov@google.com>2017-09-05 15:52:42 +0200
commitffe7e17368d7ae6c2b40da2ce0703d8ad8a116ac (patch)
tree195b7c32977fdaab05acb1282a727fb480593431 /prog/size_test.go
parent4fc47026945ebec3fc81d0c897547670034cfb58 (diff)
prog, sys: move types to prog
Large overhaul moves syscalls and arg types from sys to prog. Sys package now depends on prog and contains only generated descriptions of syscalls. Introduce prog.Target type that encapsulates all targer properties, like syscall list, ptr/page size, etc. Also moves OS-dependent pieces like mmap call generation from prog to sys. Update #191
Diffstat (limited to 'prog/size_test.go')
-rw-r--r--prog/size_test.go13
1 files changed, 8 insertions, 5 deletions
diff --git a/prog/size_test.go b/prog/size_test.go
index c72e5283f..778725d49 100644
--- a/prog/size_test.go
+++ b/prog/size_test.go
@@ -1,21 +1,24 @@
// Copyright 2016 syzkaller project authors. All rights reserved.
// Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file.
-package prog
+package prog_test
import (
"bytes"
"strings"
"testing"
+
+ . "github.com/google/syzkaller/prog"
+ _ "github.com/google/syzkaller/sys"
)
func TestAssignSizeRandom(t *testing.T) {
- rs, iters := initTest(t)
+ rs, iters := InitTest(t)
for i := 0; i < iters; i++ {
p := Generate(rs, 10, nil)
data0 := p.Serialize()
for _, call := range p.Calls {
- assignSizesCall(call)
+ AssignSizesCall(call)
}
if data1 := p.Serialize(); !bytes.Equal(data0, data1) {
t.Fatalf("different lens assigned, initial: %v, new: %v", data0, data1)
@@ -23,7 +26,7 @@ func TestAssignSizeRandom(t *testing.T) {
p.Mutate(rs, 10, nil, nil)
data0 = p.Serialize()
for _, call := range p.Calls {
- assignSizesCall(call)
+ AssignSizesCall(call)
}
if data1 := p.Serialize(); !bytes.Equal(data0, data1) {
t.Fatalf("different lens assigned, initial: %v, new: %v", data0, data1)
@@ -128,7 +131,7 @@ func TestAssignSize(t *testing.T) {
t.Fatalf("failed to deserialize prog %v: %v", i, err)
}
for _, call := range p.Calls {
- assignSizesCall(call)
+ AssignSizesCall(call)
}
p1 := strings.TrimSpace(string(p.Serialize()))
if p1 != test.sizedProg {