mv x/ref/lib/testutil -> x/ref/test and lib/modules to test/modules
MultiPart: 1/7

Change-Id: Ib459a414c595afa48d31f78ee1a8165c2ae933ea
diff --git a/profiles/fake/runtime.go b/profiles/fake/runtime.go
index 6a2e458..c947546 100644
--- a/profiles/fake/runtime.go
+++ b/profiles/fake/runtime.go
@@ -8,7 +8,7 @@
 	"v.io/v23/context"
 	"v.io/v23/security"
 
-	tsecurity "v.io/x/ref/lib/testutil/security"
+	tsecurity "v.io/x/ref/test/security"
 )
 
 type contextKey int
diff --git a/profiles/internal/ipc/benchmark/benchmark/main.go b/profiles/internal/ipc/benchmark/benchmark/main.go
index 71190f5..118005e 100644
--- a/profiles/internal/ipc/benchmark/benchmark/main.go
+++ b/profiles/internal/ipc/benchmark/benchmark/main.go
@@ -8,9 +8,9 @@
 	"testing"
 	"time"
 
-	tbm "v.io/x/ref/lib/testutil/benchmark"
 	_ "v.io/x/ref/profiles"
 	"v.io/x/ref/profiles/internal/ipc/benchmark/internal"
+	tbm "v.io/x/ref/test/benchmark"
 
 	"v.io/v23"
 	"v.io/x/lib/vlog"
diff --git a/profiles/internal/ipc/benchmark/benchmark_test.go b/profiles/internal/ipc/benchmark/benchmark_test.go
index f788349..ce11b2c 100644
--- a/profiles/internal/ipc/benchmark/benchmark_test.go
+++ b/profiles/internal/ipc/benchmark/benchmark_test.go
@@ -7,10 +7,10 @@
 	"v.io/v23"
 	"v.io/v23/context"
 
-	"v.io/x/ref/lib/testutil"
-	"v.io/x/ref/lib/testutil/benchmark"
 	"v.io/x/ref/profiles/internal/ipc/benchmark/internal"
 	_ "v.io/x/ref/profiles/static"
+	"v.io/x/ref/test"
+	"v.io/x/ref/test/benchmark"
 )
 
 var (
@@ -105,7 +105,7 @@
 	// We do not use defer here since this program will exit at the end of
 	// this function through os.Exit().
 	var shutdown v23.Shutdown
-	ctx, shutdown = testutil.InitForTest()
+	ctx, shutdown = test.InitForTest()
 
 	var serverStop func()
 	serverAddr, serverStop = internal.StartServer(ctx, v23.GetListenSpec(ctx))
diff --git a/profiles/internal/ipc/benchmark/glob/glob_test.go b/profiles/internal/ipc/benchmark/glob/glob_test.go
index ce83d50..ed82ae4 100644
--- a/profiles/internal/ipc/benchmark/glob/glob_test.go
+++ b/profiles/internal/ipc/benchmark/glob/glob_test.go
@@ -10,8 +10,8 @@
 	"v.io/v23/naming"
 	"v.io/v23/security"
 
-	"v.io/x/ref/lib/testutil"
 	_ "v.io/x/ref/profiles"
+	"v.io/x/ref/test"
 )
 
 func TestNothing(t *testing.T) {
@@ -155,7 +155,7 @@
 }
 
 func RunBenchmarkGlob(b *testing.B, obj interface{}) {
-	ctx, shutdown := testutil.InitForTest()
+	ctx, shutdown := test.InitForTest()
 	defer shutdown()
 
 	addr, stop, err := startServer(b, ctx, obj)
diff --git a/profiles/internal/ipc/benchmark/internal/client.go b/profiles/internal/ipc/benchmark/internal/client.go
index f8534b2..54fbfc6 100644
--- a/profiles/internal/ipc/benchmark/internal/client.go
+++ b/profiles/internal/ipc/benchmark/internal/client.go
@@ -9,8 +9,8 @@
 	"v.io/v23/context"
 	"v.io/x/lib/vlog"
 
-	tbm "v.io/x/ref/lib/testutil/benchmark"
 	"v.io/x/ref/profiles/internal/ipc/benchmark"
+	tbm "v.io/x/ref/test/benchmark"
 )
 
 // CallEcho calls 'Echo' method 'iterations' times with the given payload size.
diff --git a/profiles/internal/ipc/cancel_test.go b/profiles/internal/ipc/cancel_test.go
index 4154aaa..43c0ea5 100644
--- a/profiles/internal/ipc/cancel_test.go
+++ b/profiles/internal/ipc/cancel_test.go
@@ -3,10 +3,10 @@
 import (
 	"testing"
 
-	tsecurity "v.io/x/ref/lib/testutil/security"
 	"v.io/x/ref/profiles/internal/ipc/stream"
 	"v.io/x/ref/profiles/internal/ipc/stream/manager"
 	tnaming "v.io/x/ref/profiles/internal/testing/mocks/naming"
+	tsecurity "v.io/x/ref/test/security"
 
 	"v.io/v23/context"
 	"v.io/v23/ipc"
diff --git a/profiles/internal/ipc/debug_test.go b/profiles/internal/ipc/debug_test.go
index 502995d..d7aedb6 100644
--- a/profiles/internal/ipc/debug_test.go
+++ b/profiles/internal/ipc/debug_test.go
@@ -12,11 +12,11 @@
 	"v.io/x/lib/vlog"
 
 	"v.io/x/ref/lib/stats"
-	tsecurity "v.io/x/ref/lib/testutil/security"
 	"v.io/x/ref/profiles/internal/ipc/stream/manager"
 	"v.io/x/ref/profiles/internal/ipc/stream/vc"
 	tnaming "v.io/x/ref/profiles/internal/testing/mocks/naming"
 	"v.io/x/ref/services/mgmt/debug"
+	tsecurity "v.io/x/ref/test/security"
 )
 
 func TestDebugServer(t *testing.T) {
diff --git a/profiles/internal/ipc/default_authorizer_test.go b/profiles/internal/ipc/default_authorizer_test.go
index 7ea28f5..4a30698 100644
--- a/profiles/internal/ipc/default_authorizer_test.go
+++ b/profiles/internal/ipc/default_authorizer_test.go
@@ -4,7 +4,7 @@
 	"testing"
 
 	"v.io/v23/security"
-	tsecurity "v.io/x/ref/lib/testutil/security"
+	tsecurity "v.io/x/ref/test/security"
 )
 
 func TestDefaultAuthorizer(t *testing.T) {
diff --git a/profiles/internal/ipc/discharges_test.go b/profiles/internal/ipc/discharges_test.go
index 230b8bf..4250605 100644
--- a/profiles/internal/ipc/discharges_test.go
+++ b/profiles/internal/ipc/discharges_test.go
@@ -4,7 +4,7 @@
 	"testing"
 	"time"
 
-	tsecurity "v.io/x/ref/lib/testutil/security"
+	tsecurity "v.io/x/ref/test/security"
 
 	"v.io/v23/security"
 	"v.io/v23/vdl"
diff --git a/profiles/internal/ipc/full_test.go b/profiles/internal/ipc/full_test.go
index d6d9da7..f964e97 100644
--- a/profiles/internal/ipc/full_test.go
+++ b/profiles/internal/ipc/full_test.go
@@ -32,8 +32,6 @@
 	"v.io/x/lib/netstate"
 	"v.io/x/ref/lib/flags"
 	"v.io/x/ref/lib/stats"
-	tsecurity "v.io/x/ref/lib/testutil/security"
-	"v.io/x/ref/lib/testutil/testutil"
 	_ "v.io/x/ref/profiles/internal/ipc/protocols/tcp"
 	_ "v.io/x/ref/profiles/internal/ipc/protocols/ws"
 	_ "v.io/x/ref/profiles/internal/ipc/protocols/wsh"
@@ -44,6 +42,8 @@
 	inaming "v.io/x/ref/profiles/internal/naming"
 	tnaming "v.io/x/ref/profiles/internal/testing/mocks/naming"
 	ivtrace "v.io/x/ref/profiles/internal/vtrace"
+	tsecurity "v.io/x/ref/test/security"
+	"v.io/x/ref/test/testutil"
 )
 
 //go:generate v23 test generate
