aboutsummaryrefslogtreecommitdiffstats
path: root/pkg/ipc
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 /pkg/ipc
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 'pkg/ipc')
-rw-r--r--pkg/ipc/ipc_test.go11
1 files changed, 6 insertions, 5 deletions
diff --git a/pkg/ipc/ipc_test.go b/pkg/ipc/ipc_test.go
index ce04a7540..263e94032 100644
--- a/pkg/ipc/ipc_test.go
+++ b/pkg/ipc/ipc_test.go
@@ -19,10 +19,6 @@ import (
const timeout = 10 * time.Second
-func init() {
- prog.SetDefaultTarget("linux", runtime.GOARCH)
-}
-
func buildExecutor(t *testing.T) string {
return buildProgram(t, filepath.FromSlash("../../executor/executor.cc"))
}
@@ -87,6 +83,11 @@ func TestExecute(t *testing.T) {
rs, iters := initTest(t)
flags := []uint64{0, FlagThreaded, FlagThreaded | FlagCollide}
+ target, err := prog.GetTarget("linux", runtime.GOARCH)
+ if err != nil {
+ t.Fatal(err)
+ }
+
bin := buildExecutor(t)
defer os.Remove(bin)
@@ -103,7 +104,7 @@ func TestExecute(t *testing.T) {
defer env.Close()
for i := 0; i < iters/len(flags); i++ {
- p := prog.Generate(rs, 10, nil)
+ p := target.Generate(rs, 10, nil)
opts := &ExecOpts{}
output, _, _, _, err := env.Exec(opts, p)
if err != nil {