veyron2: break dependency between veyron2/rt and the runtime implementation.
All tests pass and all test.sh's except for the playground one. It has
some problems that I don't understand with auth that I'll ask for help
with tomorrow AM.
Change-Id: Id805ccda0445e2e1e4520be72e8eb30d135c26a0
diff --git a/lib/testutil/security/util_test.go b/lib/testutil/security/util_test.go
index ea9ee21..06ed969 100644
--- a/lib/testutil/security/util_test.go
+++ b/lib/testutil/security/util_test.go
@@ -5,10 +5,11 @@
"reflect"
"testing"
- vsecurity "veyron.io/veyron/veyron/security"
-
"veyron.io/veyron/veyron2/rt"
"veyron.io/veyron/veyron2/security"
+
+ _ "veyron.io/veyron/veyron/profiles"
+ vsecurity "veyron.io/veyron/veyron/security"
)
func TestNewVeyronCredentials(t *testing.T) {
diff --git a/profiles/generic.go b/profiles/generic.go
index e9d4817..1004fff 100644
--- a/profiles/generic.go
+++ b/profiles/generic.go
@@ -4,8 +4,10 @@
"veyron.io/veyron/veyron2"
"veyron.io/veyron/veyron2/config"
"veyron.io/veyron/veyron2/ipc"
+ "veyron.io/veyron/veyron2/rt"
"veyron.io/veyron/veyron/profiles/internal"
+ _ "veyron.io/veyron/veyron/runtimes/google/rt"
)
// LocalListenSpec is a ListenSpec for 127.0.0.1.
@@ -19,6 +21,10 @@
var _ veyron2.Profile = (*generic)(nil)
+func init() {
+ rt.RegisterProfile(New())
+}
+
// New returns a new instance of a very generic Profile. It can be used
// as a default by Runtime implementations, in unit tests etc.
func New() veyron2.Profile {
@@ -30,7 +36,7 @@
}
func (*generic) Runtime() string {
- return ""
+ return veyron2.GoogleRuntimeName
}
func (*generic) Platform() *veyron2.Platform {
diff --git a/profiles/roaming/roaming.go b/profiles/roaming/roaming.go
index dab60d0..da15842 100644
--- a/profiles/roaming/roaming.go
+++ b/profiles/roaming/roaming.go
@@ -64,7 +64,7 @@
}
func (p *profile) Runtime() string {
- return ""
+ return veyron2.GoogleRuntimeName
}
func (p *profile) String() string {
diff --git a/runtimes/google/ipc/debug_test.go b/runtimes/google/ipc/debug_test.go
index b395f0f..d7c50ee 100644
--- a/runtimes/google/ipc/debug_test.go
+++ b/runtimes/google/ipc/debug_test.go
@@ -11,7 +11,6 @@
"veyron.io/veyron/veyron2/services/mounttable/types"
"veyron.io/veyron/veyron/lib/stats"
- "veyron.io/veyron/veyron/profiles"
"veyron.io/veyron/veyron/runtimes/google/ipc/stream/manager"
"veyron.io/veyron/veyron/runtimes/google/ipc/stream/sectest"
"veyron.io/veyron/veyron/runtimes/google/ipc/stream/vc"
@@ -38,7 +37,7 @@
}
defer server.Stop()
server.Serve("", ipc.LeafDispatcher(&testObject{}, nil))
- ep, err := server.ListenX(profiles.LocalListenSpec)
+ ep, err := server.ListenX(&listenSpec)
if err != nil {
t.Fatalf("server.Listen failed: %v", err)
}
diff --git a/runtimes/google/ipc/full_test.go b/runtimes/google/ipc/full_test.go
index cbb2f49..22e282e 100644
--- a/runtimes/google/ipc/full_test.go
+++ b/runtimes/google/ipc/full_test.go
@@ -11,18 +11,6 @@
"testing"
"time"
- "veyron.io/veyron/veyron/lib/netstate"
- "veyron.io/veyron/veyron/lib/testutil"
- "veyron.io/veyron/veyron/profiles"
- imanager "veyron.io/veyron/veyron/runtimes/google/ipc/stream/manager"
- "veyron.io/veyron/veyron/runtimes/google/ipc/stream/sectest"
- "veyron.io/veyron/veyron/runtimes/google/ipc/stream/vc"
- "veyron.io/veyron/veyron/runtimes/google/ipc/version"
- "veyron.io/veyron/veyron/runtimes/google/lib/publisher"
- inaming "veyron.io/veyron/veyron/runtimes/google/naming"
- tnaming "veyron.io/veyron/veyron/runtimes/google/testing/mocks/naming"
- vsecurity "veyron.io/veyron/veyron/security"
-
"veyron.io/veyron/veyron2/ipc"
"veyron.io/veyron/veyron2/ipc/stream"
"veyron.io/veyron/veyron2/naming"
@@ -32,11 +20,23 @@
"veyron.io/veyron/veyron2/verror"
"veyron.io/veyron/veyron2/vlog"
"veyron.io/veyron/veyron2/vom"
+
+ "veyron.io/veyron/veyron/lib/netstate"
+ "veyron.io/veyron/veyron/lib/testutil"
+ imanager "veyron.io/veyron/veyron/runtimes/google/ipc/stream/manager"
+ "veyron.io/veyron/veyron/runtimes/google/ipc/stream/sectest"
+ "veyron.io/veyron/veyron/runtimes/google/ipc/stream/vc"
+ "veyron.io/veyron/veyron/runtimes/google/ipc/version"
+ "veyron.io/veyron/veyron/runtimes/google/lib/publisher"
+ inaming "veyron.io/veyron/veyron/runtimes/google/naming"
+ tnaming "veyron.io/veyron/veyron/runtimes/google/testing/mocks/naming"
+ vsecurity "veyron.io/veyron/veyron/security"
)
var (
- errMethod = verror.Abortedf("server returned an error")
- clock = new(fakeClock)
+ errMethod = verror.Abortedf("server returned an error")
+ clock = new(fakeClock)
+ listenSpec = ipc.ListenSpec{Protocol: "tcp", Address: "127.0.0.1:0"}
)
type fakeClock struct {
@@ -174,7 +174,7 @@
t.Errorf("InternalNewServer failed: %v", err)
}
vlog.VI(1).Info("server.Listen")
- ep, err := server.ListenX(profiles.LocalListenSpec)
+ ep, err := server.ListenX(&listenSpec)
if err != nil {
t.Errorf("server.Listen failed: %v", err)
}
@@ -274,7 +274,7 @@
if err != nil {
t.Errorf("InternalNewServer failed: %v", err)
}
- _, err = server.ListenX(profiles.LocalListenSpec)
+ _, err = server.ListenX(&listenSpec)
if err != nil {
t.Errorf("server.Listen failed: %v", err)
}
@@ -597,7 +597,7 @@
t.Fatal(err)
}
defer server.Stop()
- if _, err := server.ListenX(profiles.LocalListenSpec); err != nil {
+ if _, err := server.ListenX(&listenSpec); err != nil {
t.Fatal(err)
}
@@ -990,7 +990,7 @@
t.Errorf("InternalNewServer failed: %v", err)
}
defer server.Stop()
- spec := *profiles.LocalListenSpec
+ spec := listenSpec
spec.Address = ":0"
spec.AddressChooser = pa
ep, err := server.ListenX(&spec)
@@ -1003,7 +1003,7 @@
t.Errorf("got %q, want %q", got, want)
}
// Won't override the specified address.
- ep, err = server.ListenX(profiles.LocalListenSpec)
+ ep, err = server.ListenX(&listenSpec)
iep = ep.(*inaming.Endpoint)
host, _, err = net.SplitHostPort(iep.Address)
if err != nil {
@@ -1026,7 +1026,7 @@
t.Errorf("InternalNewServer failed: %v", err)
}
defer server.Stop()
- spec := *profiles.LocalListenSpec
+ spec := listenSpec
spec.Address = ":0"
spec.AddressChooser = paerr
ep, err := server.ListenX(&spec)
diff --git a/runtimes/google/ipc/server.go b/runtimes/google/ipc/server.go
index 3578abe..c4d6fcd 100644
--- a/runtimes/google/ipc/server.go
+++ b/runtimes/google/ipc/server.go
@@ -9,17 +9,6 @@
"sync"
"time"
- "veyron.io/veyron/veyron/lib/glob"
- "veyron.io/veyron/veyron/lib/netstate"
- "veyron.io/veyron/veyron/runtimes/google/lib/publisher"
- inaming "veyron.io/veyron/veyron/runtimes/google/naming"
- isecurity "veyron.io/veyron/veyron/runtimes/google/security"
- ivtrace "veyron.io/veyron/veyron/runtimes/google/vtrace"
- vsecurity "veyron.io/veyron/veyron/security"
- "veyron.io/veyron/veyron/services/mgmt/debug"
-
- "veyron.io/veyron/veyron/profiles/internal"
-
"veyron.io/veyron/veyron2"
"veyron.io/veyron/veyron2/config"
"veyron.io/veyron/veyron2/context"
@@ -33,6 +22,15 @@
"veyron.io/veyron/veyron2/vlog"
"veyron.io/veyron/veyron2/vom"
"veyron.io/veyron/veyron2/vtrace"
+
+ "veyron.io/veyron/veyron/lib/glob"
+ "veyron.io/veyron/veyron/lib/netstate"
+ "veyron.io/veyron/veyron/runtimes/google/lib/publisher"
+ inaming "veyron.io/veyron/veyron/runtimes/google/naming"
+ isecurity "veyron.io/veyron/veyron/runtimes/google/security"
+ ivtrace "veyron.io/veyron/veyron/runtimes/google/vtrace"
+ vsecurity "veyron.io/veyron/veyron/security"
+ "veyron.io/veyron/veyron/services/mgmt/debug"
)
var (
@@ -135,6 +133,40 @@
return "", fmt.Errorf("unable to resolve %q to an endpoint", address)
}
+// ipAddressChooser returns the preferred IP address, which is,
+// a public IPv4 address, then any non-loopback IPv4, then a public
+// IPv6 address and finally any non-loopback/link-local IPv6
+// It is replicated here to avoid a circular dependency and will, in any case,
+// go away when we transition away from Listen to the ListenX API.
+func ipAddressChooser(network string, addrs []ipc.Address) ([]ipc.Address, error) {
+ if !netstate.IsIPProtocol(network) {
+ return nil, fmt.Errorf("can't support network protocol %q", network)
+ }
+ accessible := netstate.AddrList(addrs)
+
+ // Try and find an address on a interface with a default route.
+ predicates := []netstate.AddressPredicate{netstate.IsPublicUnicastIPv4,
+ netstate.IsUnicastIPv4, netstate.IsPublicUnicastIPv6}
+ for _, predicate := range predicates {
+ if addrs := accessible.Filter(predicate); len(addrs) > 0 {
+ onDefaultRoutes := addrs.Filter(netstate.IsOnDefaultRoute)
+ if len(onDefaultRoutes) > 0 {
+ return onDefaultRoutes, nil
+ }
+ }
+ }
+
+ // We failed to find any addresses with default routes, try again
+ // but without the default route requirement.
+ for _, predicate := range predicates {
+ if addrs := accessible.Filter(predicate); len(addrs) > 0 {
+ return addrs, nil
+ }
+ }
+
+ return nil, fmt.Errorf("failed to find any usable address for %q", network)
+}
+
func (s *server) Listen(protocol, address string) (naming.Endpoint, error) {
defer vlog.LogCall()()
s.Lock()
@@ -180,7 +212,7 @@
if ip.IsUnspecified() {
addrs, err := netstate.GetAccessibleIPs()
if err == nil {
- if a, err := internal.IPAddressChooser(iep.Protocol, addrs); err == nil && len(a) > 0 {
+ if a, err := ipAddressChooser(iep.Protocol, addrs); err == nil && len(a) > 0 {
iep.Address = net.JoinHostPort(a[0].Address().String(), port)
}
}
diff --git a/runtimes/google/ipc/server_test.go b/runtimes/google/ipc/server_test.go
index 5842e50..6453874 100644
--- a/runtimes/google/ipc/server_test.go
+++ b/runtimes/google/ipc/server_test.go
@@ -14,7 +14,6 @@
"veyron.io/veyron/veyron/runtimes/google/ipc/stream/vc"
"veyron.io/veyron/veyron/lib/modules"
- "veyron.io/veyron/veyron/profiles"
imanager "veyron.io/veyron/veyron/runtimes/google/ipc/stream/manager"
"veyron.io/veyron/veyron/runtimes/google/ipc/stream/proxy"
"veyron.io/veyron/veyron/runtimes/google/ipc/stream/sectest"
@@ -149,7 +148,7 @@
t.Fatal(err)
}
defer proxy.Stop()
- spec := *profiles.LocalListenSpec
+ spec := listenSpec
spec.Proxy = "proxy"
if _, err := server.ListenX(&spec); err != nil {
t.Fatal(err)
@@ -203,7 +202,7 @@
if err := server.Serve("server", disp); err != nil {
return fmt.Errorf("server.Register failed: %v", err)
}
- spec := *profiles.LocalListenSpec
+ spec := listenSpec
spec.Address = args[1]
ep, err := server.ListenX(&spec)
if err != nil {
diff --git a/runtimes/google/naming/namespace/all_test.go b/runtimes/google/naming/namespace/all_test.go
index 8855012..137833b 100644
--- a/runtimes/google/naming/namespace/all_test.go
+++ b/runtimes/google/naming/namespace/all_test.go
@@ -7,11 +7,6 @@
"testing"
"time"
- "veyron.io/veyron/veyron/lib/glob"
- "veyron.io/veyron/veyron/lib/testutil"
- "veyron.io/veyron/veyron/runtimes/google/naming/namespace"
- service "veyron.io/veyron/veyron/services/mounttable/lib"
-
"veyron.io/veyron/veyron2"
"veyron.io/veyron/veyron2/ipc"
"veyron.io/veyron/veyron2/naming"
@@ -21,6 +16,12 @@
"veyron.io/veyron/veyron2/services/mounttable"
"veyron.io/veyron/veyron2/services/mounttable/types"
"veyron.io/veyron/veyron2/vlog"
+
+ "veyron.io/veyron/veyron/lib/glob"
+ "veyron.io/veyron/veyron/lib/testutil"
+ _ "veyron.io/veyron/veyron/profiles"
+ "veyron.io/veyron/veyron/runtimes/google/naming/namespace"
+ service "veyron.io/veyron/veyron/services/mounttable/lib"
)
func init() { testutil.Init() }
diff --git a/runtimes/google/rt/mgmt.go b/runtimes/google/rt/mgmt.go
index a1901f5..e95ec73 100644
--- a/runtimes/google/rt/mgmt.go
+++ b/runtimes/google/rt/mgmt.go
@@ -12,7 +12,6 @@
"veyron.io/veyron/veyron2/naming"
"veyron.io/veyron/veyron/lib/exec"
- "veyron.io/veyron/veyron/profiles"
"veyron.io/veyron/veyron/runtimes/google/appcycle"
)
@@ -42,7 +41,7 @@
return
}
-func (m *mgmtImpl) init(rt *vrt) error {
+func (m *mgmtImpl) initMgmt(rt *vrt, listenSpec *ipc.ListenSpec) error {
m.rt = rt
parentName := parentName()
if len(parentName) == 0 {
@@ -54,7 +53,7 @@
}
// TODO(caprita): We should pick the address to listen on from config.
var ep naming.Endpoint
- if ep, err = m.server.ListenX(profiles.LocalListenSpec); err != nil {
+ if ep, err = m.server.ListenX(listenSpec); err != nil {
return err
}
if err := m.server.Serve("", ipc.LeafDispatcher(appcycle.NewServerAppCycle(m), nil)); err != nil {
diff --git a/runtimes/google/rt/mgmt_test.go b/runtimes/google/rt/mgmt_test.go
index c0446e2..aa74c2d 100644
--- a/runtimes/google/rt/mgmt_test.go
+++ b/runtimes/google/rt/mgmt_test.go
@@ -26,6 +26,8 @@
"veyron.io/veyron/veyron/services/mgmt/node"
)
+var profileOpt = options.Profile{profiles.New()}
+
const (
noWaitersCmd = "noWaiters"
forceStopCmd = "forceStop"
@@ -42,7 +44,7 @@
// TestBasic verifies that the basic plumbing works: LocalStop calls result in
// stop messages being sent on the channel passed to WaitForStop.
func TestBasic(t *testing.T) {
- m, _ := rt.New()
+ m, _ := rt.New(profileOpt)
ch := make(chan string, 1)
m.WaitForStop(ch)
for i := 0; i < 10; i++ {
@@ -61,7 +63,7 @@
// TestMultipleWaiters verifies that the plumbing works with more than one
// registered wait channel.
func TestMultipleWaiters(t *testing.T) {
- m, _ := rt.New()
+ m, _ := rt.New(profileOpt)
ch1 := make(chan string, 1)
m.WaitForStop(ch1)
ch2 := make(chan string, 1)
@@ -81,7 +83,7 @@
// channel is not being drained: once the channel's buffer fills up, future
// Stops become no-ops.
func TestMultipleStops(t *testing.T) {
- m, _ := rt.New()
+ m, _ := rt.New(profileOpt)
ch := make(chan string, 1)
m.WaitForStop(ch)
for i := 0; i < 10; i++ {
@@ -98,7 +100,7 @@
}
func noWaiters(stdin io.Reader, stdout, stderr io.Writer, env map[string]string, args ...string) error {
- m, _ := rt.New()
+ m, _ := rt.New(profileOpt)
fmt.Fprintf(stdout, "ready\n")
modules.WaitForEOF(stdin)
m.Stop()
@@ -123,7 +125,7 @@
}
func forceStop(stdin io.Reader, stdout, stderr io.Writer, env map[string]string, args ...string) error {
- m, _ := rt.New()
+ m, _ := rt.New(profileOpt)
fmt.Fprintf(stdout, "ready\n")
modules.WaitForEOF(stdin)
m.WaitForStop(make(chan string, 1))
@@ -167,7 +169,7 @@
// TestProgress verifies that the ticker update/track logic works for a single
// tracker.
func TestProgress(t *testing.T) {
- m, _ := rt.New()
+ m, _ := rt.New(profileOpt)
m.AdvanceGoal(50)
ch := make(chan veyron2.Task, 1)
m.TrackTask(ch)
@@ -197,7 +199,7 @@
// works for more than one tracker. It also ensures that the runtime doesn't
// block when the tracker channels are full.
func TestProgressMultipleTrackers(t *testing.T) {
- m, _ := rt.New()
+ m, _ := rt.New(profileOpt)
// ch1 is 1-buffered, ch2 is 2-buffered.
ch1, ch2 := make(chan veyron2.Task, 1), make(chan veyron2.Task, 2)
m.TrackTask(ch1)
@@ -230,7 +232,7 @@
}
func app(stdin io.Reader, stdout, stderr io.Writer, env map[string]string, args ...string) error {
- r, err := rt.New()
+ r, err := rt.New(profileOpt)
if err != nil {
return err
}
@@ -282,7 +284,7 @@
// refer to the global rt.R() function), but we take care to make sure
// that the "google" runtime we are trying to test in this package is
// the one being used.
- r, _ := rt.New(options.GoogleRuntime, options.ForceNewSecurityModel{})
+ r, _ := rt.New(profileOpt, options.GoogleRuntime, options.ForceNewSecurityModel{})
childcreds := security.NewVeyronCredentials(r.Principal(), appCmd)
configServer, configServiceName, ch := createConfigServer(t, r)
diff --git a/runtimes/google/rt/rt.go b/runtimes/google/rt/rt.go
index d670ca8..294941d 100644
--- a/runtimes/google/rt/rt.go
+++ b/runtimes/google/rt/rt.go
@@ -14,14 +14,14 @@
"veyron.io/veyron/veyron2/ipc"
"veyron.io/veyron/veyron2/ipc/stream"
"veyron.io/veyron/veyron2/naming"
- "veyron.io/veyron/veyron2/options"
- "veyron.io/veyron/veyron2/security"
- "veyron.io/veyron/veyron2/vlog"
+ "veyron.io/veyron/veyron2/rt"
"veyron.io/veyron/veyron/lib/exec"
_ "veyron.io/veyron/veyron/lib/stats/sysstats"
- "veyron.io/veyron/veyron/profiles"
"veyron.io/veyron/veyron/runtimes/google/naming/namespace"
+ "veyron.io/veyron/veyron2/options"
+ "veyron.io/veyron/veyron2/security"
+ "veyron.io/veyron/veyron2/vlog"
)
// TODO(caprita): Verrorize this, and maybe move it in the API.
@@ -53,6 +53,10 @@
var _ veyron2.Runtime = (*vrt)(nil)
+func init() {
+ rt.RegisterRuntime(veyron2.GoogleRuntimeName, New)
+}
+
// Implements veyron2/rt.New
func New(opts ...veyron2.ROpt) (veyron2.Runtime, error) {
rt := &vrt{mgmt: new(mgmtImpl), lang: i18n.LangIDFromEnv(), program: filepath.Base(os.Args[0])}
@@ -83,9 +87,10 @@
rt.initSignalHandling()
if rt.profile == nil {
- rt.profile = profiles.New()
+ return nil, fmt.Errorf("No profile configured!")
+ } else {
+ vlog.VI(1).Infof("Using profile %q", rt.profile.Name())
}
- vlog.VI(1).Infof("Using profile %q", rt.profile.Name())
if len(nsRoots) == 0 {
for _, ev := range os.Environ() {
@@ -134,7 +139,10 @@
return nil, err
}
- if err := rt.mgmt.init(rt); err != nil {
+ // TODO(caprita, cnicolaou): how is this to be configured?
+ // Can it ever be anything other than a localhost/loopback address?
+ listenSpec := &ipc.ListenSpec{Protocol: "tcp", Address: "127.0.0.1:0"}
+ if err := rt.mgmt.initMgmt(rt, listenSpec); err != nil {
return nil, err
}
diff --git a/runtimes/google/rt/rt_test.go b/runtimes/google/rt/rt_test.go
index 7620610..8b23035 100644
--- a/runtimes/google/rt/rt_test.go
+++ b/runtimes/google/rt/rt_test.go
@@ -51,7 +51,7 @@
}
func TestInit(t *testing.T) {
- r, err := rt.New()
+ r, err := rt.New(profileOpt)
if err != nil {
t.Fatalf("error: %s", err)
}
@@ -101,7 +101,7 @@
func TestInitPrincipal(t *testing.T) {
newRT := func() veyron2.Runtime {
- r, err := rt.New()
+ r, err := rt.New(profileOpt)
if err != nil {
t.Fatalf("rt.New failed: %v", err)
}
@@ -168,8 +168,7 @@
if err != nil {
t.Fatalf("NewPrincipal() failed: %v", err)
}
-
- r, err := rt.New(options.RuntimePrincipal{p})
+ r, err := rt.New(profileOpt, options.RuntimePrincipal{p})
if err != nil {
t.Fatalf("rt.New failed: %v", err)
}
diff --git a/runtimes/google/rt/sectransition/sectransition.go b/runtimes/google/rt/sectransition/sectransition.go
index 1ac2734..d5293c3 100644
--- a/runtimes/google/rt/sectransition/sectransition.go
+++ b/runtimes/google/rt/sectransition/sectransition.go
@@ -7,6 +7,7 @@
"time"
"veyron.io/veyron/veyron/lib/signals"
+ _ "veyron.io/veyron/veyron/profiles"
"veyron.io/veyron/veyron2/ipc"
"veyron.io/veyron/veyron2/naming"
diff --git a/security/agent/agent_test.go b/security/agent/agent_test.go
index 9721b38..524a964 100644
--- a/security/agent/agent_test.go
+++ b/security/agent/agent_test.go
@@ -7,11 +7,14 @@
"os"
"reflect"
"testing"
- "veyron.io/veyron/veyron/security/agent"
- "veyron.io/veyron/veyron/security/agent/server"
+
"veyron.io/veyron/veyron2/options"
"veyron.io/veyron/veyron2/rt"
"veyron.io/veyron/veyron2/security"
+
+ _ "veyron.io/veyron/veyron/profiles"
+ "veyron.io/veyron/veyron/security/agent"
+ "veyron.io/veyron/veyron/security/agent/server"
)
type fakesigner struct {
diff --git a/security/agent/agentd/main.go b/security/agent/agentd/main.go
index 1fc6ccd..8e64de8 100644
--- a/security/agent/agentd/main.go
+++ b/security/agent/agentd/main.go
@@ -6,9 +6,12 @@
"os"
"os/exec"
"syscall"
+
+ "veyron.io/veyron/veyron2/rt"
+
+ _ "veyron.io/veyron/veyron/profiles"
"veyron.io/veyron/veyron/security/agent"
"veyron.io/veyron/veyron/security/agent/server"
- "veyron.io/veyron/veyron2/rt"
)
func main() {
diff --git a/security/agent/test/main.go b/security/agent/test/main.go
index 2ce3214..6b9fbda 100644
--- a/security/agent/test/main.go
+++ b/security/agent/test/main.go
@@ -4,10 +4,12 @@
"flag"
"fmt"
- "veyron.io/veyron/veyron/lib/signals"
- sflag "veyron.io/veyron/veyron/security/flag"
"veyron.io/veyron/veyron2/ipc"
"veyron.io/veyron/veyron2/rt"
+
+ "veyron.io/veyron/veyron/lib/signals"
+ _ "veyron.io/veyron/veyron/profiles"
+ sflag "veyron.io/veyron/veyron/security/flag"
)
var runServer = flag.Bool("server", false, "Whether to run in server mode")
diff --git a/services/identity/auditor/file_test.go b/services/identity/auditor/file_test.go
index 8a98f86..2a89aad 100644
--- a/services/identity/auditor/file_test.go
+++ b/services/identity/auditor/file_test.go
@@ -9,9 +9,11 @@
"testing"
"time"
- "veyron.io/veyron/veyron/security/audit"
"veyron.io/veyron/veyron2/rt"
"veyron.io/veyron/veyron2/security"
+
+ _ "veyron.io/veyron/veyron/profiles"
+ "veyron.io/veyron/veyron/security/audit"
)
func TestFileAuditor(t *testing.T) {
diff --git a/services/identity/handlers/handlers_test.go b/services/identity/handlers/handlers_test.go
index a19ee91..e3ed4a6 100644
--- a/services/identity/handlers/handlers_test.go
+++ b/services/identity/handlers/handlers_test.go
@@ -7,10 +7,11 @@
"reflect"
"testing"
- "veyron.io/veyron/veyron/services/identity/util"
-
"veyron.io/veyron/veyron2/rt"
"veyron.io/veyron/veyron2/security"
+
+ _ "veyron.io/veyron/veyron/profiles"
+ "veyron.io/veyron/veyron/services/identity/util"
)
func TestPublicKey(t *testing.T) {
diff --git a/services/mounttable/mounttabled/mounttable.go b/services/mounttable/mounttabled/mounttable.go
index 651c444..b76f0f7 100644
--- a/services/mounttable/mounttabled/mounttable.go
+++ b/services/mounttable/mounttabled/mounttable.go
@@ -23,7 +23,6 @@
)
func main() {
- //flag.Usage = Usage
r := rt.Init()
defer r.Cleanup()
diff --git a/services/proxy/proxyd/main.go b/services/proxy/proxyd/main.go
index f7296a6..74ad181 100644
--- a/services/proxy/proxyd/main.go
+++ b/services/proxy/proxyd/main.go
@@ -8,11 +8,13 @@
_ "net/http/pprof"
"time"
- "veyron.io/veyron/veyron/runtimes/google/ipc/stream/proxy"
- "veyron.io/veyron/veyron/runtimes/google/lib/publisher"
"veyron.io/veyron/veyron2/naming"
"veyron.io/veyron/veyron2/rt"
"veyron.io/veyron/veyron2/vlog"
+
+ _ "veyron.io/veyron/veyron/profiles"
+ "veyron.io/veyron/veyron/runtimes/google/ipc/stream/proxy"
+ "veyron.io/veyron/veyron/runtimes/google/lib/publisher"
)
var (
diff --git a/services/security/discharger/revoker_test.go b/services/security/discharger/revoker_test.go
index fc247e2..abc56a3 100644
--- a/services/security/discharger/revoker_test.go
+++ b/services/security/discharger/revoker_test.go
@@ -4,12 +4,15 @@
"os"
"path/filepath"
"testing"
- services "veyron.io/veyron/veyron/services/security"
+
"veyron.io/veyron/veyron2"
"veyron.io/veyron/veyron2/ipc"
"veyron.io/veyron/veyron2/naming"
"veyron.io/veyron/veyron2/rt"
"veyron.io/veyron/veyron2/security"
+
+ _ "veyron.io/veyron/veyron/profiles"
+ services "veyron.io/veyron/veyron/services/security"
)
func revokerSetup(t *testing.T) (dischargerID security.PublicID, dischargerEndpoint, revokerEndpoint string, closeFunc func(), runtime veyron2.Runtime) {
diff --git a/tools/application/main.go b/tools/application/main.go
index 568f32e..3c9e43d 100644
--- a/tools/application/main.go
+++ b/tools/application/main.go
@@ -10,9 +10,10 @@
package main
import (
- "veyron.io/veyron/veyron/tools/application/impl"
-
"veyron.io/veyron/veyron2/rt"
+
+ _ "veyron.io/veyron/veyron/profiles"
+ "veyron.io/veyron/veyron/tools/application/impl"
)
func main() {
diff --git a/tools/binary/main.go b/tools/binary/main.go
index 3edd674..dddeb0d 100644
--- a/tools/binary/main.go
+++ b/tools/binary/main.go
@@ -10,9 +10,10 @@
package main
import (
- "veyron.io/veyron/veyron/tools/binary/impl"
-
"veyron.io/veyron/veyron2/rt"
+
+ _ "veyron.io/veyron/veyron/profiles"
+ "veyron.io/veyron/veyron/tools/binary/impl"
)
func main() {
diff --git a/tools/build/main.go b/tools/build/main.go
index c89bbd0..6b96081 100644
--- a/tools/build/main.go
+++ b/tools/build/main.go
@@ -10,9 +10,10 @@
package main
import (
- "veyron.io/veyron/veyron/tools/build/impl"
-
"veyron.io/veyron/veyron2/rt"
+
+ _ "veyron.io/veyron/veyron/profiles"
+ "veyron.io/veyron/veyron/tools/build/impl"
)
func main() {
diff --git a/tools/debug/main.go b/tools/debug/main.go
index ffa2f5b..41e29e5 100644
--- a/tools/debug/main.go
+++ b/tools/debug/main.go
@@ -10,8 +10,10 @@
package main
import (
- "veyron.io/veyron/veyron/tools/debug/impl"
"veyron.io/veyron/veyron2/rt"
+
+ _ "veyron.io/veyron/veyron/profiles"
+ "veyron.io/veyron/veyron/tools/debug/impl"
)
func main() {
diff --git a/tools/identity/main.go b/tools/identity/main.go
index 2479804..eae874c 100644
--- a/tools/identity/main.go
+++ b/tools/identity/main.go
@@ -19,15 +19,16 @@
"os/user"
"time"
- "veyron.io/veyron/veyron/lib/cmdline"
- "veyron.io/veyron/veyron/services/identity"
- "veyron.io/veyron/veyron/services/identity/util"
-
"veyron.io/veyron/veyron2/options"
"veyron.io/veyron/veyron2/rt"
"veyron.io/veyron/veyron2/security"
"veyron.io/veyron/veyron2/vdl/vdlutil"
"veyron.io/veyron/veyron2/vlog"
+
+ "veyron.io/veyron/veyron/lib/cmdline"
+ _ "veyron.io/veyron/veyron/profiles"
+ "veyron.io/veyron/veyron/services/identity"
+ "veyron.io/veyron/veyron/services/identity/util"
)
var (
diff --git a/tools/mounttable/main.go b/tools/mounttable/main.go
index 741e62f..c9538b4 100644
--- a/tools/mounttable/main.go
+++ b/tools/mounttable/main.go
@@ -10,9 +10,10 @@
package main
import (
- "veyron.io/veyron/veyron/tools/mounttable/impl"
-
"veyron.io/veyron/veyron2/rt"
+
+ _ "veyron.io/veyron/veyron/profiles"
+ "veyron.io/veyron/veyron/tools/mounttable/impl"
)
func main() {
diff --git a/tools/playground/builder/services.go b/tools/playground/builder/services.go
index 9abfe21..bc52e47 100644
--- a/tools/playground/builder/services.go
+++ b/tools/playground/builder/services.go
@@ -58,7 +58,7 @@
// variable to the mounttable's location. We run one mounttabled process for
// the entire environment.
func startMount(timeLimit time.Duration) (proc *os.Process, err error) {
- cmd := makeCmdJsonEvent("", "mounttabled", "--veyron.tcp.address=localhost:0")
+ cmd := makeCmdJsonEvent("", "mounttabled", "--veyron.tcp.address=127.0.0.1:0")
matches, err := startAndWaitFor(cmd, timeLimit, regexp.MustCompile("Mount table .+ endpoint: (.+)\n"))
if err != nil {
@@ -78,7 +78,7 @@
if err != nil {
return nil, err
}
- cmd := makeCmdJsonEvent("", "proxyd", "-name="+proxyName, "-address=localhost:"+strconv.Itoa(port))
+ cmd := makeCmdJsonEvent("", "proxyd", "-name="+proxyName, "-address=127.0.0.1:"+strconv.Itoa(port))
err = cmd.Start()
if err != nil {
return nil, err
diff --git a/tools/playground/test.sh b/tools/playground/test.sh
index 04f5236..dd793da 100755
--- a/tools/playground/test.sh
+++ b/tools/playground/test.sh
@@ -45,11 +45,12 @@
main() {
cd $(shell::tmp_dir)
+
build
install_veyron_js
install_pgbundle
- local -r DIR="${VEYRON_ROOT}/veyron/go/src/veyron.io/veyron/veyron/tools/playground/testdata"
+ local -r DIR="$(shell::go_package_dir veyron.io/veyron/veyron/tools/playground/testdata)"
export GOPATH="$(pwd):$(veyron env GOPATH)"
export VDLPATH="$(pwd):$(veyron env VDLPATH)"
diff --git a/tools/playground/testdata/ping/ping.go b/tools/playground/testdata/ping/ping.go
index 0ac3a4f..c952aba 100644
--- a/tools/playground/testdata/ping/ping.go
+++ b/tools/playground/testdata/ping/ping.go
@@ -3,8 +3,11 @@
import (
"fmt"
- "pingpong"
+
"veyron.io/veyron/veyron2/rt"
+
+ _ "veyron.io/veyron/veyron/profiles"
+ "veyron.io/veyron/veyron/tools/playground/testdata/pingpong"
)
func main() {
diff --git a/tools/playground/testdata/pong/pong.go b/tools/playground/testdata/pong/pong.go
index 8bd86b7..61d9c11 100644
--- a/tools/playground/testdata/pong/pong.go
+++ b/tools/playground/testdata/pong/pong.go
@@ -4,10 +4,13 @@
import (
"fmt"
"pingpong"
- "veyron.io/veyron/veyron/lib/signals"
- sflag "veyron.io/veyron/veyron/security/flag"
+
"veyron.io/veyron/veyron2/ipc"
"veyron.io/veyron/veyron2/rt"
+
+ "veyron.io/veyron/veyron/lib/signals"
+ _ "veyron.io/veyron/veyron/profiles"
+ sflag "veyron.io/veyron/veyron/security/flag"
)
type pongd struct{}
diff --git a/tools/principal/main.go b/tools/principal/main.go
index ded8117..62a05ac 100644
--- a/tools/principal/main.go
+++ b/tools/principal/main.go
@@ -9,15 +9,16 @@
"os/user"
"time"
- "veyron.io/veyron/veyron/lib/cmdline"
- vsecurity "veyron.io/veyron/veyron/security"
- "veyron.io/veyron/veyron/services/identity"
- "veyron.io/veyron/veyron/services/identity/util"
-
"veyron.io/veyron/veyron2"
"veyron.io/veyron/veyron2/rt"
"veyron.io/veyron/veyron2/security"
"veyron.io/veyron/veyron2/vdl/vdlutil"
+
+ "veyron.io/veyron/veyron/lib/cmdline"
+ _ "veyron.io/veyron/veyron/profiles"
+ vsecurity "veyron.io/veyron/veyron/security"
+ "veyron.io/veyron/veyron/services/identity"
+ "veyron.io/veyron/veyron/services/identity/util"
)
const VEYRON_CREDENTIALS = "VEYRON_CREDENTIALS"
diff --git a/tools/profile/main.go b/tools/profile/main.go
index 2af525d..377b3d0 100644
--- a/tools/profile/main.go
+++ b/tools/profile/main.go
@@ -10,9 +10,10 @@
package main
import (
- "veyron.io/veyron/veyron/tools/profile/impl"
-
"veyron.io/veyron/veyron2/rt"
+
+ _ "veyron.io/veyron/veyron/profiles"
+ "veyron.io/veyron/veyron/tools/profile/impl"
)
func main() {