diff --git a/profiles/internal/ipc/resolve_test.go b/profiles/internal/ipc/resolve_test.go
index 95a47db..ae33d34 100644
--- a/profiles/internal/ipc/resolve_test.go
+++ b/profiles/internal/ipc/resolve_test.go
@@ -12,16 +12,16 @@
 	"v.io/v23/naming"
 
 	"v.io/x/ref/lib/flags"
-	"v.io/x/ref/lib/modules"
-	"v.io/x/ref/lib/modules/core"
-	"v.io/x/ref/lib/testutil"
-	"v.io/x/ref/lib/testutil/expect"
 	"v.io/x/ref/profiles/fake"
 	"v.io/x/ref/profiles/internal"
 	iipc "v.io/x/ref/profiles/internal/ipc"
 	"v.io/x/ref/profiles/internal/lib/appcycle"
 	inaming "v.io/x/ref/profiles/internal/naming"
 	grt "v.io/x/ref/profiles/internal/rt"
+	"v.io/x/ref/test"
+	"v.io/x/ref/test/expect"
+	"v.io/x/ref/test/modules"
+	"v.io/x/ref/test/modules/core"
 )
 
 var commonFlags *flags.Flags
@@ -74,7 +74,7 @@
 	defer sh.Cleanup(nil, nil)
 	root := startMT(t, sh)
 
-	ctx, shutdown := testutil.InitForTest()
+	ctx, shutdown := test.InitForTest()
 	defer shutdown()
 
 	ns := v23.GetNamespace(ctx)
diff --git a/profiles/internal/ipc/results_store_test.go b/profiles/internal/ipc/results_store_test.go
index 757f344..108f025 100644
--- a/profiles/internal/ipc/results_store_test.go
+++ b/profiles/internal/ipc/results_store_test.go
@@ -5,7 +5,7 @@
 	"sync"
 	"testing"
 
-	"v.io/x/ref/lib/testutil/testutil"
+	"v.io/x/ref/test/testutil"
 )
 
 func randomKeys() []uint64 {
diff --git a/profiles/internal/ipc/server_authorizer_test.go b/profiles/internal/ipc/server_authorizer_test.go
index 7e48d4a..04269ce 100644
--- a/profiles/internal/ipc/server_authorizer_test.go
+++ b/profiles/internal/ipc/server_authorizer_test.go
@@ -3,7 +3,7 @@
 import (
 	"testing"
 
-	tsecurity "v.io/x/ref/lib/testutil/security"
+	tsecurity "v.io/x/ref/test/security"
 
 	"v.io/v23/options"
 	"v.io/v23/security"
diff --git a/profiles/internal/ipc/server_test.go b/profiles/internal/ipc/server_test.go
index b43c634..37cbc17 100644
--- a/profiles/internal/ipc/server_test.go
+++ b/profiles/internal/ipc/server_test.go
@@ -16,11 +16,11 @@
 	"v.io/x/lib/vlog"
 
 	"v.io/x/lib/netstate"
-	tsecurity "v.io/x/ref/lib/testutil/security"
 	imanager "v.io/x/ref/profiles/internal/ipc/stream/manager"
 	"v.io/x/ref/profiles/internal/ipc/stream/vc"
 	inaming "v.io/x/ref/profiles/internal/naming"
 	tnaming "v.io/x/ref/profiles/internal/testing/mocks/naming"
+	tsecurity "v.io/x/ref/test/security"
 )
 
 type noMethodsType struct{ Field string }
diff --git a/profiles/internal/ipc/stream/benchmark/benchmark_test.go b/profiles/internal/ipc/stream/benchmark/benchmark_test.go
index 4b62a27..d7b5f79 100644
--- a/profiles/internal/ipc/stream/benchmark/benchmark_test.go
+++ b/profiles/internal/ipc/stream/benchmark/benchmark_test.go
@@ -4,7 +4,7 @@
 	"os"
 	"testing"
 
-	"v.io/x/ref/lib/testutil/benchmark"
+	"v.io/x/ref/test/benchmark"
 )
 
 // A single empty test to avoid:
diff --git a/profiles/internal/ipc/stream/benchmark/dial_vc.go b/profiles/internal/ipc/stream/benchmark/dial_vc.go
index ca94f11..1b42060 100644
--- a/profiles/internal/ipc/stream/benchmark/dial_vc.go
+++ b/profiles/internal/ipc/stream/benchmark/dial_vc.go
@@ -4,10 +4,10 @@
 	"testing"
 	"time"
 
-	"v.io/x/ref/lib/testutil/benchmark"
-	tsecurity "v.io/x/ref/lib/testutil/security"
 	"v.io/x/ref/profiles/internal/ipc/stream/manager"
 	_ "v.io/x/ref/profiles/static"
+	"v.io/x/ref/test/benchmark"
+	tsecurity "v.io/x/ref/test/security"
 
 	"v.io/v23/naming"
 	"v.io/v23/options"
