mirror of
https://github.com/reactos/syzkaller.git
synced 2024-11-23 19:39:40 +00:00
ffe7e17368
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
48 lines
796 B
Go
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
|
|
}
|