Merge "consistent use of v23 test generate in order to use TestMain and in turn call test.Init."
diff --git a/cmd/application/impl_test.go b/cmd/application/impl_test.go
index 9315b2d..5df47a9 100644
--- a/cmd/application/impl_test.go
+++ b/cmd/application/impl_test.go
@@ -73,6 +73,8 @@
 }`
 )
 
+//go:generate v23 test generate
+
 type server struct {
 	suffix string
 }
diff --git a/cmd/application/v23_internal_test.go b/cmd/application/v23_internal_test.go
new file mode 100644
index 0000000..dcd0029
--- /dev/null
+++ b/cmd/application/v23_internal_test.go
@@ -0,0 +1,17 @@
+// Copyright 2015 The Vanadium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+// This file was auto-generated via go generate.
+// DO NOT UPDATE MANUALLY
+package main
+
+import "testing"
+import "os"
+
+import "v.io/x/ref/test"
+
+func TestMain(m *testing.M) {
+	test.Init()
+	os.Exit(m.Run())
+}
diff --git a/cmd/binary/impl_test.go b/cmd/binary/impl_test.go
index eb2ade6..8d53851 100644
--- a/cmd/binary/impl_test.go
+++ b/cmd/binary/impl_test.go
@@ -29,6 +29,8 @@
 	"v.io/x/ref/test"
 )
 
+//go:generate v23 test generate
+
 type server struct {
 	suffix string
 }
diff --git a/cmd/binary/v23_internal_test.go b/cmd/binary/v23_internal_test.go
new file mode 100644
index 0000000..dcd0029
--- /dev/null
+++ b/cmd/binary/v23_internal_test.go
@@ -0,0 +1,17 @@
+// Copyright 2015 The Vanadium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+// This file was auto-generated via go generate.
+// DO NOT UPDATE MANUALLY
+package main
+
+import "testing"
+import "os"
+
+import "v.io/x/ref/test"
+
+func TestMain(m *testing.M) {
+	test.Init()
+	os.Exit(m.Run())
+}
diff --git a/cmd/build/impl_test.go b/cmd/build/impl_test.go
index 13e2653..9cc263b 100644
--- a/cmd/build/impl_test.go
+++ b/cmd/build/impl_test.go
@@ -22,6 +22,8 @@
 	"v.io/x/ref/test"
 )
 
+//go:generate v23 test generate
+
 type mock struct{}
 
 func (mock) Build(call build.BuilderBuildServerCall, arch build.Architecture, opsys build.OperatingSystem) ([]byte, error) {
diff --git a/cmd/build/v23_internal_test.go b/cmd/build/v23_internal_test.go
new file mode 100644
index 0000000..dcd0029
--- /dev/null
+++ b/cmd/build/v23_internal_test.go
@@ -0,0 +1,17 @@
+// Copyright 2015 The Vanadium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+// This file was auto-generated via go generate.
+// DO NOT UPDATE MANUALLY
+package main
+
+import "testing"
+import "os"
+
+import "v.io/x/ref/test"
+
+func TestMain(m *testing.M) {
+	test.Init()
+	os.Exit(m.Run())
+}
diff --git a/cmd/mgmt/device/impl/impl_test.go b/cmd/mgmt/device/impl/impl_test.go
index 8133798..0d69ecb 100644
--- a/cmd/mgmt/device/impl/impl_test.go
+++ b/cmd/mgmt/device/impl/impl_test.go
@@ -23,6 +23,8 @@
 	"v.io/x/ref/security"
 )
 
+//go:generate v23 test generate
+
 func TestListCommand(t *testing.T) {
 	shutdown := initTest()
 	defer shutdown()
diff --git a/cmd/mgmt/device/impl/v23_internal_test.go b/cmd/mgmt/device/impl/v23_internal_test.go
new file mode 100644
index 0000000..f3c1179
--- /dev/null
+++ b/cmd/mgmt/device/impl/v23_internal_test.go
@@ -0,0 +1,17 @@
+// Copyright 2015 The Vanadium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+// This file was auto-generated via go generate.
+// DO NOT UPDATE MANUALLY
+package impl
+
+import "testing"
+import "os"
+
+import "v.io/x/ref/test"
+
+func TestMain(m *testing.M) {
+	test.Init()
+	os.Exit(m.Run())
+}
diff --git a/cmd/profile/impl_test.go b/cmd/profile/impl_test.go
index 2241d96..e89b79c 100644
--- a/cmd/profile/impl_test.go
+++ b/cmd/profile/impl_test.go
@@ -36,6 +36,8 @@
 	}
 )
 
+//go:generate v23 test generate
+
 type server struct {
 	suffix string
 }
diff --git a/cmd/profile/v23_internal_test.go b/cmd/profile/v23_internal_test.go
new file mode 100644
index 0000000..dcd0029
--- /dev/null
+++ b/cmd/profile/v23_internal_test.go
@@ -0,0 +1,17 @@
+// Copyright 2015 The Vanadium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+// This file was auto-generated via go generate.
+// DO NOT UPDATE MANUALLY
+package main
+
+import "testing"
+import "os"
+
+import "v.io/x/ref/test"
+
+func TestMain(m *testing.M) {
+	test.Init()
+	os.Exit(m.Run())
+}
diff --git a/cmd/servicerunner/servicerunner b/cmd/servicerunner/servicerunner
new file mode 100755
index 0000000..938287a
--- /dev/null
+++ b/cmd/servicerunner/servicerunner
Binary files differ
diff --git a/cmd/servicerunner/servicerunner_test.go b/cmd/servicerunner/servicerunner_test.go
index 2978996..4d48f5e 100644
--- a/cmd/servicerunner/servicerunner_test.go
+++ b/cmd/servicerunner/servicerunner_test.go
@@ -19,6 +19,8 @@
 	"v.io/x/ref/test/testutil"
 )
 
+//go:generate v23 test generate
+
 func TestServiceRunner(t *testing.T) {
 	testutil.UnsetPrincipalEnvVars()
 	tmpdir, err := ioutil.TempDir("", "servicerunner_test")
diff --git a/cmd/servicerunner/v23_internal_test.go b/cmd/servicerunner/v23_internal_test.go
new file mode 100644
index 0000000..dcd0029
--- /dev/null
+++ b/cmd/servicerunner/v23_internal_test.go
@@ -0,0 +1,17 @@
+// Copyright 2015 The Vanadium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+// This file was auto-generated via go generate.
+// DO NOT UPDATE MANUALLY
+package main
+
+import "testing"
+import "os"
+
+import "v.io/x/ref/test"
+
+func TestMain(m *testing.M) {
+	test.Init()
+	os.Exit(m.Run())
+}
diff --git a/cmd/vdl/v23_internal_test.go b/cmd/vdl/v23_internal_test.go
new file mode 100644
index 0000000..dcd0029
--- /dev/null
+++ b/cmd/vdl/v23_internal_test.go
@@ -0,0 +1,17 @@
+// Copyright 2015 The Vanadium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+// This file was auto-generated via go generate.
+// DO NOT UPDATE MANUALLY
+package main
+
+import "testing"
+import "os"
+
+import "v.io/x/ref/test"
+
+func TestMain(m *testing.M) {
+	test.Init()
+	os.Exit(m.Run())
+}
diff --git a/cmd/vdl/vdl_test.go b/cmd/vdl/vdl_test.go
index 932aaa9..1c8ee18 100644
--- a/cmd/vdl/vdl_test.go
+++ b/cmd/vdl/vdl_test.go
@@ -19,6 +19,8 @@
 	outPkgPath = "v.io/x/ref/lib/vdl/testdata/base"
 )
 
+//go:generate v23 test generate
+
 // Compares generated VDL files against the copy in the repo.
 func TestVDLGenerator(t *testing.T) {
 	// Setup the vdl command-line.
diff --git a/cmd/vrpc/v23_internal_test.go b/cmd/vrpc/v23_internal_test.go
new file mode 100644
index 0000000..dcd0029
--- /dev/null
+++ b/cmd/vrpc/v23_internal_test.go
@@ -0,0 +1,17 @@
+// Copyright 2015 The Vanadium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+// This file was auto-generated via go generate.
+// DO NOT UPDATE MANUALLY
+package main
+
+import "testing"
+import "os"
+
+import "v.io/x/ref/test"
+
+func TestMain(m *testing.M) {
+	test.Init()
+	os.Exit(m.Run())
+}
diff --git a/cmd/vrpc/vrpc_test.go b/cmd/vrpc/vrpc_test.go
index f1328c1..8d25a93 100644
--- a/cmd/vrpc/vrpc_test.go
+++ b/cmd/vrpc/vrpc_test.go
@@ -20,6 +20,8 @@
 
 type server struct{}
 
+//go:generate v23 test generate
+
 // TypeTester interface implementation
 
 func (*server) EchoBool(call rpc.ServerCall, i1 bool) (bool, error) {
diff --git a/profiles/internal/rpc/benchmark/benchmark_test.go b/profiles/internal/rpc/benchmark/benchmark_test.go
index aee253d..8bf35c8 100644
--- a/profiles/internal/rpc/benchmark/benchmark_test.go
+++ b/profiles/internal/rpc/benchmark/benchmark_test.go
@@ -106,6 +106,7 @@
 func TestNoOp(t *testing.T) {}
 
 func TestMain(m *testing.M) {
+	test.Init()
 	// We do not use defer here since this program will exit at the end of
 	// this function through os.Exit().
 	var shutdown v23.Shutdown
diff --git a/profiles/internal/vtrace/v23_internal_test.go b/profiles/internal/vtrace/v23_internal_test.go
new file mode 100644
index 0000000..c454bfe
--- /dev/null
+++ b/profiles/internal/vtrace/v23_internal_test.go
@@ -0,0 +1,17 @@
+// Copyright 2015 The Vanadium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+// This file was auto-generated via go generate.
+// DO NOT UPDATE MANUALLY
+package vtrace
+
+import "testing"
+import "os"
+
+import "v.io/x/ref/test"
+
+func TestMain(m *testing.M) {
+	test.Init()
+	os.Exit(m.Run())
+}
diff --git a/profiles/internal/vtrace/vtrace_test.go b/profiles/internal/vtrace/vtrace_test.go
index 4d03eb6..752e89c 100644
--- a/profiles/internal/vtrace/vtrace_test.go
+++ b/profiles/internal/vtrace/vtrace_test.go
@@ -27,6 +27,8 @@
 	"v.io/x/ref/test/testutil"
 )
 
+//go:generate v23 test generate
+
 func TestNewFromContext(t *testing.T) {
 	c0, shutdown := test.InitForTest()
 	defer shutdown()
diff --git a/services/identity/internal/revocation/revocation_test.go b/services/identity/internal/revocation/revocation_test.go
index 0f06d26..463f12d 100644
--- a/services/identity/internal/revocation/revocation_test.go
+++ b/services/identity/internal/revocation/revocation_test.go
@@ -17,6 +17,8 @@
 	"v.io/v23/security"
 )
 
+//go:generate v23 test generate
+
 func revokerSetup(t *testing.T, ctx *context.T) (dischargerKey security.PublicKey, dischargerEndpoint string, revoker RevocationManager, closeFunc func()) {
 	revokerService := NewMockRevocationManager()
 	dischargerServer, err := v23.NewServer(ctx)
diff --git a/services/identity/internal/revocation/v23_internal_test.go b/services/identity/internal/revocation/v23_internal_test.go
new file mode 100644
index 0000000..ed4c9f9
--- /dev/null
+++ b/services/identity/internal/revocation/v23_internal_test.go
@@ -0,0 +1,17 @@
+// Copyright 2015 The Vanadium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+// This file was auto-generated via go generate.
+// DO NOT UPDATE MANUALLY
+package revocation
+
+import "testing"
+import "os"
+
+import "v.io/x/ref/test"
+
+func TestMain(m *testing.M) {
+	test.Init()
+	os.Exit(m.Run())
+}
diff --git a/services/mgmt/debug/dispatcher_test.go b/services/mgmt/debug/dispatcher_test.go
index 40e89f2..af0f472 100644
--- a/services/mgmt/debug/dispatcher_test.go
+++ b/services/mgmt/debug/dispatcher_test.go
@@ -33,6 +33,8 @@
 	"v.io/x/ref/test/testutil"
 )
 
+//go:generate v23 test generate
+
 // startDebugServer starts a debug server.
 func startDebugServer(ctx *context.T, listenSpec rpc.ListenSpec, logsDir string) (string, func(), error) {
 	if len(logsDir) == 0 {
diff --git a/services/mgmt/debug/v23_internal_test.go b/services/mgmt/debug/v23_internal_test.go
new file mode 100644
index 0000000..6fbfd3a
--- /dev/null
+++ b/services/mgmt/debug/v23_internal_test.go
@@ -0,0 +1,17 @@
+// Copyright 2015 The Vanadium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+// This file was auto-generated via go generate.
+// DO NOT UPDATE MANUALLY
+package debug
+
+import "testing"
+import "os"
+
+import "v.io/x/ref/test"
+
+func TestMain(m *testing.M) {
+	test.Init()
+	os.Exit(m.Run())
+}
diff --git a/services/mgmt/logreader/impl/logfile_test.go b/services/mgmt/logreader/impl/logfile_test.go
index 120165e..fa3081a 100644
--- a/services/mgmt/logreader/impl/logfile_test.go
+++ b/services/mgmt/logreader/impl/logfile_test.go
@@ -23,6 +23,8 @@
 	"v.io/x/ref/test"
 )
 
+//go:generate v23 test generate
+
 func startServer(t *testing.T, ctx *context.T, disp rpc.Dispatcher) (rpc.Server, string, error) {
 	server, err := v23.NewServer(ctx)
 	if err != nil {
diff --git a/services/mgmt/logreader/impl/v23_internal_test.go b/services/mgmt/logreader/impl/v23_internal_test.go
new file mode 100644
index 0000000..f3c1179
--- /dev/null
+++ b/services/mgmt/logreader/impl/v23_internal_test.go
@@ -0,0 +1,17 @@
+// Copyright 2015 The Vanadium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+// This file was auto-generated via go generate.
+// DO NOT UPDATE MANUALLY
+package impl
+
+import "testing"
+import "os"
+
+import "v.io/x/ref/test"
+
+func TestMain(m *testing.M) {
+	test.Init()
+	os.Exit(m.Run())
+}
diff --git a/services/mgmt/pprof/client/proxy_test.go b/services/mgmt/pprof/client/proxy_test.go
index 2a8eab1..052e8dc 100644
--- a/services/mgmt/pprof/client/proxy_test.go
+++ b/services/mgmt/pprof/client/proxy_test.go
@@ -19,6 +19,8 @@
 	"v.io/x/ref/test"
 )
 
+//go:generate v23 test generate
+
 type dispatcher struct {
 	server interface{}
 }
diff --git a/services/mgmt/pprof/client/v23_internal_test.go b/services/mgmt/pprof/client/v23_internal_test.go
new file mode 100644
index 0000000..245e39a
--- /dev/null
+++ b/services/mgmt/pprof/client/v23_internal_test.go
@@ -0,0 +1,17 @@
+// Copyright 2015 The Vanadium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+// This file was auto-generated via go generate.
+// DO NOT UPDATE MANUALLY
+package client
+
+import "testing"
+import "os"
+
+import "v.io/x/ref/test"
+
+func TestMain(m *testing.M) {
+	test.Init()
+	os.Exit(m.Run())
+}
diff --git a/services/mgmt/profile/impl/impl_test.go b/services/mgmt/profile/impl/impl_test.go
index cd167d8..1f9583d 100644
--- a/services/mgmt/profile/impl/impl_test.go
+++ b/services/mgmt/profile/impl/impl_test.go
@@ -32,6 +32,8 @@
 	}
 )
 
+//go:generate v23 test generate
+
 // TestInterface tests that the implementation correctly implements
 // the Profile interface.
 func TestInterface(t *testing.T) {
diff --git a/services/mgmt/profile/impl/v23_internal_test.go b/services/mgmt/profile/impl/v23_internal_test.go
new file mode 100644
index 0000000..f3c1179
--- /dev/null
+++ b/services/mgmt/profile/impl/v23_internal_test.go
@@ -0,0 +1,17 @@
+// Copyright 2015 The Vanadium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+// This file was auto-generated via go generate.
+// DO NOT UPDATE MANUALLY
+package impl
+
+import "testing"
+import "os"
+
+import "v.io/x/ref/test"
+
+func TestMain(m *testing.M) {
+	test.Init()
+	os.Exit(m.Run())
+}
diff --git a/services/mgmt/stats/impl/stats_test.go b/services/mgmt/stats/impl/stats_test.go
index 2ba9b00..02e2f7c 100644
--- a/services/mgmt/stats/impl/stats_test.go
+++ b/services/mgmt/stats/impl/stats_test.go
@@ -27,6 +27,8 @@
 	"v.io/x/ref/test/testutil"
 )
 
+//go:generate v23 test generate
+
 type statsDispatcher struct {
 }
 
diff --git a/services/mgmt/stats/impl/v23_internal_test.go b/services/mgmt/stats/impl/v23_internal_test.go
new file mode 100644
index 0000000..f3c1179
--- /dev/null
+++ b/services/mgmt/stats/impl/v23_internal_test.go
@@ -0,0 +1,17 @@
+// Copyright 2015 The Vanadium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+// This file was auto-generated via go generate.
+// DO NOT UPDATE MANUALLY
+package impl
+
+import "testing"
+import "os"
+
+import "v.io/x/ref/test"
+
+func TestMain(m *testing.M) {
+	test.Init()
+	os.Exit(m.Run())
+}
diff --git a/services/mgmt/vtrace/impl/v23_internal_test.go b/services/mgmt/vtrace/impl/v23_internal_test.go
new file mode 100644
index 0000000..f3c1179
--- /dev/null
+++ b/services/mgmt/vtrace/impl/v23_internal_test.go
@@ -0,0 +1,17 @@
+// Copyright 2015 The Vanadium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+// This file was auto-generated via go generate.
+// DO NOT UPDATE MANUALLY
+package impl
+
+import "testing"
+import "os"
+
+import "v.io/x/ref/test"
+
+func TestMain(m *testing.M) {
+	test.Init()
+	os.Exit(m.Run())
+}
diff --git a/services/mgmt/vtrace/impl/vtrace_test.go b/services/mgmt/vtrace/impl/vtrace_test.go
index 5e770f1..1084e5f 100644
--- a/services/mgmt/vtrace/impl/vtrace_test.go
+++ b/services/mgmt/vtrace/impl/vtrace_test.go
@@ -17,6 +17,8 @@
 	"v.io/x/ref/test"
 )
 
+//go:generate v23 test generate
+
 func TestVtraceServer(t *testing.T) {
 	ctx, shutdown := test.InitForTest()
 	defer shutdown()
diff --git a/services/security/groups/server/server_test.go b/services/security/groups/server/server_test.go
index 666a156..ece1dc8 100644
--- a/services/security/groups/server/server_test.go
+++ b/services/security/groups/server/server_test.go
@@ -24,6 +24,8 @@
 	"v.io/x/ref/test/testutil"
 )
 
+//go:generate v23 test generate
+
 func getEntriesOrDie(g groups.GroupClientStub, ctx *context.T, t *testing.T) map[groups.BlessingPatternChunk]struct{} {
 	res, _, err := g.Get(ctx, groups.GetRequest{}, "")
 	if err != nil {
diff --git a/services/security/groups/server/v23_internal_test.go b/services/security/groups/server/v23_internal_test.go
new file mode 100644
index 0000000..34970b5
--- /dev/null
+++ b/services/security/groups/server/v23_internal_test.go
@@ -0,0 +1,17 @@
+// Copyright 2015 The Vanadium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+// This file was auto-generated via go generate.
+// DO NOT UPDATE MANUALLY
+package server
+
+import "testing"
+import "os"
+
+import "v.io/x/ref/test"
+
+func TestMain(m *testing.M) {
+	test.Init()
+	os.Exit(m.Run())
+}
diff --git a/services/wsprd/app/app_test.go b/services/wsprd/app/app_test.go
index 8c75b0a..c6ea428 100644
--- a/services/wsprd/app/app_test.go
+++ b/services/wsprd/app/app_test.go
@@ -35,6 +35,8 @@
 	"v.io/x/ref/test/testutil"
 )
 
+//go:generate v23 test generate
+
 var testPrincipal = testutil.NewPrincipal("test")
 
 // newBlessedPrincipal returns a new principal that has a blessing from the
diff --git a/services/wsprd/app/v23_internal_test.go b/services/wsprd/app/v23_internal_test.go
new file mode 100644
index 0000000..9ae5683
--- /dev/null
+++ b/services/wsprd/app/v23_internal_test.go
@@ -0,0 +1,17 @@
+// Copyright 2015 The Vanadium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+// This file was auto-generated via go generate.
+// DO NOT UPDATE MANUALLY
+package app
+
+import "testing"
+import "os"
+
+import "v.io/x/ref/test"
+
+func TestMain(m *testing.M) {
+	test.Init()
+	os.Exit(m.Run())
+}