diff --git a/profiles/internal/ipc/stream/benchmark/dial_vif.go b/profiles/internal/ipc/stream/benchmark/dial_vif.go
index fd1d47e..7224c8e 100644
--- a/profiles/internal/ipc/stream/benchmark/dial_vif.go
+++ b/profiles/internal/ipc/stream/benchmark/dial_vif.go
@@ -5,9 +5,9 @@
 	"testing"
 	"time"
 
-	"v.io/x/ref/lib/testutil/benchmark"
-	tsecurity "v.io/x/ref/lib/testutil/security"
 	"v.io/x/ref/profiles/internal/ipc/stream/vif"
+	"v.io/x/ref/test/benchmark"
+	tsecurity "v.io/x/ref/test/security"
 
 	"v.io/v23/naming"
 	"v.io/v23/options"
diff --git a/profiles/internal/ipc/stream/benchmark/throughput_flow.go b/profiles/internal/ipc/stream/benchmark/throughput_flow.go
index 82e4b9c..d102382 100644
--- a/profiles/internal/ipc/stream/benchmark/throughput_flow.go
+++ b/profiles/internal/ipc/stream/benchmark/throughput_flow.go
@@ -8,8 +8,8 @@
 
 	"v.io/v23/naming"
 	"v.io/v23/options"
-	tsecurity "v.io/x/ref/lib/testutil/security"
 	"v.io/x/ref/profiles/internal/ipc/stream"
+	tsecurity "v.io/x/ref/test/security"
 )
 
 const (
diff --git a/profiles/internal/ipc/stream/manager/manager_test.go b/profiles/internal/ipc/stream/manager/manager_test.go
index 3d7a1a5..bf6e893 100644
--- a/profiles/internal/ipc/stream/manager/manager_test.go
+++ b/profiles/internal/ipc/stream/manager/manager_test.go
@@ -13,22 +13,23 @@
 	"testing"
 	"time"
 
+	"v.io/x/lib/vlog"
+
 	"v.io/v23/ipc"
 	"v.io/v23/naming"
 	"v.io/v23/options"
 	"v.io/v23/security"
-	"v.io/x/lib/vlog"
-	"v.io/x/ref/profiles/internal/ipc/stream"
 
-	"v.io/x/ref/lib/modules"
-	"v.io/x/ref/lib/testutil"
-	"v.io/x/ref/lib/testutil/expect"
-	tsecurity "v.io/x/ref/lib/testutil/security"
 	_ "v.io/x/ref/profiles/internal/ipc/protocols/tcp"
 	_ "v.io/x/ref/profiles/internal/ipc/protocols/ws"
+	"v.io/x/ref/profiles/internal/ipc/stream"
 	"v.io/x/ref/profiles/internal/ipc/stream/vc"
 	"v.io/x/ref/profiles/internal/ipc/version"
 	inaming "v.io/x/ref/profiles/internal/naming"
+	"v.io/x/ref/test"
+	"v.io/x/ref/test/expect"
+	"v.io/x/ref/test/modules"
+	tsecurity "v.io/x/ref/test/security"
 )
 
 func init() {
@@ -38,7 +39,7 @@
 // We write our own TestMain here instead of relying on v23 test generate because
 // we need to set runtime.GOMAXPROCS.
 func TestMain(m *testing.M) {
-	testutil.Init()
+	test.Init()
 	// testutil.Init sets GOMAXPROCS to NumCPU.  We want to force
 	// GOMAXPROCS to remain at 1, in order to trigger a particular race
 	// condition that occurs when closing the server; also, using 1 cpu
diff --git a/profiles/internal/ipc/stream/proxy/proxy_test.go b/profiles/internal/ipc/stream/proxy/proxy_test.go
index cc6d906..26123d6 100644
--- a/profiles/internal/ipc/stream/proxy/proxy_test.go
+++ b/profiles/internal/ipc/stream/proxy/proxy_test.go
@@ -11,10 +11,10 @@
 	"v.io/v23/naming"
 	"v.io/x/ref/profiles/internal/ipc/stream"
 
-	tsecurity "v.io/x/ref/lib/testutil/security"
 	_ "v.io/x/ref/profiles"
 	"v.io/x/ref/profiles/internal/ipc/stream/manager"
 	"v.io/x/ref/profiles/internal/ipc/stream/proxy"
+	tsecurity "v.io/x/ref/test/security"
 )
 
 //go:generate v23 test generate
diff --git a/profiles/internal/ipc/stream/proxy/v23_internal_test.go b/profiles/internal/ipc/stream/proxy/v23_internal_test.go
index cea70bf..84bea54 100644
--- a/profiles/internal/ipc/stream/proxy/v23_internal_test.go
+++ b/profiles/internal/ipc/stream/proxy/v23_internal_test.go
@@ -9,9 +9,9 @@
 import "testing"
 import "os"
 
-import "v.io/x/ref/lib/testutil"
+import "v.io/x/ref/test"
 
 func TestMain(m *testing.M) {
-	testutil.Init()
+	test.Init()
 	os.Exit(m.Run())
 }
diff --git a/profiles/internal/ipc/stream/vc/v23_internal_test.go b/profiles/internal/ipc/stream/vc/v23_internal_test.go
index bfe8e63..945d8c4 100644
--- a/profiles/internal/ipc/stream/vc/v23_internal_test.go
+++ b/profiles/internal/ipc/stream/vc/v23_internal_test.go
@@ -9,9 +9,9 @@
 import "testing"
 import "os"
 
-import "v.io/x/ref/lib/testutil"
+import "v.io/x/ref/test"
 
 func TestMain(m *testing.M) {
-	testutil.Init()
+	test.Init()
 	os.Exit(m.Run())
 }
diff --git a/profiles/internal/ipc/stream/vc/vc_test.go b/profiles/internal/ipc/stream/vc/vc_test.go
index 9310a5c..7d634ae 100644
--- a/profiles/internal/ipc/stream/vc/vc_test.go
+++ b/profiles/internal/ipc/stream/vc/vc_test.go
@@ -22,14 +22,14 @@
 
 	"v.io/x/lib/vlog"
 
-	tsecurity "v.io/x/ref/lib/testutil/security"
-	"v.io/x/ref/lib/testutil/testutil"
 	"v.io/x/ref/profiles/internal/ipc/stream"
 	"v.io/x/ref/profiles/internal/ipc/stream/id"
 	"v.io/x/ref/profiles/internal/ipc/stream/vc"
 	"v.io/x/ref/profiles/internal/lib/bqueue"
 	"v.io/x/ref/profiles/internal/lib/bqueue/drrqueue"
 	"v.io/x/ref/profiles/internal/lib/iobuf"
+	tsecurity "v.io/x/ref/test/security"
+	"v.io/x/ref/test/testutil"
 )
 
 var (
diff --git a/profiles/internal/ipc/stream/vif/set_test.go b/profiles/internal/ipc/stream/vif/set_test.go
index e00a51b..ca53318 100644
--- a/profiles/internal/ipc/stream/vif/set_test.go
+++ b/profiles/internal/ipc/stream/vif/set_test.go
@@ -12,9 +12,9 @@
 	"v.io/v23/ipc"
 	"v.io/v23/naming"
 
-	tsecurity "v.io/x/ref/lib/testutil/security"
 	_ "v.io/x/ref/profiles"
 	"v.io/x/ref/profiles/internal/ipc/stream/vif"
+	tsecurity "v.io/x/ref/test/security"
 )
 
 var supportsIPv6 bool
