aboutsummaryrefslogtreecommitdiffstats
path: root/prog/export_test.go
diff options
context:
space:
mode:
authorDmitry Vyukov <dvyukov@google.com>2017-09-14 19:25:01 +0200
committerDmitry Vyukov <dvyukov@google.com>2017-09-15 16:02:37 +0200
commit52a33fd516102a98d3753bf69417235b655a68dc (patch)
tree351ab73db934d3b4e4babbe27e8801c659f2631b /prog/export_test.go
parent25f4fe0662f7f3b390d16b2e786f2ba0aa0293f1 (diff)
prog: remove default target and all global state
Now each prog function accepts the desired target explicitly. No global, implicit state involved. This is much cleaner and allows cross-OS/arch testing, etc.
Diffstat (limited to 'prog/export_test.go')
-rw-r--r--prog/export_test.go16
1 files changed, 11 insertions, 5 deletions
diff --git a/prog/export_test.go b/prog/export_test.go
index c5337d695..e6c384c7a 100644
--- a/prog/export_test.go
+++ b/prog/export_test.go
@@ -17,11 +17,12 @@ func init() {
var (
CalcChecksumsCall = calcChecksumsCall
- AssignSizesCall = assignSizesCall
- DefaultArg = defaultArg
- InitTest = initTest
+ //AssignSizesCall = assignSizesCall
+ //DefaultArg = defaultArg
+ InitTest = initTest
)
+/*
func PtrSize() uint64 {
return ptrSize
}
@@ -33,8 +34,9 @@ func DataOffset() uint64 {
func PageSize() uint64 {
return pageSize
}
+*/
-func initTest(t *testing.T) (rand.Source, int) {
+func initTest(t *testing.T) (*Target, rand.Source, int) {
t.Parallel()
iters := 10000
if testing.Short() {
@@ -43,5 +45,9 @@ func initTest(t *testing.T) (rand.Source, int) {
seed := int64(time.Now().UnixNano())
rs := rand.NewSource(seed)
t.Logf("seed=%v", seed)
- return rs, iters
+ target, err := GetTarget("linux", "amd64")
+ if err != nil {
+ t.Fatal(err)
+ }
+ return target, rs, iters
}