syzkaller/prog/export_test.go
Dmitry Vyukov ffe7e17368 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
2017-09-05 15:52:42 +02:00

48 lines
796 B
Go

// Copyright 2017 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
import (
"math/rand"
"testing"
"time"
)
// Export guts for testing.
func init() {
debug = true
}
var (
CalcChecksumsCall = calcChecksumsCall
AssignSizesCall = assignSizesCall
DefaultArg = defaultArg
InitTest = initTest
)
func PtrSize() uint64 {
return ptrSize
}
func DataOffset() uint64 {
return dataOffset
}
func PageSize() uint64 {
return pageSize
}
func initTest(t *testing.T) (rand.Source, int) {
t.Parallel()
iters := 10000
if testing.Short() {
iters = 100
}
seed := int64(time.Now().UnixNano())
rs := rand.NewSource(seed)
t.Logf("seed=%v", seed)
return rs, iters
}