diff --git a/profiles/internal/ipc/stream/vif/v23_internal_test.go b/profiles/internal/ipc/stream/vif/v23_internal_test.go
index 380f691..161553c 100644
--- a/profiles/internal/ipc/stream/vif/v23_internal_test.go
+++ b/profiles/internal/ipc/stream/vif/v23_internal_test.go
@@ -9,9 +9,9 @@
 import "testing"
 import "os"
 
-import "v.io/x/ref/lib/testutil"
+import "v.io/x/ref/test"
 
 func TestMain(m *testing.M) {
-	testutil.Init()
+	test.Init()
 	os.Exit(m.Run())
 }
diff --git a/profiles/internal/ipc/stream/vif/vif_test.go b/profiles/internal/ipc/stream/vif/vif_test.go
index 38ad2bb..cf99618 100644
--- a/profiles/internal/ipc/stream/vif/vif_test.go
+++ b/profiles/internal/ipc/stream/vif/vif_test.go
@@ -19,11 +19,11 @@
 	"v.io/v23/ipc/version"
 	"v.io/v23/naming"
 
-	tsecurity "v.io/x/ref/lib/testutil/security"
-	"v.io/x/ref/lib/testutil/testutil"
 	"v.io/x/ref/profiles/internal/ipc/stream/vc"
 	"v.io/x/ref/profiles/internal/ipc/stream/vif"
 	iversion "v.io/x/ref/profiles/internal/ipc/version"
+	tsecurity "v.io/x/ref/test/security"
+	"v.io/x/ref/test/testutil"
 
 	"v.io/x/ref/profiles/internal/ipc/stream"
 )
diff --git a/profiles/internal/ipc/test/client_test.go b/profiles/internal/ipc/test/client_test.go
index a5a2156..30fd356 100644
--- a/profiles/internal/ipc/test/client_test.go
+++ b/profiles/internal/ipc/test/client_test.go
@@ -10,30 +10,29 @@
 	"testing"
 	"time"
 
+	"v.io/x/lib/vlog"
+
 	"v.io/v23"
 	"v.io/v23/context"
 	"v.io/v23/ipc"
 	"v.io/v23/naming"
 	"v.io/v23/options"
 	"v.io/v23/verror"
-	"v.io/x/lib/vlog"
 
 	"v.io/x/ref/lib/flags/consts"
-	"v.io/x/ref/lib/modules"
-	"v.io/x/ref/lib/modules/core"
-	"v.io/x/ref/lib/testutil"
-	"v.io/x/ref/lib/testutil/expect"
-	tsecurity "v.io/x/ref/lib/testutil/security"
 	_ "v.io/x/ref/profiles"
 	inaming "v.io/x/ref/profiles/internal/naming"
+	"v.io/x/ref/test"
+	"v.io/x/ref/test/expect"
+	"v.io/x/ref/test/modules"
+	"v.io/x/ref/test/modules/core"
+	tsecurity "v.io/x/ref/test/security"
 )
 
-func init() {
-	modules.RegisterChild("ping", "<name>", childPing)
-}
+//go:generate v23 test generate .
 
 func newCtx() (*context.T, v23.Shutdown) {
-	ctx, shutdown := testutil.InitForTest()
+	ctx, shutdown := test.InitForTest()
 	v23.GetNamespace(ctx).CacheCtl(naming.DisableCache(true))
 	return ctx, shutdown
 }
