From 52a33fd516102a98d3753bf69417235b655a68dc Mon Sep 17 00:00:00 2001 From: Dmitry Vyukov Date: Thu, 14 Sep 2017 19:25:01 +0200 Subject: 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. --- prog/export_test.go | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) (limited to 'prog/export_test.go') 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 } -- cgit mrf-deployment