@@ -165,7 +164,7 @@
 }
 
 func childPing(stdin io.Reader, stdout, stderr io.Writer, env map[string]string, args ...string) error {
-	ctx, shutdown := testutil.InitForTest()
+	ctx, shutdown := test.InitForTest()
 	defer shutdown()
 	v23.GetNamespace(ctx).CacheCtl(naming.DisableCache(true))
 
@@ -252,7 +251,7 @@
 }
 
 func TestAccessDenied(t *testing.T) {
-	ctx, shutdown := testutil.InitForTest()
+	ctx, shutdown := test.InitForTest()
 	defer shutdown()
 
 	name, fn := initServer(t, ctx)
@@ -352,7 +351,7 @@
 	name, fn := initServer(t, ctx)
 	defer fn()
 
-	srv, err := sh.Start("ping", nil, name)
+	srv, err := sh.Start("childPing", nil, name)
 	if err != nil {
 		t.Fatalf("unexpected error: %s", err)
 	}
@@ -460,7 +459,8 @@
 // connection to the server if the server dies and comes back (on the same
 // endpoint).
 func TestReconnect(t *testing.T) {
-	ctx, shutdown := testutil.InitForTest()
+	t.Skip()
+	ctx, shutdown := test.InitForTest()
 	defer shutdown()
 
 	sh, err := modules.NewShell(ctx, v23.GetPrincipal(ctx))
diff --git a/profiles/internal/ipc/test/glob_test.go b/profiles/internal/ipc/test/glob_test.go
index 760fbb1..239ee70 100644
--- a/profiles/internal/ipc/test/glob_test.go
+++ b/profiles/internal/ipc/test/glob_test.go
@@ -17,9 +17,9 @@
 	"v.io/v23/verror"
 
 	"v.io/x/ref/lib/glob"
-	test "v.io/x/ref/lib/testutil"
-	"v.io/x/ref/lib/testutil/testutil"
 	_ "v.io/x/ref/profiles"
+	"v.io/x/ref/test"
+	"v.io/x/ref/test/testutil"
 )
 
 func startGlobServer(ctx *context.T, tree *node) (string, func(), error) {
diff --git a/profiles/internal/ipc/test/proxy_test.go b/profiles/internal/ipc/test/proxy_test.go
index 95310b0..0744417 100644
--- a/profiles/internal/ipc/test/proxy_test.go
+++ b/profiles/internal/ipc/test/proxy_test.go
@@ -21,9 +21,6 @@
 	"v.io/v23/vtrace"
 
 	"v.io/x/ref/lib/flags"
-	"v.io/x/ref/lib/modules"
-	"v.io/x/ref/lib/testutil/expect"
-	tsecurity "v.io/x/ref/lib/testutil/security"
 	_ "v.io/x/ref/profiles"
 	iipc "v.io/x/ref/profiles/internal/ipc"
 	imanager "v.io/x/ref/profiles/internal/ipc/stream/manager"
@@ -33,6 +30,9 @@
 	inaming "v.io/x/ref/profiles/internal/naming"
 	tnaming "v.io/x/ref/profiles/internal/testing/mocks/naming"
 	ivtrace "v.io/x/ref/profiles/internal/vtrace"
+	"v.io/x/ref/test/expect"
+	"v.io/x/ref/test/modules"
+	tsecurity "v.io/x/ref/test/security"
 )
 
 func testContext() (*context.T, func()) {
diff --git a/profiles/internal/ipc/test/signature_test.go b/profiles/internal/ipc/test/signature_test.go
index 293f2f9..781a307 100644
--- a/profiles/internal/ipc/test/signature_test.go
+++ b/profiles/internal/ipc/test/signature_test.go
@@ -13,8 +13,8 @@
 	"v.io/v23/vdl"
 	"v.io/v23/vdlroot/signature"
 
-	"v.io/x/ref/lib/testutil"
 	_ "v.io/x/ref/profiles"
+	"v.io/x/ref/test"
 )
 
 func startSigServer(ctx *context.T, sig sigImpl) (string, func(), error) {
@@ -56,7 +56,7 @@
 }
 
 func TestMethodSignature(t *testing.T) {
-	ctx, shutdown := testutil.InitForTest()
+	ctx, shutdown := test.InitForTest()
 	defer shutdown()
 	ep, stop, err := startSigServer(ctx, sigImpl{})
 	if err != nil {
@@ -102,7 +102,7 @@
 }
 
 func TestSignature(t *testing.T) {
-	ctx, shutdown := testutil.InitForTest()
+	ctx, shutdown := test.InitForTest()
 	defer shutdown()
 	ep, stop, err := startSigServer(ctx, sigImpl{})
 	if err != nil {
diff --git a/profiles/internal/ipc/test/v23_test.go b/profiles/internal/ipc/test/v23_internal_test.go
similarity index 88%
rename from profiles/internal/ipc/test/v23_test.go
rename to profiles/internal/ipc/test/v23_internal_test.go
index 3c00214..082fdf0 100644
--- a/profiles/internal/ipc/test/v23_test.go
+++ b/profiles/internal/ipc/test/v23_internal_test.go
@@ -10,8 +10,8 @@
 import "testing"
 import "os"
 
-import "v.io/x/ref/lib/modules"
-import "v.io/x/ref/lib/testutil"
+import "v.io/x/ref/test"
+import "v.io/x/ref/test/modules"
 
 func init() {
 	modules.RegisterChild("childPing", ``, childPing)
@@ -19,7 +19,7 @@
 }
 
 func TestMain(m *testing.M) {
-	testutil.Init()
+	test.Init()
 	if modules.IsModulesChildProcess() {
 		if err := modules.Dispatch(); err != nil {
 			fmt.Fprintf(os.Stderr, "modules.Dispatch failed: %v\n", err)
diff --git a/profiles/internal/ipc/v23_internal_test.go b/profiles/internal/ipc/v23_internal_test.go
index 20b059a..9597c2e 100644
--- a/profiles/internal/ipc/v23_internal_test.go
+++ b/profiles/internal/ipc/v23_internal_test.go
@@ -10,11 +10,11 @@
 import "testing"
 import "os"
 
-import "v.io/x/ref/lib/modules"
-import "v.io/x/ref/lib/testutil"
+import "v.io/x/ref/test"
+import "v.io/x/ref/test/modules"
 
 func TestMain(m *testing.M) {
-	testutil.Init()
+	test.Init()
 	if modules.IsModulesChildProcess() {
 		if err := modules.Dispatch(); err != nil {
 			fmt.Fprintf(os.Stderr, "modules.Dispatch failed: %v\n", err)
diff --git a/profiles/internal/lib/deque/deque_test.go b/profiles/internal/lib/deque/deque_test.go
index 4906c2e..d1fbea2 100644
--- a/profiles/internal/lib/deque/deque_test.go
+++ b/profiles/internal/lib/deque/deque_test.go
@@ -3,7 +3,7 @@
 import (
 	"testing"
 
-	"v.io/x/ref/lib/testutil/testutil"
+	"v.io/x/ref/test/testutil"
 )
 
 //go:generate v23 test generate
diff --git a/profiles/internal/lib/deque/v23_internal_test.go b/profiles/internal/lib/deque/v23_internal_test.go
index 4381586..5091465 100644
--- a/profiles/internal/lib/deque/v23_internal_test.go
+++ b/profiles/internal/lib/deque/v23_internal_test.go
@@ -9,9 +9,9 @@
 import "testing"
 import "os"
 
-import "v.io/x/ref/lib/testutil"
+import "v.io/x/ref/test"
 
 func TestMain(m *testing.M) {
-	testutil.Init()
+	test.Init()
 	os.Exit(m.Run())
 }
diff --git a/profiles/internal/lib/pcqueue/v23_internal_test.go b/profiles/internal/lib/pcqueue/v23_internal_test.go
index 15b84d8..6475bd5 100644
--- a/profiles/internal/lib/pcqueue/v23_internal_test.go
+++ b/profiles/internal/lib/pcqueue/v23_internal_test.go
@@ -9,9 +9,9 @@
 import "testing"
 import "os"
 
-import "v.io/x/ref/lib/testutil"
+import "v.io/x/ref/test"
 
 func TestMain(m *testing.M) {
-	testutil.Init()
+	test.Init()
 	os.Exit(m.Run())
 }
diff --git a/profiles/internal/lib/publisher/v23_internal_test.go b/profiles/internal/lib/publisher/v23_internal_test.go
index 9c60f4c..399d8d5 100644
--- a/profiles/internal/lib/publisher/v23_internal_test.go
+++ b/profiles/internal/lib/publisher/v23_internal_test.go
@@ -9,9 +9,9 @@
 import "testing"
 import "os"
 
-import "v.io/x/ref/lib/testutil"
+import "v.io/x/ref/test"
 
 func TestMain(m *testing.M) {
-	testutil.Init()
+	test.Init()
 	os.Exit(m.Run())
 }
diff --git a/profiles/internal/lib/sync/v23_internal_test.go b/profiles/internal/lib/sync/v23_internal_test.go
index 1ad406c..008ca9f 100644
--- a/profiles/internal/lib/sync/v23_internal_test.go
+++ b/profiles/internal/lib/sync/v23_internal_test.go
@@ -9,9 +9,9 @@
 import "testing"
 import "os"
 
-import "v.io/x/ref/lib/testutil"
+import "v.io/x/ref/test"
 
 func TestMain(m *testing.M) {
-	testutil.Init()
+	test.Init()
 	os.Exit(m.Run())
 }
diff --git a/profiles/internal/lib/sync/wait_group_test.go b/profiles/internal/lib/sync/wait_group_test.go
index 8be3907..5b8bcbe 100644
--- a/profiles/internal/lib/sync/wait_group_test.go
+++ b/profiles/internal/lib/sync/wait_group_test.go
@@ -3,7 +3,7 @@
 import (
 	"testing"
 
-	"v.io/x/ref/lib/testutil/testutil"
+	"v.io/x/ref/test/testutil"
 )
 
 //go:generate v23 test generate
diff --git a/profiles/internal/lib/upcqueue/v23_internal_test.go b/profiles/internal/lib/upcqueue/v23_internal_test.go
index fe6dbaa..af1b3c8 100644
--- a/profiles/internal/lib/upcqueue/v23_internal_test.go
+++ b/profiles/internal/lib/upcqueue/v23_internal_test.go
@@ -9,9 +9,9 @@
 import "testing"
 import "os"
 
-import "v.io/x/ref/lib/testutil"
+import "v.io/x/ref/test"
 
 func TestMain(m *testing.M) {
-	testutil.Init()
+	test.Init()
 	os.Exit(m.Run())
 }
diff --git a/profiles/internal/lib/websocket/v23_internal_test.go b/profiles/internal/lib/websocket/v23_internal_test.go
index f942dfa..2051301 100644
--- a/profiles/internal/lib/websocket/v23_internal_test.go
+++ b/profiles/internal/lib/websocket/v23_internal_test.go
@@ -9,9 +9,9 @@
 import "testing"
 import "os"
 
-import "v.io/x/ref/lib/testutil"
+import "v.io/x/ref/test"
 
 func TestMain(m *testing.M) {
-	testutil.Init()
+	test.Init()
 	os.Exit(m.Run())
 }
diff --git a/profiles/internal/naming/namespace/acl_test.go b/profiles/internal/naming/namespace/acl_test.go
index 57361ef..7e7b0a7 100644
--- a/profiles/internal/naming/namespace/acl_test.go
+++ b/profiles/internal/naming/namespace/acl_test.go
@@ -12,18 +12,18 @@
 	"v.io/v23/security"
 	"v.io/v23/services/security/access"
 
-	"v.io/x/ref/lib/testutil"
-	tsecurity "v.io/x/ref/lib/testutil/security"
 	_ "v.io/x/ref/profiles"
 	service "v.io/x/ref/services/mounttable/lib"
+	"v.io/x/ref/test"
+	tsecurity "v.io/x/ref/test/security"
 )
 
 func init() {
-	testutil.Init()
+	test.Init()
 }
 
 func initTest() (rootCtx *context.T, aliceCtx *context.T, bobCtx *context.T, shutdown v23.Shutdown) {
-	ctx, shutdown := testutil.InitForTest()
+	ctx, shutdown := test.InitForTest()
 	var err error
 	if rootCtx, err = v23.SetPrincipal(ctx, tsecurity.NewPrincipal("root")); err != nil {
 		panic("failed to set root principal")
diff --git a/profiles/internal/naming/namespace/all_test.go b/profiles/internal/naming/namespace/all_test.go
index 7ea04ca..57fd5c7 100644
--- a/profiles/internal/naming/namespace/all_test.go
+++ b/profiles/internal/naming/namespace/all_test.go
@@ -18,13 +18,13 @@
 	"v.io/v23/verror"
 	"v.io/x/lib/vlog"
 
-	test "v.io/x/ref/lib/testutil"
-	tsecurity "v.io/x/ref/lib/testutil/security"
-	"v.io/x/ref/lib/testutil/testutil"
 	_ "v.io/x/ref/profiles"
 	"v.io/x/ref/profiles/internal/naming/namespace"
 	vsecurity "v.io/x/ref/security"
 	service "v.io/x/ref/services/mounttable/lib"
+	test "v.io/x/ref/test"
+	tsecurity "v.io/x/ref/test/security"
+	"v.io/x/ref/test/testutil"
 )
 
 //go:generate v23 test generate
diff --git a/profiles/internal/naming/namespace/v23_internal_test.go b/profiles/internal/naming/namespace/v23_internal_test.go
index 314919a..15b3504 100644
--- a/profiles/internal/naming/namespace/v23_internal_test.go
+++ b/profiles/internal/naming/namespace/v23_internal_test.go
@@ -9,9 +9,9 @@
 import "testing"
 import "os"
 
-import "v.io/x/ref/lib/testutil"
+import "v.io/x/ref/test"
 
 func TestMain(m *testing.M) {
-	testutil.Init()
+	test.Init()
 	os.Exit(m.Run())
 }
diff --git a/profiles/internal/rt/ipc_test.go b/profiles/internal/rt/ipc_test.go
index e6a9e93..178bcb1 100644
--- a/profiles/internal/rt/ipc_test.go
+++ b/profiles/internal/rt/ipc_test.go
@@ -16,10 +16,10 @@
 	"v.io/v23/security"
 
 	"v.io/v23/verror"
-	"v.io/x/ref/lib/testutil"
-	tsecurity "v.io/x/ref/lib/testutil/security"
 	_ "v.io/x/ref/profiles"
 	"v.io/x/ref/profiles/internal/ipc/stream/vc"
+	"v.io/x/ref/test"
+	tsecurity "v.io/x/ref/test/security"
 )
 
 //go:generate v23 test generate
@@ -96,7 +96,7 @@
 }
 
 func TestClientServerBlessings(t *testing.T) {
-	ctx, shutdown := testutil.InitForTest()
+	ctx, shutdown := test.InitForTest()
 	defer shutdown()
 
 	var (
@@ -188,7 +188,7 @@
 }
 
 func TestServerEndpointBlessingNames(t *testing.T) {
-	ctx, shutdown := testutil.InitForTest()
+	ctx, shutdown := test.InitForTest()
 	defer shutdown()
 	ctx, _ = v23.SetPrincipal(ctx, tsecurity.NewPrincipal("default"))
 
@@ -281,7 +281,7 @@
 }
 
 func TestServerDischarges(t *testing.T) {
-	ctx, shutdown := testutil.InitForTest()
+	ctx, shutdown := test.InitForTest()
 	defer shutdown()
 
 	var (
diff --git a/profiles/internal/rt/mgmt_test.go b/profiles/internal/rt/mgmt_test.go
index fe6a77f..28e48d5 100644
--- a/profiles/internal/rt/mgmt_test.go
+++ b/profiles/internal/rt/mgmt_test.go
@@ -16,12 +16,12 @@
 	"v.io/v23/naming"
 	"v.io/v23/services/mgmt/appcycle"
 
-	"v.io/x/ref/lib/modules"
-	"v.io/x/ref/lib/testutil"
-	"v.io/x/ref/lib/testutil/expect"
 	_ "v.io/x/ref/profiles"
 	vflag "v.io/x/ref/security/flag"
 	"v.io/x/ref/services/mgmt/device"
+	"v.io/x/ref/test"
+	"v.io/x/ref/test/expect"
+	"v.io/x/ref/test/modules"
 )
 
 //go:generate v23 test generate
@@ -35,7 +35,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) {
-	ctx, shutdown := testutil.InitForTest()
+	ctx, shutdown := test.InitForTest()
 	defer shutdown()
 
 	m := v23.GetAppCycle(ctx)
@@ -57,7 +57,7 @@
 // TestMultipleWaiters verifies that the plumbing works with more than one
 // registered wait channel.
 func TestMultipleWaiters(t *testing.T) {
-	ctx, shutdown := testutil.InitForTest()
+	ctx, shutdown := test.InitForTest()
 	defer shutdown()
 
 	m := v23.GetAppCycle(ctx)
@@ -80,7 +80,7 @@
 // channel is not being drained: once the channel's buffer fills up, future
 // Stops become no-ops.
 func TestMultipleStops(t *testing.T) {
-	ctx, shutdown := testutil.InitForTest()
+	ctx, shutdown := test.InitForTest()
 	defer shutdown()
 
 	m := v23.GetAppCycle(ctx)
@@ -100,7 +100,7 @@
 }
 
 func noWaiters(stdin io.Reader, stdout, stderr io.Writer, env map[string]string, args ...string) error {
-	ctx, shutdown := testutil.InitForTest()
+	ctx, shutdown := test.InitForTest()
 	defer shutdown()
 
 	m := v23.GetAppCycle(ctx)
@@ -131,7 +131,7 @@
 }
 
 func forceStop(stdin io.Reader, stdout, stderr io.Writer, env map[string]string, args ...string) error {
-	ctx, shutdown := testutil.InitForTest()
+	ctx, shutdown := test.InitForTest()
 	defer shutdown()
 
 	m := v23.GetAppCycle(ctx)
@@ -181,7 +181,7 @@
 // TestProgress verifies that the ticker update/track logic works for a single
 // tracker.
 func TestProgress(t *testing.T) {
-	ctx, shutdown := testutil.InitForTest()
+	ctx, shutdown := test.InitForTest()
 
 	m := v23.GetAppCycle(ctx)
 	m.AdvanceGoal(50)
@@ -213,7 +213,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) {
-	ctx, shutdown := testutil.InitForTest()
+	ctx, shutdown := test.InitForTest()
 
 	m := v23.GetAppCycle(ctx)
 	// ch1 is 1-buffered, ch2 is 2-buffered.
@@ -248,7 +248,7 @@
 }
 
 func app(stdin io.Reader, stdout, stderr io.Writer, env map[string]string, args ...string) error {
-	ctx, shutdown := testutil.InitForTest()
+	ctx, shutdown := test.InitForTest()
 	defer shutdown()
 
 	m := v23.GetAppCycle(ctx)
@@ -293,7 +293,7 @@
 }
 
 func setupRemoteAppCycleMgr(t *testing.T) (*context.T, modules.Handle, appcycle.AppCycleClientMethods, func()) {
-	ctx, shutdown := testutil.InitForTest()
+	ctx, shutdown := test.InitForTest()
 
 	configServer, configServiceName, ch := createConfigServer(t, ctx)
 	sh, err := modules.NewShell(ctx, v23.GetPrincipal(ctx))
diff --git a/profiles/internal/rt/rt_test.go b/profiles/internal/rt/rt_test.go
index 39a5f2f..7667bee 100644
--- a/profiles/internal/rt/rt_test.go
+++ b/profiles/internal/rt/rt_test.go
@@ -9,16 +9,17 @@
 	"testing"
 	"time"
 
-	"v.io/v23"
-	"v.io/v23/security"
 	"v.io/x/lib/vlog"
 
+	"v.io/v23"
+	"v.io/v23/security"
+
 	"v.io/x/ref/lib/flags/consts"
-	"v.io/x/ref/lib/modules"
-	test "v.io/x/ref/lib/testutil"
-	"v.io/x/ref/lib/testutil/expect"
-	"v.io/x/ref/lib/testutil/testutil"
 	vsecurity "v.io/x/ref/security"
+	"v.io/x/ref/test"
+	"v.io/x/ref/test/expect"
+	"v.io/x/ref/test/modules"
+	"v.io/x/ref/test/testutil"
 )
 
 //go:generate v23 test generate
diff --git a/profiles/internal/rt/runtime_test.go b/profiles/internal/rt/runtime_test.go
index 79569c2..ee7beb9 100644
--- a/profiles/internal/rt/runtime_test.go
+++ b/profiles/internal/rt/runtime_test.go
@@ -8,9 +8,9 @@
 	"v.io/v23/naming"
 
 	"v.io/x/ref/lib/flags"
-	tsecurity "v.io/x/ref/lib/testutil/security"
 	"v.io/x/ref/profiles/internal/rt"
 	"v.io/x/ref/security"
+	tsecurity "v.io/x/ref/test/security"
 )
 
 // InitForTest creates a context for use in a test.
diff --git a/profiles/internal/rt/shutdown_servers_test.go b/profiles/internal/rt/shutdown_servers_test.go
index 4970251..3723552 100644
--- a/profiles/internal/rt/shutdown_servers_test.go
+++ b/profiles/internal/rt/shutdown_servers_test.go
@@ -9,15 +9,16 @@
 	"sync"
 	"syscall"
 
+	"v.io/x/lib/vlog"
+
 	"v.io/v23"
 	"v.io/v23/context"
 	"v.io/v23/ipc"
-	"v.io/x/lib/vlog"
 
-	"v.io/x/ref/lib/modules"
 	"v.io/x/ref/lib/signals"
-	"v.io/x/ref/lib/testutil"
 	_ "v.io/x/ref/profiles"
+	"v.io/x/ref/test"
+	"v.io/x/ref/test/modules"
 )
 
 func init() {
@@ -72,7 +73,7 @@
 // For a more typical server, see simpleServerProgram.
 func complexServerProgram(stdin io.Reader, stdout, stderr io.Writer, env map[string]string, args ...string) error {
 	// Initialize the runtime.  This is boilerplate.
-	ctx, shutdown := testutil.InitForTest()
+	ctx, shutdown := test.InitForTest()
 	// shutdown is optional, but it's a good idea to clean up, especially
 	// since it takes care of flushing the logs before exiting.
 	defer shutdown()
@@ -214,7 +215,7 @@
 // complexServerProgram.
 func simpleServerProgram(stdin io.Reader, stdout, stderr io.Writer, env map[string]string, args ...string) error {
 	// Initialize the runtime.  This is boilerplate.
-	ctx, shutdown := testutil.InitForTest()
+	ctx, shutdown := test.InitForTest()
 	// Calling shutdown is optional, but it's a good idea to clean up, especially
 	// since it takes care of flushing the logs before exiting.
 	//
diff --git a/profiles/internal/rt/shutdown_test.go b/profiles/internal/rt/shutdown_test.go
index 0bf368b..6fec783 100644
--- a/profiles/internal/rt/shutdown_test.go
+++ b/profiles/internal/rt/shutdown_test.go
@@ -10,9 +10,9 @@
 
 	"v.io/v23"
 
-	"v.io/x/ref/lib/modules"
 	"v.io/x/ref/lib/signals"
-	"v.io/x/ref/lib/testutil/expect"
+	"v.io/x/ref/test/expect"
+	"v.io/x/ref/test/modules"
 )
 
 //go:generate v23 test generate
diff --git a/profiles/internal/rt/signal_test.go b/profiles/internal/rt/signal_test.go
index 5ebceba..0aa0301 100644
--- a/profiles/internal/rt/signal_test.go
+++ b/profiles/internal/rt/signal_test.go
@@ -9,10 +9,10 @@
 	"testing"
 	"time"
 
-	"v.io/x/ref/lib/modules"
-	"v.io/x/ref/lib/testutil"
-	"v.io/x/ref/lib/testutil/expect"
 	_ "v.io/x/ref/profiles"
+	"v.io/x/ref/test"
+	"v.io/x/ref/test/expect"
+	"v.io/x/ref/test/modules"
 )
 
 func init() {
@@ -30,7 +30,7 @@
 }
 
 func withRuntime(stdin io.Reader, stdout, stderr io.Writer, env map[string]string, args ...string) error {
-	_, shutdown := testutil.InitForTest()
+	_, shutdown := test.InitForTest()
 	defer shutdown()
 
 	simpleEchoProgram(stdin, stdout)
diff --git a/profiles/internal/rt/v23_test.go b/profiles/internal/rt/v23_test.go
index f1d3bd1..774f3c3 100644
--- a/profiles/internal/rt/v23_test.go
+++ b/profiles/internal/rt/v23_test.go
@@ -10,8 +10,8 @@
 import "testing"
 import "os"
 
-import "v.io/x/ref/lib/modules"
-import "v.io/x/ref/lib/testutil"
+import "v.io/x/ref/test"
+import "v.io/x/ref/test/modules"
 
 func init() {
 	modules.RegisterChild("noWaiters", ``, noWaiters)
@@ -34,7 +34,7 @@
 }
 
 func TestMain(m *testing.M) {
-	testutil.Init()
+	test.Init()
 	if modules.IsModulesChildProcess() {
 		if err := modules.Dispatch(); err != nil {
 			fmt.Fprintf(os.Stderr, "modules.Dispatch failed: %v\n", err)
diff --git a/profiles/internal/testing/concurrency/clock_test.go b/profiles/internal/testing/concurrency/clock_test.go
index 064f2ef..9728d07 100644
--- a/profiles/internal/testing/concurrency/clock_test.go
+++ b/profiles/internal/testing/concurrency/clock_test.go
@@ -3,7 +3,7 @@
 import (
 	"testing"
 
-	"v.io/x/ref/lib/testutil/testutil"
+	"v.io/x/ref/test/testutil"
 )
 
 //go:generate v23 test generate
diff --git a/profiles/internal/testing/concurrency/v23_internal_test.go b/profiles/internal/testing/concurrency/v23_internal_test.go
index 55d3f56..e2d51cf 100644
--- a/profiles/internal/testing/concurrency/v23_internal_test.go
+++ b/profiles/internal/testing/concurrency/v23_internal_test.go
@@ -9,9 +9,9 @@
 import "testing"
 import "os"
 
-import "v.io/x/ref/lib/testutil"
+import "v.io/x/ref/test"
 
 func TestMain(m *testing.M) {
-	testutil.Init()
+	test.Init()
 	os.Exit(m.Run())
 }
diff --git a/profiles/internal/vtrace/vtrace_test.go b/profiles/internal/vtrace/vtrace_test.go
index abb7dee..fe53f3a 100644
--- a/profiles/internal/vtrace/vtrace_test.go
+++ b/profiles/internal/vtrace/vtrace_test.go
@@ -14,17 +14,17 @@
 	"v.io/v23/vtrace"
 	"v.io/x/lib/vlog"
 
-	"v.io/x/ref/lib/testutil"
-	tsecurity "v.io/x/ref/lib/testutil/security"
 	_ "v.io/x/ref/profiles"
 	iipc "v.io/x/ref/profiles/internal/ipc"
 	"v.io/x/ref/profiles/internal/ipc/stream"
 	"v.io/x/ref/profiles/internal/ipc/stream/manager"
 	tnaming "v.io/x/ref/profiles/internal/testing/mocks/naming"
+	"v.io/x/ref/test"
+	tsecurity "v.io/x/ref/test/security"
 )
 
 func TestNewFromContext(t *testing.T) {
-	c0, shutdown := testutil.InitForTest()
+	c0, shutdown := test.InitForTest()
 	defer shutdown()
 	c1, s1 := vtrace.SetNewSpan(c0, "s1")
 	c2, s2 := vtrace.SetNewSpan(c1, "s2")
@@ -226,7 +226,7 @@
 // TestCancellationPropagation tests that cancellation propogates along an
 // RPC call chain without user intervention.
 func TestTraceAcrossRPCs(t *testing.T) {
-	ctx, shutdown := testutil.InitForTest()
+	ctx, shutdown := test.InitForTest()
 	defer shutdown()
 	ctx, span := vtrace.SetNewSpan(ctx, "")
 	vtrace.ForceCollect(ctx)
@@ -250,7 +250,7 @@
 // TestCancellationPropagationLateForce tests that cancellation propogates along an
 // RPC call chain when tracing is initiated by someone deep in the call chain.
 func TestTraceAcrossRPCsLateForce(t *testing.T) {
-	ctx, shutdown := testutil.InitForTest()
+	ctx, shutdown := test.InitForTest()
 	defer shutdown()
 	ctx, span := vtrace.SetNewSpan(ctx, "")
 	span.Annotate("c0-begin")