services/device/internal/impl: shard device unit tests

This is CL 1 of n to shard device manager unit tests into multiple
files and packages to permit concurrent test execution. This CL moves
test utility code into a separate package for reuse from multiple test
packages.

Change-Id: If31cfb70f662e050f6fb75a2b8197bf3b2dcd55a
diff --git a/services/device/internal/impl/association_state_test.go b/services/device/internal/impl/association_state_test.go
index b0b035c..6dba927 100644
--- a/services/device/internal/impl/association_state_test.go
+++ b/services/device/internal/impl/association_state_test.go
@@ -12,7 +12,9 @@
 	"testing"
 
 	"v.io/v23/services/device"
+
 	"v.io/x/ref/services/device/internal/impl"
+	"v.io/x/ref/services/device/internal/impl/utiltest"
 )
 
 // TestAssociationPersistance verifies correct operation of association
@@ -39,7 +41,7 @@
 		t.Fatalf("AllBlessingSystemAssociations failed: %v", err)
 	}
 
-	compareAssociations(t, got1, []device.Association{
+	utiltest.CompareAssociations(t, got1, []device.Association{
 		{
 			"alice",
 			"alice_account",
@@ -59,7 +61,7 @@
 	if err != nil {
 		t.Fatalf("AllBlessingSystemAssociations failed: %v", err)
 	}
-	compareAssociations(t, got1, got2)
+	utiltest.CompareAssociations(t, got1, got2)
 
 	sysacc, have := nbsa2.SystemAccountForBlessings([]string{"bob"})
 	if expected := true; have != expected {
@@ -88,7 +90,7 @@
 	if err != nil {
 		t.Fatalf("AllBlessingSystemAssociations failed: %v", err)
 	}
-	compareAssociations(t, got1, []device.Association{
+	utiltest.CompareAssociations(t, got1, []device.Association{
 		{
 			"alice",
 			"alice_account",
@@ -104,7 +106,7 @@
 	if err != nil {
 		t.Fatalf("AllBlessingSystemAssociations failed: %v", err)
 	}
-	compareAssociations(t, got1, []device.Association{
+	utiltest.CompareAssociations(t, got1, []device.Association{
 		{
 			"alice",
 			"alice_other_account",
diff --git a/services/device/internal/impl/debug_perms_test.go b/services/device/internal/impl/debug_perms_test.go
index f8a14f9..bd9c18a 100644
--- a/services/device/internal/impl/debug_perms_test.go
+++ b/services/device/internal/impl/debug_perms_test.go
@@ -16,6 +16,7 @@
 	"v.io/v23/services/permissions"
 	"v.io/v23/verror"
 
+	"v.io/x/ref/services/device/internal/impl/utiltest"
 	"v.io/x/ref/services/internal/servicetest"
 	"v.io/x/ref/test/testutil"
 )
@@ -33,51 +34,51 @@
 }
 
 func testAccessFail(t *testing.T, expected verror.ID, ctx *context.T, who string, name ...string) {
-	if _, err := statsStub(name...).Value(ctx); verror.ErrorID(err) != expected {
+	if _, err := utiltest.StatsStub(name...).Value(ctx); verror.ErrorID(err) != expected {
 		t.Fatalf(testutil.FormatLogLine(2, "%s got error %v but expected %v", who, err, expected))
 	}
 }
 
 func TestDebugPermissionsPropagation(t *testing.T) {
-	cleanup, ctx, sh, envelope, root, helperPath, idp := startupHelper(t)
+	cleanup, ctx, sh, envelope, root, helperPath, idp := utiltest.StartupHelper(t)
 	defer cleanup()
 
 	// Set up the device manager.
 	dmh := servicetest.RunCommand(t, sh, nil, deviceManagerCmd, "dm", root, helperPath, "unused_app_repo_name", "unused_curr_link")
 	servicetest.ReadPID(t, dmh)
-	claimDevice(t, ctx, "claimable", "dm", "mydevice", noPairingToken)
+	utiltest.ClaimDevice(t, ctx, "claimable", "dm", "mydevice", noPairingToken)
 
 	// Create the local server that the app uses to let us know it's ready.
 	pingCh, cleanup := setupPingServer(t, ctx)
 	defer cleanup()
-	resolve(t, ctx, "pingserver", 1)
+	utiltest.Resolve(t, ctx, "pingserver", 1)
 
 	// Make some users.
 	selfCtx := ctx
-	bobCtx := ctxWithNewPrincipal(t, selfCtx, idp, "bob")
-	hjCtx := ctxWithNewPrincipal(t, selfCtx, idp, "hackerjoe")
-	aliceCtx := ctxWithNewPrincipal(t, selfCtx, idp, "alice")
+	bobCtx := utiltest.CtxWithNewPrincipal(t, selfCtx, idp, "bob")
+	hjCtx := utiltest.CtxWithNewPrincipal(t, selfCtx, idp, "hackerjoe")
+	aliceCtx := utiltest.CtxWithNewPrincipal(t, selfCtx, idp, "alice")
 
 	// TODO(rjkroege): Set AccessLists here that conflict with the one provided by the device
 	// manager and show that the one set here is overridden.
 	// Create the envelope for the first version of the app.
-	*envelope = envelopeFromShell(sh, nil, appCmd, "google naps", "appV1")
+	*envelope = utiltest.EnvelopeFromShell(sh, nil, appCmd, "google naps", "appV1")
 
 	// Install the app.
-	appID := installApp(t, ctx)
+	appID := utiltest.InstallApp(t, ctx)
 
 	// Give bob rights to start an app.
 	updateAccessList(t, selfCtx, "root/bob/$", string(access.Read), "dm/apps", appID)
 
 	// Bob starts an instance of the app.
-	bobApp := launchApp(t, bobCtx, appID)
+	bobApp := utiltest.LaunchApp(t, bobCtx, appID)
 	verifyPingArgs(t, pingCh, userName(t), "default", "")
 
 	// Bob permits Alice to read from his app.
 	updateAccessList(t, bobCtx, "root/alice/$", string(access.Read), "dm/apps", appID, bobApp)
 
 	// Create some globbing test vectors.
-	globtests := []globTestVector{
+	globtests := []utiltest.GlobTestVector{
 		{naming.Join("dm", "apps", appID, bobApp), "*",
 			[]string{"logs", "pprof", "stats"},
 		},
@@ -95,7 +96,7 @@
 			},
 		},
 	}
-	appGlobtests := []globTestVector{
+	appGlobtests := []utiltest.GlobTestVector{
 		{naming.Join("appV1", "__debug"), "*",
 			[]string{"logs", "pprof", "stats", "vtrace"},
 		},
@@ -114,31 +115,31 @@
 		},
 	}
 	globtestminus := globtests[1:]
-	res := newGlobTestRegexHelper("app")
+	res := utiltest.NewGlobTestRegexHelper("app")
 
 	// Confirm that self can access __debug names.
-	verifyGlob(t, selfCtx, "app", globtests, res)
-	verifyStatsValues(t, selfCtx, "dm", "apps", appID, bobApp, "stats/system/start-time*")
-	verifyLog(t, selfCtx, "dm", "apps", appID, bobApp, "logs", "*")
-	verifyPProfCmdLine(t, selfCtx, "app", "dm", "apps", appID, bobApp, "pprof")
+	utiltest.VerifyGlob(t, selfCtx, "app", globtests, res)
+	utiltest.VerifyStatsValues(t, selfCtx, "dm", "apps", appID, bobApp, "stats/system/start-time*")
+	utiltest.VerifyLog(t, selfCtx, "dm", "apps", appID, bobApp, "logs", "*")
+	utiltest.VerifyPProfCmdLine(t, selfCtx, "app", "dm", "apps", appID, bobApp, "pprof")
 
 	// Bob started the app so selfCtx can't connect to the app.
-	verifyFailGlob(t, selfCtx, appGlobtests)
+	utiltest.VerifyFailGlob(t, selfCtx, appGlobtests)
 	testAccessFail(t, verror.ErrNoAccess.ID, selfCtx, "self", "appV1", "__debug", "stats/system/pid")
 
 	// hackerjoe (for example) can't either.
-	verifyFailGlob(t, hjCtx, appGlobtests)
+	utiltest.VerifyFailGlob(t, hjCtx, appGlobtests)
 	testAccessFail(t, verror.ErrNoAccess.ID, hjCtx, "hackerjoe", "appV1", "__debug", "stats/system/pid")
 
 	// Bob has an issue with his app and tries to use the debug output to figure it out.
-	verifyGlob(t, bobCtx, "app", globtests, res)
-	verifyStatsValues(t, bobCtx, "dm", "apps", appID, bobApp, "stats/system/start-time*")
-	verifyLog(t, bobCtx, "dm", "apps", appID, bobApp, "logs", "*")
-	verifyPProfCmdLine(t, bobCtx, "app", "dm", "apps", appID, bobApp, "pprof")
+	utiltest.VerifyGlob(t, bobCtx, "app", globtests, res)
+	utiltest.VerifyStatsValues(t, bobCtx, "dm", "apps", appID, bobApp, "stats/system/start-time*")
+	utiltest.VerifyLog(t, bobCtx, "dm", "apps", appID, bobApp, "logs", "*")
+	utiltest.VerifyPProfCmdLine(t, bobCtx, "app", "dm", "apps", appID, bobApp, "pprof")
 
 	// Bob can also connect directly to his app.
-	verifyGlob(t, bobCtx, "app", appGlobtests, res)
-	verifyStatsValues(t, bobCtx, "appV1", "__debug", "stats/system/start-time*")
+	utiltest.VerifyGlob(t, bobCtx, "app", appGlobtests, res)
+	utiltest.VerifyStatsValues(t, bobCtx, "appV1", "__debug", "stats/system/start-time*")
 
 	// But Bob can't figure it out and hopes that hackerjoe can debug it.
 	updateAccessList(t, bobCtx, "root/hackerjoe/$", string(access.Debug), "dm/apps", appID, bobApp)
@@ -147,41 +148,41 @@
 	// But hackerjoe can't solve Bob's problem.
 	// Because hackerjoe has Debug, hackerjoe can glob the __debug resources
 	// of Bob's app but can't glob Bob's app.
-	verifyGlob(t, hjCtx, "app", globtestminus, res)
-	verifyFailGlob(t, hjCtx, globtests[0:1])
-	verifyStatsValues(t, hjCtx, "dm", "apps", appID, bobApp, "stats", "system/start-time*")
-	verifyLog(t, hjCtx, "dm", "apps", appID, bobApp, "logs", "*")
-	verifyPProfCmdLine(t, hjCtx, "app", "dm", "apps", appID, bobApp, "pprof")
+	utiltest.VerifyGlob(t, hjCtx, "app", globtestminus, res)
+	utiltest.VerifyFailGlob(t, hjCtx, globtests[0:1])
+	utiltest.VerifyStatsValues(t, hjCtx, "dm", "apps", appID, bobApp, "stats", "system/start-time*")
+	utiltest.VerifyLog(t, hjCtx, "dm", "apps", appID, bobApp, "logs", "*")
+	utiltest.VerifyPProfCmdLine(t, hjCtx, "app", "dm", "apps", appID, bobApp, "pprof")
 
 	// Permissions are propagated to the app so hackerjoe can connect
 	// directly to the app too.
-	verifyGlob(t, hjCtx, "app", globtestminus, res)
-	verifyStatsValues(t, hjCtx, "appV1", "__debug", "stats/system/start-time*")
+	utiltest.VerifyGlob(t, hjCtx, "app", globtestminus, res)
+	utiltest.VerifyStatsValues(t, hjCtx, "appV1", "__debug", "stats/system/start-time*")
 
 	// Alice might be able to help but Bob didn't give Alice access to the debug Permissionss.
 	testAccessFail(t, verror.ErrNoAccess.ID, aliceCtx, "Alice", "dm", "apps", appID, bobApp, "stats/system/pid")
 
 	// Bob forgets that Alice can't read the stats when he can.
-	verifyGlob(t, bobCtx, "app", globtests, res)
-	verifyStatsValues(t, bobCtx, "dm", "apps", appID, bobApp, "stats/system/start-time*")
+	utiltest.VerifyGlob(t, bobCtx, "app", globtests, res)
+	utiltest.VerifyStatsValues(t, bobCtx, "dm", "apps", appID, bobApp, "stats/system/start-time*")
 
 	// So Bob changes the permissions so that Alice can help debug too.
 	updateAccessList(t, bobCtx, "root/alice/$", string(access.Debug), "dm/apps", appID, bobApp)
 
 	// Alice can access __debug content.
-	verifyGlob(t, aliceCtx, "app", globtestminus, res)
-	verifyFailGlob(t, aliceCtx, globtests[0:1])
-	verifyStatsValues(t, aliceCtx, "dm", "apps", appID, bobApp, "stats", "system/start-time*")
-	verifyLog(t, aliceCtx, "dm", "apps", appID, bobApp, "logs", "*")
-	verifyPProfCmdLine(t, aliceCtx, "app", "dm", "apps", appID, bobApp, "pprof")
+	utiltest.VerifyGlob(t, aliceCtx, "app", globtestminus, res)
+	utiltest.VerifyFailGlob(t, aliceCtx, globtests[0:1])
+	utiltest.VerifyStatsValues(t, aliceCtx, "dm", "apps", appID, bobApp, "stats", "system/start-time*")
+	utiltest.VerifyLog(t, aliceCtx, "dm", "apps", appID, bobApp, "logs", "*")
+	utiltest.VerifyPProfCmdLine(t, aliceCtx, "app", "dm", "apps", appID, bobApp, "pprof")
 
 	// Alice can also now connect directly to the app.
-	verifyGlob(t, aliceCtx, "app", globtestminus, res)
-	verifyStatsValues(t, aliceCtx, "appV1", "__debug", "stats/system/start-time*")
+	utiltest.VerifyGlob(t, aliceCtx, "app", globtestminus, res)
+	utiltest.VerifyStatsValues(t, aliceCtx, "appV1", "__debug", "stats/system/start-time*")
 
 	// Bob is glum because no one can help him fix his app so he terminates
 	// it.
-	terminateApp(t, bobCtx, appID, bobApp)
+	utiltest.TerminateApp(t, bobCtx, appID, bobApp)
 
 	// Cleanly shut down the device manager.
 	syscall.Kill(dmh.Pid(), syscall.SIGINT)
@@ -190,7 +191,7 @@
 }
 
 func TestClaimSetsDebugPermissions(t *testing.T) {
-	cleanup, ctx, sh, _, root, helperPath, idp := startupHelper(t)
+	cleanup, ctx, sh, _, root, helperPath, idp := utiltest.StartupHelper(t)
 	defer cleanup()
 
 	extraLogDir, err := ioutil.TempDir(root, "testlogs")
@@ -204,15 +205,15 @@
 
 	// Make some users.
 	selfCtx := ctx
-	bobCtx := ctxWithNewPrincipal(t, selfCtx, idp, "bob")
-	aliceCtx := ctxWithNewPrincipal(t, selfCtx, idp, "alice")
-	hjCtx := ctxWithNewPrincipal(t, selfCtx, idp, "hackerjoe")
+	bobCtx := utiltest.CtxWithNewPrincipal(t, selfCtx, idp, "bob")
+	aliceCtx := utiltest.CtxWithNewPrincipal(t, selfCtx, idp, "alice")
+	hjCtx := utiltest.CtxWithNewPrincipal(t, selfCtx, idp, "hackerjoe")
 
 	// Bob claims the device manager.
-	claimDevice(t, bobCtx, "claimable", "dm", "mydevice", noPairingToken)
+	utiltest.ClaimDevice(t, bobCtx, "claimable", "dm", "mydevice", noPairingToken)
 
 	// Create some globbing test vectors.
-	dmGlobtests := []globTestVector{
+	dmGlobtests := []utiltest.GlobTestVector{
 		{naming.Join("dm", "__debug"), "*",
 			[]string{"logs", "pprof", "stats", "vtrace"},
 		},
@@ -230,14 +231,14 @@
 			},
 		},
 	}
-	res := newGlobTestRegexHelper(`impl\.test`)
+	res := utiltest.NewGlobTestRegexHelper(`impl\.test`)
 
 	// Bob claimed the DM so can access it.
-	verifyGlob(t, bobCtx, "impl.test", dmGlobtests, res)
-	verifyStatsValues(t, bobCtx, "dm", "__debug", "stats/system/start-time*")
+	utiltest.VerifyGlob(t, bobCtx, "impl.test", dmGlobtests, res)
+	utiltest.VerifyStatsValues(t, bobCtx, "dm", "__debug", "stats/system/start-time*")
 
 	// Without permissions, hackerjoe can't access the device manager.
-	verifyFailGlob(t, hjCtx, dmGlobtests)
+	utiltest.VerifyFailGlob(t, hjCtx, dmGlobtests)
 	testAccessFail(t, verror.ErrNoAccess.ID, hjCtx, "hackerjoe", "dm", "__debug", "stats/system/pid")
 
 	// Bob gives system administrator Alice admin access to the dm and hence Alice
@@ -246,15 +247,15 @@
 
 	// Alice is an adminstrator and so can can access device manager __debug
 	// values.
-	verifyGlob(t, aliceCtx, "impl.test", dmGlobtests, res)
-	verifyStatsValues(t, aliceCtx, "dm", "__debug", "stats/system/start-time*")
+	utiltest.VerifyGlob(t, aliceCtx, "impl.test", dmGlobtests, res)
+	utiltest.VerifyStatsValues(t, aliceCtx, "dm", "__debug", "stats/system/start-time*")
 
 	// Bob gives debug access to the device manager to hackerjoe
 	updateAccessList(t, bobCtx, "root/hackerjoe/$", string(access.Debug), "dm", "device")
 
 	// hackerjoe can now access the device manager
-	verifyGlob(t, hjCtx, "impl.test", dmGlobtests, res)
-	verifyStatsValues(t, hjCtx, "dm", "__debug", "stats/system/start-time*")
+	utiltest.VerifyGlob(t, hjCtx, "impl.test", dmGlobtests, res)
+	utiltest.VerifyStatsValues(t, hjCtx, "dm", "__debug", "stats/system/start-time*")
 
 	// Cleanly shut down the device manager.
 	syscall.Kill(dmh.Pid(), syscall.SIGINT)
diff --git a/services/device/internal/impl/impl_helper_test.go b/services/device/internal/impl/impl_helper_test.go
index e2b7c81..4eed0cb 100644
--- a/services/device/internal/impl/impl_helper_test.go
+++ b/services/device/internal/impl/impl_helper_test.go
@@ -14,6 +14,7 @@
 	"testing"
 
 	"v.io/x/ref/services/device/internal/impl"
+	"v.io/x/ref/services/device/internal/impl/utiltest"
 )
 
 func TestBaseCleanupDir(t *testing.T) {
@@ -35,7 +36,7 @@
 	}
 
 	// Setup a helper.
-	helper := generateSuidHelperScript(t, dir)
+	helper := utiltest.GenerateSuidHelperScript(t, dir)
 
 	impl.WrapBaseCleanupDir(helperTarget, helper)
 	if _, err := os.Stat(helperTarget); err == nil || os.IsExist(err) {
diff --git a/services/device/internal/impl/impl_test.go b/services/device/internal/impl/impl_test.go
index 1109c71..ed14858 100644
--- a/services/device/internal/impl/impl_test.go
+++ b/services/device/internal/impl/impl_test.go
@@ -47,6 +47,7 @@
 	"v.io/x/ref/lib/signals"
 	"v.io/x/ref/services/device/internal/config"
 	"v.io/x/ref/services/device/internal/impl"
+	"v.io/x/ref/services/device/internal/impl/utiltest"
 	"v.io/x/ref/services/device/internal/starter"
 	"v.io/x/ref/services/device/internal/suid"
 	"v.io/x/ref/services/internal/binarylib"
@@ -199,7 +200,7 @@
 	// Update the namespace roots to remove the server blessing from the
 	// endpoints.  This is needed to be able to publish into the 'global'
 	// mounttable before we have compatible credentials.
-	ctx, err = setNamespaceRootsForUnclaimedDevice(ctx)
+	ctx, err = utiltest.SetNamespaceRootsForUnclaimedDevice(ctx)
 	if err != nil {
 		return err
 	}
@@ -371,7 +372,7 @@
 	defer deferFn()
 
 	// Set up mock application and binary repositories.
-	envelope, cleanup := startMockRepos(t, ctx)
+	envelope, cleanup := utiltest.StartMockRepos(t, ctx)
 	defer cleanup()
 
 	root, cleanup := servicetest.SetupRootDir(t, "devicemanager")
@@ -397,7 +398,7 @@
 	}
 	defer os.RemoveAll(dmCreds)
 	dmEnv := []string{fmt.Sprintf("%v=%v", envvar.Credentials, dmCreds)}
-	dmArgs := []string{"factoryDM", root, "unused_helper", mockApplicationRepoName, currLink}
+	dmArgs := []string{"factoryDM", root, "unused_helper", utiltest.MockApplicationRepoName, currLink}
 	args, env := sh.CommandEnvelope(deviceManagerCmd, dmEnv, dmArgs...)
 	scriptPathFactory := generateDeviceManagerScript(t, root, args, env)
 
@@ -419,24 +420,24 @@
 	dmh := servicetest.RunCommand(t, sh, dmPauseBeforeStopEnv, deviceManagerCmd, dmArgs...)
 	defer func() {
 		syscall.Kill(dmh.Pid(), syscall.SIGINT)
-		verifyNoRunningProcesses(t)
+		utiltest.VerifyNoRunningProcesses(t)
 	}()
 
 	servicetest.ReadPID(t, dmh)
-	resolve(t, ctx, "claimable", 1)
+	utiltest.Resolve(t, ctx, "claimable", 1)
 	// Brand new device manager must be claimed first.
-	claimDevice(t, ctx, "claimable", "factoryDM", "mydevice", noPairingToken)
+	utiltest.ClaimDevice(t, ctx, "claimable", "factoryDM", "mydevice", noPairingToken)
 	// Simulate an invalid envelope in the application repository.
-	*envelope = envelopeFromShell(sh, dmPauseBeforeStopEnv, deviceManagerCmd, "bogus", dmArgs...)
+	*envelope = utiltest.EnvelopeFromShell(sh, dmPauseBeforeStopEnv, deviceManagerCmd, "bogus", dmArgs...)
 
-	updateDeviceExpectError(t, ctx, "factoryDM", impl.ErrAppTitleMismatch.ID)
-	revertDeviceExpectError(t, ctx, "factoryDM", impl.ErrUpdateNoOp.ID)
+	utiltest.UpdateDeviceExpectError(t, ctx, "factoryDM", impl.ErrAppTitleMismatch.ID)
+	utiltest.RevertDeviceExpectError(t, ctx, "factoryDM", impl.ErrUpdateNoOp.ID)
 
 	// Set up a second version of the device manager. The information in the
 	// envelope will be used by the device manager to stage the next
 	// version.
-	*envelope = envelopeFromShell(sh, dmEnv, deviceManagerCmd, application.DeviceManagerTitle, "v2DM")
-	updateDevice(t, ctx, "factoryDM")
+	*envelope = utiltest.EnvelopeFromShell(sh, dmEnv, deviceManagerCmd, application.DeviceManagerTitle, "v2DM")
+	utiltest.UpdateDevice(t, ctx, "factoryDM")
 
 	// Current link should have been updated to point to v2.
 	evalLink := func() string {
@@ -451,7 +452,7 @@
 		t.Fatalf("current link didn't change")
 	}
 
-	updateDeviceExpectError(t, ctx, "factoryDM", impl.ErrOperationInProgress.ID)
+	utiltest.UpdateDeviceExpectError(t, ctx, "factoryDM", impl.ErrOperationInProgress.ID)
 
 	dmh.CloseStdin()
 
@@ -461,34 +462,34 @@
 
 	// A successful update means the device manager has stopped itself.  We
 	// relaunch it from the current link.
-	resolveExpectNotFound(t, ctx, "v2DM") // Ensure a clean slate.
+	utiltest.ResolveExpectNotFound(t, ctx, "v2DM") // Ensure a clean slate.
 
 	dmh = servicetest.RunCommand(t, sh, dmEnv, execScriptCmd, currLink)
 
 	servicetest.ReadPID(t, dmh)
-	resolve(t, ctx, "v2DM", 1) // Current link should have been launching v2.
+	utiltest.Resolve(t, ctx, "v2DM", 1) // Current link should have been launching v2.
 
 	// Try issuing an update without changing the envelope in the
 	// application repository: this should fail, and current link should be
 	// unchanged.
-	updateDeviceExpectError(t, ctx, "v2DM", impl.ErrUpdateNoOp.ID)
+	utiltest.UpdateDeviceExpectError(t, ctx, "v2DM", impl.ErrUpdateNoOp.ID)
 	if evalLink() != scriptPathV2 {
 		t.Fatalf("script changed")
 	}
 
 	// Try issuing an update with a binary that has a different major version
 	// number. It should fail.
-	resolveExpectNotFound(t, ctx, "v2.5DM") // Ensure a clean slate.
-	*envelope = envelopeFromShell(sh, dmEnv, deviceManagerV10Cmd, application.DeviceManagerTitle, "v2.5DM")
-	updateDeviceExpectError(t, ctx, "v2DM", impl.ErrOperationFailed.ID)
+	utiltest.ResolveExpectNotFound(t, ctx, "v2.5DM") // Ensure a clean slate.
+	*envelope = utiltest.EnvelopeFromShell(sh, dmEnv, deviceManagerV10Cmd, application.DeviceManagerTitle, "v2.5DM")
+	utiltest.UpdateDeviceExpectError(t, ctx, "v2DM", impl.ErrOperationFailed.ID)
 
 	if evalLink() != scriptPathV2 {
 		t.Fatalf("script changed")
 	}
 
 	// Create a third version of the device manager and issue an update.
-	*envelope = envelopeFromShell(sh, dmEnv, deviceManagerCmd, application.DeviceManagerTitle, "v3DM")
-	updateDevice(t, ctx, "v2DM")
+	*envelope = utiltest.EnvelopeFromShell(sh, dmEnv, deviceManagerCmd, application.DeviceManagerTitle, "v3DM")
+	utiltest.UpdateDevice(t, ctx, "v2DM")
 
 	scriptPathV3 := evalLink()
 	if scriptPathV3 == scriptPathV2 {
@@ -500,7 +501,7 @@
 
 	dmh.Shutdown(os.Stderr, os.Stderr)
 
-	resolveExpectNotFound(t, ctx, "v3DM") // Ensure a clean slate.
+	utiltest.ResolveExpectNotFound(t, ctx, "v3DM") // Ensure a clean slate.
 
 	// Re-lanuch the device manager from current link.  We instruct the
 	// device manager to pause before stopping its server, so that we can
@@ -508,11 +509,11 @@
 	dmh = servicetest.RunCommand(t, sh, dmPauseBeforeStopEnv, execScriptCmd, currLink)
 
 	servicetest.ReadPID(t, dmh)
-	resolve(t, ctx, "v3DM", 1) // Current link should have been launching v3.
+	utiltest.Resolve(t, ctx, "v3DM", 1) // Current link should have been launching v3.
 
 	// Revert the device manager to its previous version (v2).
-	revertDevice(t, ctx, "v3DM")
-	revertDeviceExpectError(t, ctx, "v3DM", impl.ErrOperationInProgress.ID) // Revert already in progress.
+	utiltest.RevertDevice(t, ctx, "v3DM")
+	utiltest.RevertDeviceExpectError(t, ctx, "v3DM", impl.ErrOperationInProgress.ID) // Revert already in progress.
 	dmh.CloseStdin()
 	dmh.Expect("restart handler")
 	dmh.Expect("v3DM terminated")
@@ -521,14 +522,14 @@
 	}
 	dmh.Shutdown(os.Stderr, os.Stderr)
 
-	resolveExpectNotFound(t, ctx, "v2DM") // Ensure a clean slate.
+	utiltest.ResolveExpectNotFound(t, ctx, "v2DM") // Ensure a clean slate.
 
 	dmh = servicetest.RunCommand(t, sh, dmEnv, execScriptCmd, currLink)
 	servicetest.ReadPID(t, dmh)
-	resolve(t, ctx, "v2DM", 1) // Current link should have been launching v2.
+	utiltest.Resolve(t, ctx, "v2DM", 1) // Current link should have been launching v2.
 
 	// Revert the device manager to its previous version (factory).
-	revertDevice(t, ctx, "v2DM")
+	utiltest.RevertDevice(t, ctx, "v2DM")
 	dmh.Expect("restart handler")
 	dmh.Expect("v2DM terminated")
 	if evalLink() != scriptPathFactory {
@@ -536,21 +537,21 @@
 	}
 	dmh.Shutdown(os.Stderr, os.Stderr)
 
-	resolveExpectNotFound(t, ctx, "factoryDM") // Ensure a clean slate.
+	utiltest.ResolveExpectNotFound(t, ctx, "factoryDM") // Ensure a clean slate.
 
 	dmh = servicetest.RunCommand(t, sh, dmEnv, execScriptCmd, currLink)
 	servicetest.ReadPID(t, dmh)
-	resolve(t, ctx, "factoryDM", 1) // Current link should have been launching factory version.
-	shutdownDevice(t, ctx, "factoryDM")
+	utiltest.Resolve(t, ctx, "factoryDM", 1) // Current link should have been launching factory version.
+	utiltest.ShutdownDevice(t, ctx, "factoryDM")
 	dmh.Expect("factoryDM terminated")
 	dmh.ExpectEOF()
 
 	// Re-launch the device manager, to exercise the behavior of Stop.
-	resolveExpectNotFound(t, ctx, "factoryDM") // Ensure a clean slate.
+	utiltest.ResolveExpectNotFound(t, ctx, "factoryDM") // Ensure a clean slate.
 	dmh = servicetest.RunCommand(t, sh, dmEnv, execScriptCmd, currLink)
 	servicetest.ReadPID(t, dmh)
-	resolve(t, ctx, "factoryDM", 1)
-	killDevice(t, ctx, "factoryDM")
+	utiltest.Resolve(t, ctx, "factoryDM", 1)
+	utiltest.KillDevice(t, ctx, "factoryDM")
 	dmh.Expect("restart handler")
 	dmh.Expect("factoryDM terminated")
 	dmh.ExpectEOF()
@@ -644,7 +645,7 @@
 	defer deferFn()
 
 	// Set up mock application and binary repositories.
-	envelope, cleanup := startMockRepos(t, ctx)
+	envelope, cleanup := utiltest.StartMockRepos(t, ctx)
 	defer cleanup()
 
 	root, cleanup := servicetest.SetupRootDir(t, "devicemanager")
@@ -654,22 +655,22 @@
 	}
 
 	// Create a script wrapping the test target that implements suidhelper.
-	helperPath := generateSuidHelperScript(t, root)
+	helperPath := utiltest.GenerateSuidHelperScript(t, root)
 
 	// Set up the device manager.  Since we won't do device manager updates,
 	// don't worry about its application envelope and current link.
 	dmh := servicetest.RunCommand(t, sh, nil, deviceManagerCmd, "dm", root, helperPath, "unused_app_repo_name", "unused_curr_link")
 	servicetest.ReadPID(t, dmh)
-	claimDevice(t, ctx, "claimable", "dm", "mydevice", noPairingToken)
+	utiltest.ClaimDevice(t, ctx, "claimable", "dm", "mydevice", noPairingToken)
 
 	// Create the local server that the app uses to let us know it's ready.
 	pingCh, cleanup := setupPingServer(t, ctx)
 	defer cleanup()
 
-	resolve(t, ctx, "pingserver", 1)
+	utiltest.Resolve(t, ctx, "pingserver", 1)
 
 	// Create an envelope for a first version of the app.
-	*envelope = envelopeFromShell(sh, []string{testEnvVarName + "=env-val-envelope"}, appCmd, "google naps", fmt.Sprintf("--%s=flag-val-envelope", testFlagName), "appV1")
+	*envelope = utiltest.EnvelopeFromShell(sh, []string{testEnvVarName + "=env-val-envelope"}, appCmd, "google naps", fmt.Sprintf("--%s=flag-val-envelope", testFlagName), "appV1")
 
 	// Install the app.  The config-specified flag value for testFlagName
 	// should override the value specified in the envelope above, and the
@@ -682,9 +683,9 @@
 	// This rooted name should be equivalent to the relative name "ar", but
 	// we want to test that the config override for origin works.
 	rootedAppRepoName := naming.Join(mtName, "ar")
-	appID := installApp(t, ctx, device.Config{testFlagName: "flag-val-install", mgmt.AppOriginConfigKey: rootedAppRepoName})
-	v1 := verifyState(t, ctx, device.InstallationStateActive, appID)
-	installationDebug := debug(t, ctx, appID)
+	appID := utiltest.InstallApp(t, ctx, device.Config{testFlagName: "flag-val-install", mgmt.AppOriginConfigKey: rootedAppRepoName})
+	v1 := utiltest.VerifyState(t, ctx, device.InstallationStateActive, appID)
+	installationDebug := utiltest.Debug(t, ctx, appID)
 	// We spot-check a couple pieces of information we expect in the debug
 	// output.
 	// TODO(caprita): Is there a way to verify more without adding brittle
@@ -700,17 +701,17 @@
 
 	// Start requires the caller to bless the app instance.
 	expectedErr := "bless failed"
-	if _, err := launchAppImpl(t, ctx, appID, ""); err == nil || err.Error() != expectedErr {
+	if _, err := utiltest.LaunchAppImpl(t, ctx, appID, ""); err == nil || err.Error() != expectedErr {
 		t.Fatalf("Start(%v) expected to fail with %v, got %v instead", appID, expectedErr, err)
 	}
 
 	// Start an instance of the app.
-	instance1ID := launchApp(t, ctx, appID)
-	if v := verifyState(t, ctx, device.InstanceStateRunning, appID, instance1ID); v != v1 {
+	instance1ID := utiltest.LaunchApp(t, ctx, appID)
+	if v := utiltest.VerifyState(t, ctx, device.InstanceStateRunning, appID, instance1ID); v != v1 {
 		t.Fatalf("Instance version expected to be %v, got %v instead", v1, v)
 	}
 
-	instanceDebug := debug(t, ctx, appID, instance1ID)
+	instanceDebug := utiltest.Debug(t, ctx, appID, instance1ID)
 	// Verify the apps default blessings.
 	if !strings.Contains(instanceDebug, fmt.Sprintf("Default Blessings                %s/forapp", test.TestBlessing)) {
 		t.Fatalf("debug response doesn't contain expected info: %v", instanceDebug)
@@ -719,28 +720,28 @@
 	// Wait until the app pings us that it's ready.
 	verifyPingArgs(t, pingCh, userName(t), "flag-val-install", "env-val-envelope")
 
-	v1EP1 := resolve(t, ctx, "appV1", 1)[0]
+	v1EP1 := utiltest.Resolve(t, ctx, "appV1", 1)[0]
 
 	// Stop the app instance.
-	killApp(t, ctx, appID, instance1ID)
-	verifyState(t, ctx, device.InstanceStateNotRunning, appID, instance1ID)
-	resolveExpectNotFound(t, ctx, "appV1")
+	utiltest.KillApp(t, ctx, appID, instance1ID)
+	utiltest.VerifyState(t, ctx, device.InstanceStateNotRunning, appID, instance1ID)
+	utiltest.ResolveExpectNotFound(t, ctx, "appV1")
 
-	runApp(t, ctx, appID, instance1ID)
-	verifyState(t, ctx, device.InstanceStateRunning, appID, instance1ID)
+	utiltest.RunApp(t, ctx, appID, instance1ID)
+	utiltest.VerifyState(t, ctx, device.InstanceStateRunning, appID, instance1ID)
 	verifyPingArgs(t, pingCh, userName(t), "flag-val-install", "env-val-envelope") // Wait until the app pings us that it's ready.
 	oldV1EP1 := v1EP1
-	if v1EP1 = resolve(t, ctx, "appV1", 1)[0]; v1EP1 == oldV1EP1 {
+	if v1EP1 = utiltest.Resolve(t, ctx, "appV1", 1)[0]; v1EP1 == oldV1EP1 {
 		t.Fatalf("Expected a new endpoint for the app after kill/run")
 	}
 
 	// Start a second instance.
-	instance2ID := launchApp(t, ctx, appID)
+	instance2ID := utiltest.LaunchApp(t, ctx, appID)
 	verifyPingArgs(t, pingCh, userName(t), "flag-val-install", "env-val-envelope") // Wait until the app pings us that it's ready.
 
 	// There should be two endpoints mounted as "appV1", one for each
 	// instance of the app.
-	endpoints := resolve(t, ctx, "appV1", 2)
+	endpoints := utiltest.Resolve(t, ctx, "appV1", 2)
 	v1EP2 := endpoints[0]
 	if endpoints[0] == v1EP1 {
 		v1EP2 = endpoints[1]
@@ -755,48 +756,48 @@
 	// canceled; run while still running).
 
 	// Kill the first instance.
-	killApp(t, ctx, appID, instance1ID)
+	utiltest.KillApp(t, ctx, appID, instance1ID)
 	// Only the second instance should still be running and mounted.
-	if want, got := v1EP2, resolve(t, ctx, "appV1", 1)[0]; want != got {
+	if want, got := v1EP2, utiltest.Resolve(t, ctx, "appV1", 1)[0]; want != got {
 		t.Fatalf("Resolve(%v): want: %v, got %v", "appV1", want, got)
 	}
 
 	// Updating the installation to itself is a no-op.
-	updateAppExpectError(t, ctx, appID, impl.ErrUpdateNoOp.ID)
+	utiltest.UpdateAppExpectError(t, ctx, appID, impl.ErrUpdateNoOp.ID)
 
 	// Updating the installation should not work with a mismatched title.
-	*envelope = envelopeFromShell(sh, nil, appCmd, "bogus")
+	*envelope = utiltest.EnvelopeFromShell(sh, nil, appCmd, "bogus")
 
-	updateAppExpectError(t, ctx, appID, impl.ErrAppTitleMismatch.ID)
+	utiltest.UpdateAppExpectError(t, ctx, appID, impl.ErrAppTitleMismatch.ID)
 
 	// Create a second version of the app and update the app to it.
-	*envelope = envelopeFromShell(sh, []string{testEnvVarName + "=env-val-envelope"}, appCmd, "google naps", "appV2")
+	*envelope = utiltest.EnvelopeFromShell(sh, []string{testEnvVarName + "=env-val-envelope"}, appCmd, "google naps", "appV2")
 
-	updateApp(t, ctx, appID)
+	utiltest.UpdateApp(t, ctx, appID)
 
-	v2 := verifyState(t, ctx, device.InstallationStateActive, appID)
+	v2 := utiltest.VerifyState(t, ctx, device.InstallationStateActive, appID)
 	if v1 == v2 {
 		t.Fatalf("Version did not change for %v: %v", appID, v1)
 	}
 
 	// Second instance should still be running.
-	if want, got := v1EP2, resolve(t, ctx, "appV1", 1)[0]; want != got {
+	if want, got := v1EP2, utiltest.Resolve(t, ctx, "appV1", 1)[0]; want != got {
 		t.Fatalf("Resolve(%v): want: %v, got %v", "appV1", want, got)
 	}
-	if v := verifyState(t, ctx, device.InstanceStateRunning, appID, instance2ID); v != v1 {
+	if v := utiltest.VerifyState(t, ctx, device.InstanceStateRunning, appID, instance2ID); v != v1 {
 		t.Fatalf("Instance version expected to be %v, got %v instead", v1, v)
 	}
 
 	// Resume first instance.
-	runApp(t, ctx, appID, instance1ID)
-	if v := verifyState(t, ctx, device.InstanceStateRunning, appID, instance1ID); v != v1 {
+	utiltest.RunApp(t, ctx, appID, instance1ID)
+	if v := utiltest.VerifyState(t, ctx, device.InstanceStateRunning, appID, instance1ID); v != v1 {
 		t.Fatalf("Instance version expected to be %v, got %v instead", v1, v)
 	}
 	verifyPingArgs(t, pingCh, userName(t), "flag-val-install", "env-val-envelope") // Wait until the app pings us that it's ready.
 	// Both instances should still be running the first version of the app.
 	// Check that the mounttable contains two endpoints, one of which is
 	// v1EP2.
-	endpoints = resolve(t, ctx, "appV1", 2)
+	endpoints = utiltest.Resolve(t, ctx, "appV1", 2)
 	if endpoints[0] == v1EP2 {
 		if endpoints[1] == v1EP2 {
 			t.Fatalf("Both endpoints are the same")
@@ -806,91 +807,91 @@
 	}
 
 	// Trying to update first instance while it's running should fail.
-	updateInstanceExpectError(t, ctx, appID, instance1ID, impl.ErrInvalidOperation.ID)
+	utiltest.UpdateInstanceExpectError(t, ctx, appID, instance1ID, impl.ErrInvalidOperation.ID)
 	// Stop first instance and try again.
-	killApp(t, ctx, appID, instance1ID)
+	utiltest.KillApp(t, ctx, appID, instance1ID)
 	// Only the second instance should still be running and mounted.
-	if want, got := v1EP2, resolve(t, ctx, "appV1", 1)[0]; want != got {
+	if want, got := v1EP2, utiltest.Resolve(t, ctx, "appV1", 1)[0]; want != got {
 		t.Fatalf("Resolve(%v): want: %v, got %v", "appV1", want, got)
 	}
 	// Update succeeds now.
-	updateInstance(t, ctx, appID, instance1ID)
-	if v := verifyState(t, ctx, device.InstanceStateNotRunning, appID, instance1ID); v != v2 {
+	utiltest.UpdateInstance(t, ctx, appID, instance1ID)
+	if v := utiltest.VerifyState(t, ctx, device.InstanceStateNotRunning, appID, instance1ID); v != v2 {
 		t.Fatalf("Instance version expected to be %v, got %v instead", v2, v)
 	}
 	// Resume the first instance and verify it's running v2 now.
-	runApp(t, ctx, appID, instance1ID)
+	utiltest.RunApp(t, ctx, appID, instance1ID)
 	verifyPingArgs(t, pingCh, userName(t), "flag-val-install", "env-val-envelope")
-	resolve(t, ctx, "appV1", 1)
-	resolve(t, ctx, "appV2", 1)
+	utiltest.Resolve(t, ctx, "appV1", 1)
+	utiltest.Resolve(t, ctx, "appV2", 1)
 
 	// Stop first instance.
-	terminateApp(t, ctx, appID, instance1ID)
+	utiltest.TerminateApp(t, ctx, appID, instance1ID)
 	verifyAppWorkspace(t, root, appID, instance1ID)
-	resolveExpectNotFound(t, ctx, "appV2")
+	utiltest.ResolveExpectNotFound(t, ctx, "appV2")
 
 	// Start a third instance.
-	instance3ID := launchApp(t, ctx, appID)
-	if v := verifyState(t, ctx, device.InstanceStateRunning, appID, instance3ID); v != v2 {
+	instance3ID := utiltest.LaunchApp(t, ctx, appID)
+	if v := utiltest.VerifyState(t, ctx, device.InstanceStateRunning, appID, instance3ID); v != v2 {
 		t.Fatalf("Instance version expected to be %v, got %v instead", v2, v)
 	}
 	// Wait until the app pings us that it's ready.
 	verifyPingArgs(t, pingCh, userName(t), "flag-val-install", "env-val-envelope")
 
-	resolve(t, ctx, "appV2", 1)
+	utiltest.Resolve(t, ctx, "appV2", 1)
 
 	// Stop second instance.
-	terminateApp(t, ctx, appID, instance2ID)
-	resolveExpectNotFound(t, ctx, "appV1")
+	utiltest.TerminateApp(t, ctx, appID, instance2ID)
+	utiltest.ResolveExpectNotFound(t, ctx, "appV1")
 
 	// Stop third instance.
-	terminateApp(t, ctx, appID, instance3ID)
-	resolveExpectNotFound(t, ctx, "appV2")
+	utiltest.TerminateApp(t, ctx, appID, instance3ID)
+	utiltest.ResolveExpectNotFound(t, ctx, "appV2")
 
 	// Revert the app.
-	revertApp(t, ctx, appID)
-	if v := verifyState(t, ctx, device.InstallationStateActive, appID); v != v1 {
+	utiltest.RevertApp(t, ctx, appID)
+	if v := utiltest.VerifyState(t, ctx, device.InstallationStateActive, appID); v != v1 {
 		t.Fatalf("Installation version expected to be %v, got %v instead", v1, v)
 	}
 
 	// Start a fourth instance.  It should be running from version 1.
-	instance4ID := launchApp(t, ctx, appID)
-	if v := verifyState(t, ctx, device.InstanceStateRunning, appID, instance4ID); v != v1 {
+	instance4ID := utiltest.LaunchApp(t, ctx, appID)
+	if v := utiltest.VerifyState(t, ctx, device.InstanceStateRunning, appID, instance4ID); v != v1 {
 		t.Fatalf("Instance version expected to be %v, got %v instead", v1, v)
 	}
 	verifyPingArgs(t, pingCh, userName(t), "flag-val-install", "env-val-envelope") // Wait until the app pings us that it's ready.
-	resolve(t, ctx, "appV1", 1)
-	terminateApp(t, ctx, appID, instance4ID)
-	resolveExpectNotFound(t, ctx, "appV1")
+	utiltest.Resolve(t, ctx, "appV1", 1)
+	utiltest.TerminateApp(t, ctx, appID, instance4ID)
+	utiltest.ResolveExpectNotFound(t, ctx, "appV1")
 
 	// We are already on the first version, no further revert possible.
-	revertAppExpectError(t, ctx, appID, impl.ErrUpdateNoOp.ID)
+	utiltest.RevertAppExpectError(t, ctx, appID, impl.ErrUpdateNoOp.ID)
 
 	// Uninstall the app.
-	uninstallApp(t, ctx, appID)
-	verifyState(t, ctx, device.InstallationStateUninstalled, appID)
+	utiltest.UninstallApp(t, ctx, appID)
+	utiltest.VerifyState(t, ctx, device.InstallationStateUninstalled, appID)
 
 	// Updating the installation should no longer be allowed.
-	updateAppExpectError(t, ctx, appID, impl.ErrInvalidOperation.ID)
+	utiltest.UpdateAppExpectError(t, ctx, appID, impl.ErrInvalidOperation.ID)
 
 	// Reverting the installation should no longer be allowed.
-	revertAppExpectError(t, ctx, appID, impl.ErrInvalidOperation.ID)
+	utiltest.RevertAppExpectError(t, ctx, appID, impl.ErrInvalidOperation.ID)
 
 	// Starting new instances should no longer be allowed.
-	launchAppExpectError(t, ctx, appID, impl.ErrInvalidOperation.ID)
+	utiltest.LaunchAppExpectError(t, ctx, appID, impl.ErrInvalidOperation.ID)
 
 	// Make sure that Kill will actually kill an app that doesn't exit
 	// cleanly Do this by installing, instantiating, running, and killing
 	// hangingApp, which sleeps (rather than exits) after being asked to
 	// Stop()
-	*envelope = envelopeFromShell(sh, nil, hangingAppCmd, "hanging ap", "hAppV1")
-	hAppID := installApp(t, ctx)
-	hInstanceID := launchApp(t, ctx, hAppID)
+	*envelope = utiltest.EnvelopeFromShell(sh, nil, hangingAppCmd, "hanging ap", "hAppV1")
+	hAppID := utiltest.InstallApp(t, ctx)
+	hInstanceID := utiltest.LaunchApp(t, ctx, hAppID)
 	hangingPid := receivePingArgs(t, pingCh).Pid
 	if err := syscall.Kill(hangingPid, 0); err != nil && err != syscall.EPERM {
 		t.Fatalf("Pid of hanging app (%v) is not live", hangingPid)
 	}
-	killApp(t, ctx, hAppID, hInstanceID)
+	utiltest.KillApp(t, ctx, hAppID, hInstanceID)
 	pidIsAlive := true
 	for i := 0; i < 10 && pidIsAlive; i++ {
 		if err := syscall.Kill(hangingPid, 0); err == nil || err == syscall.EPERM {
@@ -904,7 +905,7 @@
 	}
 
 	// Cleanly shut down the device manager.
-	defer verifyNoRunningProcesses(t)
+	defer utiltest.VerifyNoRunningProcesses(t)
 	syscall.Kill(dmh.Pid(), syscall.SIGINT)
 	dmh.Expect("dm terminated")
 	dmh.ExpectEOF()
@@ -954,7 +955,7 @@
 	defer deferFn()
 
 	// Set up mock application and binary repositories.
-	envelope, cleanup := startMockRepos(t, ctx)
+	envelope, cleanup := utiltest.StartMockRepos(t, ctx)
 	defer cleanup()
 
 	root, cleanup := servicetest.SetupRootDir(t, "devicemanager")
@@ -964,7 +965,7 @@
 	}
 
 	// Create a script wrapping the test target that implements suidhelper.
-	helperPath := generateSuidHelperScript(t, root)
+	helperPath := utiltest.GenerateSuidHelperScript(t, root)
 
 	// Set up the device manager.  Since we won't do device manager updates,
 	// don't worry about its application envelope and current link.
@@ -973,9 +974,9 @@
 	pid := servicetest.ReadPID(t, dmh)
 	defer syscall.Kill(pid, syscall.SIGINT)
 
-	*envelope = envelopeFromShell(sh, nil, appCmd, "google naps", "trapp")
+	*envelope = utiltest.EnvelopeFromShell(sh, nil, appCmd, "google naps", "trapp")
 
-	claimantCtx := ctxWithNewPrincipal(t, ctx, idp, "claimant")
+	claimantCtx := utiltest.CtxWithNewPrincipal(t, ctx, idp, "claimant")
 	octx, err := v23.WithPrincipal(ctx, testutil.NewPrincipal("other"))
 	if err != nil {
 		t.Fatal(err)
@@ -989,31 +990,31 @@
 	//installAppExpectError(t, octx, impl.ErrUnclaimedDevice.ID)
 
 	// Claim the device with an incorrect pairing token should fail.
-	claimDeviceExpectError(t, claimantCtx, "claimable", "mydevice", "badtoken", impl.ErrInvalidPairingToken.ID)
+	utiltest.ClaimDeviceExpectError(t, claimantCtx, "claimable", "mydevice", "badtoken", impl.ErrInvalidPairingToken.ID)
 	// But succeed with a valid pairing token
-	claimDevice(t, claimantCtx, "claimable", "dm", "mydevice", pairingToken)
+	utiltest.ClaimDevice(t, claimantCtx, "claimable", "dm", "mydevice", pairingToken)
 
 	// Installation should succeed since claimantRT is now the "owner" of
 	// the devicemanager.
-	appID := installApp(t, claimantCtx)
+	appID := utiltest.InstallApp(t, claimantCtx)
 
 	// octx will not install the app now since it doesn't recognize the
 	// device's blessings. The error returned will be ErrNoServers as that
 	// is what the IPC stack does when there are no authorized servers.
-	installAppExpectError(t, octx, verror.ErrNoServers.ID)
+	utiltest.InstallAppExpectError(t, octx, verror.ErrNoServers.ID)
 	// Even if it does recognize the device (by virtue of recognizing the
 	// claimant), the device will not allow it to install.
 	if err := v23.GetPrincipal(octx).AddToRoots(v23.GetPrincipal(claimantCtx).BlessingStore().Default()); err != nil {
 		t.Fatal(err)
 	}
-	installAppExpectError(t, octx, verror.ErrNoAccess.ID)
+	utiltest.InstallAppExpectError(t, octx, verror.ErrNoAccess.ID)
 
 	// Create the local server that the app uses to let us know it's ready.
 	pingCh, cleanup := setupPingServer(t, claimantCtx)
 	defer cleanup()
 
 	// Start an instance of the app.
-	instanceID := launchApp(t, claimantCtx, appID)
+	instanceID := utiltest.LaunchApp(t, claimantCtx, appID)
 
 	// Wait until the app pings us that it's ready.
 	select {
@@ -1021,8 +1022,8 @@
 	case <-time.After(pingTimeout):
 		t.Fatalf("failed to get ping")
 	}
-	resolve(t, ctx, "trapp", 1)
-	killApp(t, claimantCtx, appID, instanceID)
+	utiltest.Resolve(t, ctx, "trapp", 1)
+	utiltest.KillApp(t, claimantCtx, appID, instanceID)
 
 	// TODO(gauthamt): Test that AccessLists persist across devicemanager restarts
 }
@@ -1034,13 +1035,13 @@
 	// Identity provider to ensure that all processes recognize each
 	// others' blessings.
 	idp := testutil.NewIDProvider("root")
-	ctx = ctxWithNewPrincipal(t, ctx, idp, "self")
+	ctx = utiltest.CtxWithNewPrincipal(t, ctx, idp, "self")
 
 	sh, deferFn := servicetest.CreateShellAndMountTable(t, ctx, nil)
 	defer deferFn()
 
 	// Set up mock application and binary repositories.
-	envelope, cleanup := startMockRepos(t, ctx)
+	envelope, cleanup := utiltest.StartMockRepos(t, ctx)
 	defer cleanup()
 
 	root, cleanup := servicetest.SetupRootDir(t, "devicemanager")
@@ -1050,17 +1051,17 @@
 	}
 
 	selfCtx := ctx
-	octx := ctxWithNewPrincipal(t, selfCtx, idp, "other")
+	octx := utiltest.CtxWithNewPrincipal(t, selfCtx, idp, "other")
 
 	// Set up the device manager.  Since we won't do device manager updates,
 	// don't worry about its application envelope and current link.
 	dmh := servicetest.RunCommand(t, sh, nil, deviceManagerCmd, "dm", root, "unused_helper", "unused_app_repo_name", "unused_curr_link")
 	pid := servicetest.ReadPID(t, dmh)
 	defer syscall.Kill(pid, syscall.SIGINT)
-	defer verifyNoRunningProcesses(t)
+	defer utiltest.VerifyNoRunningProcesses(t)
 
 	// Create an envelope for an app.
-	*envelope = envelopeFromShell(sh, nil, appCmd, "google naps")
+	*envelope = utiltest.EnvelopeFromShell(sh, nil, appCmd, "google naps")
 
 	// On an unclaimed device manager, there will be no AccessLists.
 	if _, _, err := device.DeviceClient("claimable").GetPermissions(selfCtx); err == nil {
@@ -1068,7 +1069,7 @@
 	}
 
 	// Claim the devicemanager as "root/self/mydevice"
-	claimDevice(t, selfCtx, "claimable", "dm", "mydevice", noPairingToken)
+	utiltest.ClaimDevice(t, selfCtx, "claimable", "dm", "mydevice", noPairingToken)
 	expectedAccessList := make(access.Permissions)
 	for _, tag := range access.AllTypicalTags() {
 		expectedAccessList[string(tag)] = access.AccessList{In: []security.BlessingPattern{"root/$", "root/self/$", "root/self/mydevice/$"}}
@@ -1090,7 +1091,7 @@
 		t.Fatalf("getAccessList expected:%v(%v), got:%v(%v)", expectedAccessList, expectedVersion, perms, version)
 	}
 	// Install from octx should fail, since it does not match the AccessList.
-	installAppExpectError(t, octx, verror.ErrNoAccess.ID)
+	utiltest.InstallAppExpectError(t, octx, verror.ErrNoAccess.ID)
 
 	newAccessList := make(access.Permissions)
 	for _, tag := range access.AllTypicalTags() {
@@ -1104,8 +1105,8 @@
 	}
 	// Install should now fail with selfCtx, which no longer matches the
 	// AccessLists but succeed with octx, which does.
-	installAppExpectError(t, selfCtx, verror.ErrNoAccess.ID)
-	installApp(t, octx)
+	utiltest.InstallAppExpectError(t, selfCtx, verror.ErrNoAccess.ID)
+	utiltest.InstallApp(t, octx)
 }
 
 type simpleRW chan []byte
@@ -1134,9 +1135,9 @@
 	// No need to call SaveCreatorInfo() here because that's part of SelfInstall below
 
 	// Create a script wrapping the test target that implements suidhelper.
-	suidHelperPath := generateSuidHelperScript(t, testDir)
+	suidHelperPath := utiltest.GenerateSuidHelperScript(t, testDir)
 	// Create a dummy script mascarading as the security agent.
-	agentPath := generateAgentScript(t, testDir)
+	agentPath := utiltest.GenerateAgentScript(t, testDir)
 	initHelperPath := ""
 
 	// Create an 'envelope' for the device manager that we can pass to the
@@ -1150,7 +1151,7 @@
 		t.Fatalf("SelfInstall failed: %v", err)
 	}
 
-	resolveExpectNotFound(t, ctx, "dm")
+	utiltest.ResolveExpectNotFound(t, ctx, "dm")
 	// Start the device manager.
 	stdout := make(simpleRW, 100)
 	defer os.Setenv(redirectEnv, os.Getenv(redirectEnv))
@@ -1160,8 +1161,8 @@
 	}
 	dms := expect.NewSession(t, stdout, servicetest.ExpectTimeout)
 	servicetest.ReadPID(t, dms)
-	claimDevice(t, ctx, "claimable", "dm", "mydevice", noPairingToken)
-	revertDeviceExpectError(t, ctx, "dm", impl.ErrUpdateNoOp.ID) // No previous version available.
+	utiltest.ClaimDevice(t, ctx, "claimable", "dm", "mydevice", noPairingToken)
+	utiltest.RevertDeviceExpectError(t, ctx, "dm", impl.ErrUpdateNoOp.ID) // No previous version available.
 
 	// Stop the device manager.
 	if err := impl.Stop(ctx, dmDir, os.Stderr, os.Stdout); err != nil {
@@ -1191,7 +1192,7 @@
 	defer deferFn()
 
 	// Set up mock application and binary repositories.
-	envelope, cleanup := startMockRepos(t, ctx)
+	envelope, cleanup := utiltest.StartMockRepos(t, ctx)
 	defer cleanup()
 
 	root, cleanup := servicetest.SetupRootDir(t, "devicemanager")
@@ -1201,7 +1202,7 @@
 	}
 
 	// Create a script wrapping the test target that implements suidhelper.
-	helperPath := generateSuidHelperScript(t, root)
+	helperPath := utiltest.GenerateSuidHelperScript(t, root)
 
 	// Set up the device manager.  Since we won't do device manager updates,
 	// don't worry about its application envelope and current link.
@@ -1214,17 +1215,17 @@
 	defer cleanup()
 
 	// Create the envelope for the first version of the app.
-	*envelope = envelopeFromShell(sh, nil, appCmd, "google naps", "appV1")
+	*envelope = utiltest.EnvelopeFromShell(sh, nil, appCmd, "google naps", "appV1")
 
 	// Device must be claimed before applications can be installed.
-	claimDevice(t, ctx, "claimable", "dm", "mydevice", noPairingToken)
+	utiltest.ClaimDevice(t, ctx, "claimable", "dm", "mydevice", noPairingToken)
 	// Install the app.
-	appID := installApp(t, ctx)
+	appID := utiltest.InstallApp(t, ctx)
 	install1ID := path.Base(appID)
 
 	// Start an instance of the app.
-	instance1ID := launchApp(t, ctx, appID)
-	defer terminateApp(t, ctx, appID, instance1ID)
+	instance1ID := utiltest.LaunchApp(t, ctx, appID)
+	defer utiltest.TerminateApp(t, ctx, appID, instance1ID)
 
 	// Wait until the app pings us that it's ready.
 	select {
@@ -1233,7 +1234,7 @@
 		t.Fatalf("failed to get ping")
 	}
 
-	app2ID := installApp(t, ctx)
+	app2ID := utiltest.InstallApp(t, ctx)
 	install2ID := path.Base(app2ID)
 
 	// Base name of argv[0] that the app should have when it executes
@@ -1242,7 +1243,7 @@
 	// Someday in future we may remove that and have binary names that reflect the app name.
 	const appName = "app"
 
-	testcases := []globTestVector{
+	testcases := []utiltest.GlobTestVector{
 		{"dm", "...", []string{
 			"",
 			"apps",
@@ -1276,12 +1277,12 @@
 		{"dm/apps/google naps/" + install1ID + "/" + instance1ID + "/stats/system", "start-time*", []string{"start-time-rfc1123", "start-time-unix"}},
 	}
 
-	res := newGlobTestRegexHelper(appName)
+	res := utiltest.NewGlobTestRegexHelper(appName)
 
-	verifyGlob(t, ctx, appName, testcases, res)
-	verifyLog(t, ctx, "dm", "apps/google naps", install1ID, instance1ID, "logs", "*")
-	verifyStatsValues(t, ctx, "dm", "apps/google naps", install1ID, instance1ID, "stats/system/start-time*")
-	verifyPProfCmdLine(t, ctx, appName, "dm", "apps/google naps", install1ID, instance1ID, "pprof")
+	utiltest.VerifyGlob(t, ctx, appName, testcases, res)
+	utiltest.VerifyLog(t, ctx, "dm", "apps/google naps", install1ID, instance1ID, "logs", "*")
+	utiltest.VerifyStatsValues(t, ctx, "dm", "apps/google naps", install1ID, instance1ID, "stats/system/start-time*")
+	utiltest.VerifyPProfCmdLine(t, ctx, appName, "dm", "apps/google naps", install1ID, instance1ID, "pprof")
 }
 
 // TODO(caprita): We need better test coverage for how updating/reverting apps
@@ -1294,7 +1295,7 @@
 	defer deferFn()
 
 	// Set up mock application and binary repositories.
-	envelope, cleanup := startMockRepos(t, ctx)
+	envelope, cleanup := utiltest.StartMockRepos(t, ctx)
 	defer cleanup()
 
 	binaryVON := "realbin"
@@ -1333,21 +1334,21 @@
 	}
 
 	// Create a script wrapping the test target that implements suidhelper.
-	helperPath := generateSuidHelperScript(t, root)
+	helperPath := utiltest.GenerateSuidHelperScript(t, root)
 
 	// Set up the device manager.  Since we won't do device manager updates,
 	// don't worry about its application envelope and current link.
 	dmh := servicetest.RunCommand(t, sh, nil, deviceManagerCmd, "dm", root, helperPath, "unused_app_repo_name", "unused_curr_link")
 	pid := servicetest.ReadPID(t, dmh)
 	defer syscall.Kill(pid, syscall.SIGINT)
-	defer verifyNoRunningProcesses(t)
+	defer utiltest.VerifyNoRunningProcesses(t)
 
 	// Create the local server that the app uses to let us know it's ready.
 	pingCh, cleanup := setupPingServer(t, ctx)
 	defer cleanup()
 
 	// Create the envelope for the first version of the app.
-	*envelope = envelopeFromShell(sh, nil, appCmd, "google naps", "appV1")
+	*envelope = utiltest.EnvelopeFromShell(sh, nil, appCmd, "google naps", "appV1")
 	envelope.Packages = map[string]application.SignedFile{
 		"test": application.SignedFile{
 			File: "realbin/testpkg",
@@ -1372,13 +1373,13 @@
 		},
 	}
 	// Device must be claimed before apps can be installed.
-	claimDevice(t, ctx, "claimable", "dm", "mydevice", noPairingToken)
+	utiltest.ClaimDevice(t, ctx, "claimable", "dm", "mydevice", noPairingToken)
 	// Install the app.
-	appID := installApp(t, ctx, packages)
+	appID := utiltest.InstallApp(t, ctx, packages)
 
 	// Start an instance of the app.
-	instance1ID := launchApp(t, ctx, appID)
-	defer terminateApp(t, ctx, appID, instance1ID)
+	instance1ID := utiltest.LaunchApp(t, ctx, appID)
+	defer utiltest.TerminateApp(t, ctx, appID, instance1ID)
 
 	// Wait until the app pings us that it's ready.
 	select {
@@ -1425,7 +1426,7 @@
 	if err != nil {
 		t.Fatalf("ListAssociations failed %v", err)
 	}
-	compareAssociations(t, assocs, expected)
+	utiltest.CompareAssociations(t, assocs, expected)
 }
 
 // TODO(rjkroege): Verify that associations persist across restarts once
@@ -1448,8 +1449,8 @@
 	// Since these blessings will appear in AccessLists, give them
 	// recognizable names.
 	idp := testutil.NewIDProvider("root")
-	selfCtx := ctxWithNewPrincipal(t, ctx, idp, "self")
-	otherCtx := ctxWithNewPrincipal(t, selfCtx, idp, "other")
+	selfCtx := utiltest.CtxWithNewPrincipal(t, ctx, idp, "self")
+	otherCtx := utiltest.CtxWithNewPrincipal(t, selfCtx, idp, "other")
 	// Both the "external" processes must recognize the root mounttable's
 	// blessings, otherwise they will not talk to it.
 	for _, c := range []*context.T{selfCtx, otherCtx} {
@@ -1459,7 +1460,7 @@
 	dmh := servicetest.RunCommand(t, sh, nil, deviceManagerCmd, "dm", root, "unused_helper", "unused_app_repo_name", "unused_curr_link")
 	pid := servicetest.ReadPID(t, dmh)
 	defer syscall.Kill(pid, syscall.SIGINT)
-	defer verifyNoRunningProcesses(t)
+	defer utiltest.VerifyNoRunningProcesses(t)
 
 	// Attempt to list associations on the device manager without having
 	// claimed it.
@@ -1468,7 +1469,7 @@
 	}
 
 	// self claims the device manager.
-	claimDevice(t, selfCtx, "claimable", "dm", "alice", noPairingToken)
+	utiltest.ClaimDevice(t, selfCtx, "claimable", "dm", "alice", noPairingToken)
 
 	vlog.VI(2).Info("Verify that associations start out empty.")
 	deviceStub := device.DeviceClient("dm/device")
@@ -1541,7 +1542,7 @@
 	defer deferFn()
 
 	// Set up mock application and binary repositories.
-	envelope, cleanup := startMockRepos(t, ctx)
+	envelope, cleanup := utiltest.StartMockRepos(t, ctx)
 	defer cleanup()
 
 	root, cleanup := servicetest.SetupRootDir(t, "devicemanager")
@@ -1551,17 +1552,17 @@
 	}
 
 	selfCtx := ctx
-	otherCtx := ctxWithNewPrincipal(t, selfCtx, idp, "other")
+	otherCtx := utiltest.CtxWithNewPrincipal(t, selfCtx, idp, "other")
 
 	// Create a script wrapping the test target that implements suidhelper.
-	helperPath := generateSuidHelperScript(t, root)
+	helperPath := utiltest.GenerateSuidHelperScript(t, root)
 
 	dmh := servicetest.RunCommand(t, sh, nil, deviceManagerCmd, "-mocksetuid", "dm", root, helperPath, "unused_app_repo_name", "unused_curr_link")
 	pid := servicetest.ReadPID(t, dmh)
 	defer syscall.Kill(pid, syscall.SIGINT)
-	defer verifyNoRunningProcesses(t)
+	defer utiltest.VerifyNoRunningProcesses(t)
 	// Claim the devicemanager with selfCtx as root/self/alice
-	claimDevice(t, selfCtx, "claimable", "dm", "alice", noPairingToken)
+	utiltest.ClaimDevice(t, selfCtx, "claimable", "dm", "alice", noPairingToken)
 
 	deviceStub := device.DeviceClient("dm/device")
 
@@ -1571,13 +1572,13 @@
 	defer cleanup()
 
 	// Create an envelope for a first version of the app.
-	*envelope = envelopeFromShell(sh, []string{testEnvVarName + "=env-var"}, appCmd, "google naps", fmt.Sprintf("--%s=flag-val-envelope", testFlagName), "appV1")
+	*envelope = utiltest.EnvelopeFromShell(sh, []string{testEnvVarName + "=env-var"}, appCmd, "google naps", fmt.Sprintf("--%s=flag-val-envelope", testFlagName), "appV1")
 
 	// Install and start the app as root/self.
-	appID := installApp(t, selfCtx)
+	appID := utiltest.InstallApp(t, selfCtx)
 
 	vlog.VI(2).Infof("Validate that the created app has the right permission lists.")
-	perms, _, err := appStub(appID).GetPermissions(selfCtx)
+	perms, _, err := utiltest.AppStub(appID).GetPermissions(selfCtx)
 	if err != nil {
 		t.Fatalf("GetPermissions on appID: %v failed %v", appID, err)
 	}
@@ -1591,19 +1592,19 @@
 
 	// Start an instance of the app but this time it should fail: we do not
 	// have an associated uname for the invoking identity.
-	launchAppExpectError(t, selfCtx, appID, verror.ErrNoAccess.ID)
+	utiltest.LaunchAppExpectError(t, selfCtx, appID, verror.ErrNoAccess.ID)
 
 	// Create an association for selfCtx
 	if err := deviceStub.AssociateAccount(selfCtx, []string{"root/self"}, testUserName); err != nil {
 		t.Fatalf("AssociateAccount failed %v", err)
 	}
 
-	instance1ID := launchApp(t, selfCtx, appID)
+	instance1ID := utiltest.LaunchApp(t, selfCtx, appID)
 	verifyPingArgs(t, pingCh, testUserName, "flag-val-envelope", "env-var") // Wait until the app pings us that it's ready.
-	terminateApp(t, selfCtx, appID, instance1ID)
+	utiltest.TerminateApp(t, selfCtx, appID, instance1ID)
 
 	vlog.VI(2).Infof("other attempting to run an app without access. Should fail.")
-	launchAppExpectError(t, otherCtx, appID, verror.ErrNoAccess.ID)
+	utiltest.LaunchAppExpectError(t, otherCtx, appID, verror.ErrNoAccess.ID)
 
 	// Self will now let other also install apps.
 	if err := deviceStub.AssociateAccount(selfCtx, []string{"root/other"}, testUserName); err != nil {
@@ -1624,21 +1625,21 @@
 	// other doesn't have execution permissions for the app. So this will
 	// fail.
 	vlog.VI(2).Infof("other attempting to run an app still without access. Should fail.")
-	launchAppExpectError(t, otherCtx, appID, verror.ErrNoAccess.ID)
+	utiltest.LaunchAppExpectError(t, otherCtx, appID, verror.ErrNoAccess.ID)
 
 	// But self can give other permissions  to start applications.
 	vlog.VI(2).Infof("self attempting to give other permission to start %s", appID)
-	newAccessList, _, err = appStub(appID).GetPermissions(selfCtx)
+	newAccessList, _, err = utiltest.AppStub(appID).GetPermissions(selfCtx)
 	if err != nil {
 		t.Fatalf("GetPermissions on appID: %v failed %v", appID, err)
 	}
 	newAccessList.Add("root/other", string(access.Read))
-	if err = appStub(appID).SetPermissions(selfCtx, newAccessList, ""); err != nil {
+	if err = utiltest.AppStub(appID).SetPermissions(selfCtx, newAccessList, ""); err != nil {
 		t.Fatalf("SetPermissions on appID: %v failed: %v", appID, err)
 	}
 
 	vlog.VI(2).Infof("other attempting to run an app with access. Should succeed.")
-	instance2ID := launchApp(t, otherCtx, appID)
+	instance2ID := utiltest.LaunchApp(t, otherCtx, appID)
 	verifyPingArgs(t, pingCh, testUserName, "flag-val-envelope", "env-var") // Wait until the app pings us that it's ready.
 
 	vlog.VI(2).Infof("Validate that created instance has the right permissions.")
@@ -1646,7 +1647,7 @@
 	for _, tag := range access.AllTypicalTags() {
 		expected[string(tag)] = access.AccessList{In: []security.BlessingPattern{"root/other/$"}}
 	}
-	perms, _, err = appStub(appID, instance2ID).GetPermissions(selfCtx)
+	perms, _, err = utiltest.AppStub(appID, instance2ID).GetPermissions(selfCtx)
 	if err != nil {
 		t.Fatalf("GetPermissions on instance %v/%v failed: %v", appID, instance2ID, err)
 	}
@@ -1655,22 +1656,22 @@
 	}
 
 	// Shutdown the app.
-	killApp(t, otherCtx, appID, instance2ID)
+	utiltest.KillApp(t, otherCtx, appID, instance2ID)
 
 	vlog.VI(2).Infof("Verify that Run with the same systemName works.")
-	runApp(t, otherCtx, appID, instance2ID)
+	utiltest.RunApp(t, otherCtx, appID, instance2ID)
 	verifyPingArgs(t, pingCh, testUserName, "flag-val-envelope", "env-var") // Wait until the app pings us that it's ready.
-	killApp(t, otherCtx, appID, instance2ID)
+	utiltest.KillApp(t, otherCtx, appID, instance2ID)
 
 	vlog.VI(2).Infof("Verify that other can install and run applications.")
-	otherAppID := installApp(t, otherCtx)
+	otherAppID := utiltest.InstallApp(t, otherCtx)
 
 	vlog.VI(2).Infof("other attempting to run an app that other installed. Should succeed.")
-	instance4ID := launchApp(t, otherCtx, otherAppID)
+	instance4ID := utiltest.LaunchApp(t, otherCtx, otherAppID)
 	verifyPingArgs(t, pingCh, testUserName, "flag-val-envelope", "env-var") // Wait until the app pings us that it's ready.
 
 	// Clean up.
-	terminateApp(t, otherCtx, otherAppID, instance4ID)
+	utiltest.TerminateApp(t, otherCtx, otherAppID, instance4ID)
 
 	// Change the associated system name.
 	if err := deviceStub.AssociateAccount(selfCtx, []string{"root/other"}, anotherTestUserName); err != nil {
@@ -1678,17 +1679,17 @@
 	}
 
 	vlog.VI(2).Infof("Show that Run with a different systemName fails.")
-	runAppExpectError(t, otherCtx, appID, instance2ID, verror.ErrNoAccess.ID)
+	utiltest.RunAppExpectError(t, otherCtx, appID, instance2ID, verror.ErrNoAccess.ID)
 
 	// Clean up.
-	deleteApp(t, otherCtx, appID, instance2ID)
+	utiltest.DeleteApp(t, otherCtx, appID, instance2ID)
 
 	vlog.VI(2).Infof("Show that Start with different systemName works.")
-	instance3ID := launchApp(t, otherCtx, appID)
+	instance3ID := utiltest.LaunchApp(t, otherCtx, appID)
 	verifyPingArgs(t, pingCh, anotherTestUserName, "flag-val-envelope", "env-var") // Wait until the app pings us that it's ready.
 
 	// Clean up.
-	terminateApp(t, otherCtx, appID, instance3ID)
+	utiltest.TerminateApp(t, otherCtx, appID, instance3ID)
 }
 
 func TestDownloadSignatureMatch(t *testing.T) {
@@ -1725,7 +1726,7 @@
 	}
 
 	// Start the application repository
-	envelope, serverStop := startApplicationRepository(ctx)
+	envelope, serverStop := utiltest.StartApplicationRepository(ctx)
 	defer serverStop()
 
 	root, cleanup := servicetest.SetupRootDir(t, "devicemanager")
@@ -1735,14 +1736,14 @@
 	}
 
 	// Create a script wrapping the test target that implements suidhelper.
-	helperPath := generateSuidHelperScript(t, root)
+	helperPath := utiltest.GenerateSuidHelperScript(t, root)
 
 	// Set up the device manager.  Since we won't do device manager updates,
 	// don't worry about its application envelope and current link.
 	dmh := servicetest.RunCommand(t, sh, nil, deviceManagerCmd, "dm", root, helperPath, "unused_app_repo_name", "unused_curr_link")
 	pid := servicetest.ReadPID(t, dmh)
 	defer syscall.Kill(pid, syscall.SIGINT)
-	claimDevice(t, ctx, "claimable", "dm", "mydevice", noPairingToken)
+	utiltest.ClaimDevice(t, ctx, "claimable", "dm", "mydevice", noPairingToken)
 
 	publisher, err := v23.GetPrincipal(ctx).BlessSelf("publisher")
 	if err != nil {
@@ -1761,7 +1762,7 @@
 			},
 		},
 	}
-	if _, err := appStub().Install(ctx, mockApplicationRepoName, device.Config{}, nil); err != nil {
+	if _, err := utiltest.AppStub().Install(ctx, utiltest.MockApplicationRepoName, device.Config{}, nil); err != nil {
 		t.Fatalf("Failed to Install app:%v", err)
 	}
 
@@ -1773,7 +1774,7 @@
 	if _, err := binarylib.Upload(ctx, naming.Join(binaryVON, "testbinary"), up, mediaInfo); err != nil {
 		t.Fatalf("Upload(%v) failed:%v", binaryVON, err)
 	}
-	if _, err := appStub().Install(ctx, mockApplicationRepoName, device.Config{}, nil); verror.ErrorID(err) != impl.ErrOperationFailed.ID {
+	if _, err := utiltest.AppStub().Install(ctx, utiltest.MockApplicationRepoName, device.Config{}, nil); verror.ErrorID(err) != impl.ErrOperationFailed.ID {
 		t.Fatalf("Failed to verify signature mismatch for binary:%v. Got errorid=%v[%v], want errorid=%v", binaryVON, verror.ErrorID(err), err, impl.ErrOperationFailed.ID)
 	}
 
@@ -1785,7 +1786,7 @@
 	if _, err := binarylib.Upload(ctx, naming.Join(binaryVON, "testbinary"), up, mediaInfo); err != nil {
 		t.Fatalf("Upload(%v) failed:%v", binaryVON, err)
 	}
-	if _, err := appStub().Install(ctx, mockApplicationRepoName, device.Config{}, nil); err != nil {
+	if _, err := utiltest.AppStub().Install(ctx, utiltest.MockApplicationRepoName, device.Config{}, nil); err != nil {
 		t.Fatalf("Failed to Install app:%v", err)
 	}
 
@@ -1803,7 +1804,7 @@
 	if _, err = binarylib.UploadFromDir(ctx, pkgVON, tmpdir); err != nil {
 		t.Fatalf("binarylib.UploadFromDir failed: %v", err)
 	}
-	if _, err := appStub().Install(ctx, mockApplicationRepoName, device.Config{}, nil); verror.ErrorID(err) != impl.ErrOperationFailed.ID {
+	if _, err := utiltest.AppStub().Install(ctx, utiltest.MockApplicationRepoName, device.Config{}, nil); verror.ErrorID(err) != impl.ErrOperationFailed.ID {
 		t.Fatalf("Failed to verify signature mismatch for package:%v", pkgVON)
 	}
 }
diff --git a/services/device/internal/impl/instance_reaping.go b/services/device/internal/impl/instance_reaping.go
index 30d2ce6..3560db2 100644
--- a/services/device/internal/impl/instance_reaping.go
+++ b/services/device/internal/impl/instance_reaping.go
@@ -258,3 +258,9 @@
 	}
 	return pidmap, nil
 }
+
+// RunningChildrenProcesses uses the reaper to verify that a test has
+// successfully shut down all processes.
+func RunningChildrenProcesses() bool {
+	return len(stashedPidMap) > 0
+}
diff --git a/services/device/internal/impl/instance_reaping_test.go b/services/device/internal/impl/instance_reaping_test.go
index 2ff35fa..4b34b81 100644
--- a/services/device/internal/impl/instance_reaping_test.go
+++ b/services/device/internal/impl/instance_reaping_test.go
@@ -19,34 +19,35 @@
 	"v.io/v23/vdl"
 
 	"v.io/x/ref/envvar"
+	"v.io/x/ref/services/device/internal/impl/utiltest"
 	"v.io/x/ref/services/internal/servicetest"
 )
 
 func TestReaperNoticesAppDeath(t *testing.T) {
-	cleanup, ctx, sh, envelope, root, helperPath, _ := startupHelper(t)
+	cleanup, ctx, sh, envelope, root, helperPath, _ := utiltest.StartupHelper(t)
 	defer cleanup()
 
 	// Set up the device manager.  Since we won't do device manager updates,
 	// don't worry about its application envelope and current link.
 	dmh := servicetest.RunCommand(t, sh, nil, deviceManagerCmd, "dm", root, helperPath, "unused_app_repo_name", "unused_curr_link")
 	servicetest.ReadPID(t, dmh)
-	claimDevice(t, ctx, "claimable", "dm", "mydevice", noPairingToken)
+	utiltest.ClaimDevice(t, ctx, "claimable", "dm", "mydevice", noPairingToken)
 
 	// Create the local server that the app uses to let us know it's ready.
 	pingCh, cleanup := setupPingServer(t, ctx)
 	defer cleanup()
 
-	resolve(t, ctx, "pingserver", 1)
+	utiltest.Resolve(t, ctx, "pingserver", 1)
 
 	// Create an envelope for a first version of the app.
-	*envelope = envelopeFromShell(sh, nil, appCmd, "google naps", "appV1")
+	*envelope = utiltest.EnvelopeFromShell(sh, nil, appCmd, "google naps", "appV1")
 
 	// Install the app.  The config-specified flag value for testFlagName
 	// should override the value specified in the envelope above.
-	appID := installApp(t, ctx)
+	appID := utiltest.InstallApp(t, ctx)
 
 	// Start an instance of the app.
-	instance1ID := launchApp(t, ctx, appID)
+	instance1ID := utiltest.LaunchApp(t, ctx, appID)
 
 	// Wait until the app pings us that it's ready.
 	verifyPingArgs(t, pingCh, userName(t), "default", "")
@@ -63,22 +64,22 @@
 		t.Fatalf("pid returned from stats interface is not an int: %v", err)
 	}
 
-	verifyState(t, ctx, device.InstanceStateRunning, appID, instance1ID)
+	utiltest.VerifyState(t, ctx, device.InstanceStateRunning, appID, instance1ID)
 	syscall.Kill(int(pid), 9)
 
 	// Start a second instance of the app which will force polling to happen.
-	instance2ID := launchApp(t, ctx, appID)
+	instance2ID := utiltest.LaunchApp(t, ctx, appID)
 	verifyPingArgs(t, pingCh, userName(t), "default", "")
 
-	verifyState(t, ctx, device.InstanceStateRunning, appID, instance2ID)
+	utiltest.VerifyState(t, ctx, device.InstanceStateRunning, appID, instance2ID)
 
-	terminateApp(t, ctx, appID, instance2ID)
-	verifyState(t, ctx, device.InstanceStateNotRunning, appID, instance1ID)
+	utiltest.TerminateApp(t, ctx, appID, instance2ID)
+	utiltest.VerifyState(t, ctx, device.InstanceStateNotRunning, appID, instance1ID)
 
 	// TODO(rjkroege): Exercise the polling loop code.
 
 	// Cleanly shut down the device manager.
-	verifyNoRunningProcesses(t)
+	utiltest.VerifyNoRunningProcesses(t)
 	syscall.Kill(dmh.Pid(), syscall.SIGINT)
 	dmh.Expect("dm terminated")
 	dmh.ExpectEOF()
@@ -95,7 +96,7 @@
 }
 
 func TestReapReconciliation(t *testing.T) {
-	cleanup, ctx, sh, envelope, root, helperPath, _ := startupHelper(t)
+	cleanup, ctx, sh, envelope, root, helperPath, _ := utiltest.StartupHelper(t)
 	defer cleanup()
 
 	// Start a device manager.
@@ -110,23 +111,23 @@
 
 	dmh := servicetest.RunCommand(t, sh, dmEnv, deviceManagerCmd, "dm", root, helperPath, "unused_app_repo_name", "unused_curr_link")
 	servicetest.ReadPID(t, dmh)
-	claimDevice(t, ctx, "claimable", "dm", "mydevice", noPairingToken)
+	utiltest.ClaimDevice(t, ctx, "claimable", "dm", "mydevice", noPairingToken)
 
 	// Create the local server that the app uses to let us know it's ready.
 	pingCh, cleanup := setupPingServer(t, ctx)
 	defer cleanup()
-	resolve(t, ctx, "pingserver", 1)
+	utiltest.Resolve(t, ctx, "pingserver", 1)
 
 	// Create an envelope for the app.
-	*envelope = envelopeFromShell(sh, nil, appCmd, "google naps", "appV1")
+	*envelope = utiltest.EnvelopeFromShell(sh, nil, appCmd, "google naps", "appV1")
 
 	// Install the app.
-	appID := installApp(t, ctx)
+	appID := utiltest.InstallApp(t, ctx)
 
 	// Start three app instances.
 	instances := make([]string, 3)
 	for i, _ := range instances {
-		instances[i] = launchApp(t, ctx, appID)
+		instances[i] = utiltest.LaunchApp(t, ctx, appID)
 		verifyPingArgs(t, pingCh, userName(t), "default", "")
 	}
 
@@ -138,7 +139,7 @@
 	dmh.Expect("dm terminated")
 	dmh.ExpectEOF()
 	dmh.Shutdown(os.Stderr, os.Stderr)
-	resolveExpectNotFound(t, ctx, "dm") // Ensure a clean slate.
+	utiltest.ResolveExpectNotFound(t, ctx, "dm") // Ensure a clean slate.
 
 	// Kill instance[0] and wait until it exits before proceeding.
 	syscall.Kill(pid, 9)
@@ -155,18 +156,18 @@
 	// Run another device manager to replace the dead one.
 	dmh = servicetest.RunCommand(t, sh, dmEnv, deviceManagerCmd, "dm", root, helperPath, "unused_app_repo_name", "unused_curr_link")
 	servicetest.ReadPID(t, dmh)
-	resolve(t, ctx, "dm", 1) // Verify the device manager has published itself.
+	utiltest.Resolve(t, ctx, "dm", 1) // Verify the device manager has published itself.
 
 	// By now, we've reconciled the state of the tree with which processes
 	// are actually alive. instance-0 is not alive.
 	expected := []device.InstanceState{device.InstanceStateNotRunning, device.InstanceStateRunning, device.InstanceStateRunning}
 	for i, _ := range instances {
-		verifyState(t, ctx, expected[i], appID, instances[i])
+		utiltest.VerifyState(t, ctx, expected[i], appID, instances[i])
 	}
 
 	// Start instance[0] over-again to show that an app marked not running
 	// by reconciliation can be restarted.
-	runApp(t, ctx, appID, instances[0])
+	utiltest.RunApp(t, ctx, appID, instances[0])
 	verifyPingArgs(t, pingCh, userName(t), "default", "")
 
 	// Kill instance[1]
@@ -175,31 +176,31 @@
 
 	// Make a fourth instance. This forces a polling of processes so that
 	// the state is updated.
-	instances = append(instances, launchApp(t, ctx, appID))
+	instances = append(instances, utiltest.LaunchApp(t, ctx, appID))
 	verifyPingArgs(t, pingCh, userName(t), "default", "")
 
 	// Stop the fourth instance to make sure that there's no way we could
 	// still be running the polling loop before doing the below.
-	terminateApp(t, ctx, appID, instances[3])
+	utiltest.TerminateApp(t, ctx, appID, instances[3])
 
 	// Verify that reaper picked up the previous instances and was watching
 	// instance[1]
 	expected = []device.InstanceState{device.InstanceStateRunning, device.InstanceStateNotRunning, device.InstanceStateRunning, device.InstanceStateDeleted}
 	for i, _ := range instances {
-		verifyState(t, ctx, expected[i], appID, instances[i])
+		utiltest.VerifyState(t, ctx, expected[i], appID, instances[i])
 	}
 
-	terminateApp(t, ctx, appID, instances[2])
+	utiltest.TerminateApp(t, ctx, appID, instances[2])
 
 	expected = []device.InstanceState{device.InstanceStateRunning, device.InstanceStateNotRunning, device.InstanceStateDeleted, device.InstanceStateDeleted}
 	for i, _ := range instances {
-		verifyState(t, ctx, expected[i], appID, instances[i])
+		utiltest.VerifyState(t, ctx, expected[i], appID, instances[i])
 	}
-	terminateApp(t, ctx, appID, instances[0])
+	utiltest.TerminateApp(t, ctx, appID, instances[0])
 
 	// TODO(rjkroege): Should be in a defer to ensure that the device
 	// manager is cleaned up even if the test fails in an exceptional way.
-	verifyNoRunningProcesses(t)
+	utiltest.VerifyNoRunningProcesses(t)
 	syscall.Kill(dmh.Pid(), syscall.SIGINT)
 	dmh.Expect("dm terminated")
 	dmh.ExpectEOF()
diff --git a/services/device/internal/impl/only_for_test.go b/services/device/internal/impl/only_for_test.go
index 583d545..23bcc37 100644
--- a/services/device/internal/impl/only_for_test.go
+++ b/services/device/internal/impl/only_for_test.go
@@ -68,9 +68,3 @@
 func WrapBaseCleanupDir(path, helper string) {
 	baseCleanupDir(path, helper)
 }
-
-// RunningChildrenProcesses uses the reaper to verify that a test has
-// successfully shut down all processes.
-func RunningChildrenProcesses() bool {
-	return len(stashedPidMap) > 0
-}
diff --git a/services/device/internal/impl/util_test.go b/services/device/internal/impl/utiltest/helpers.go
similarity index 73%
rename from services/device/internal/impl/util_test.go
rename to services/device/internal/impl/utiltest/helpers.go
index c043873..e118a60 100644
--- a/services/device/internal/impl/util_test.go
+++ b/services/device/internal/impl/utiltest/helpers.go
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
-package impl_test
+package utiltest
 
 import (
 	"errors"
@@ -45,7 +45,7 @@
 	killTimeout = 20 * time.Second
 )
 
-func envelopeFromShell(sh *modules.Shell, env []string, cmd, title string, args ...string) application.Envelope {
+func EnvelopeFromShell(sh *modules.Shell, env []string, cmd, title string, args ...string) application.Envelope {
 	args, nenv := sh.CommandEnvelope(cmd, env, args...)
 	return application.Envelope{
 		Title: title,
@@ -53,12 +53,12 @@
 		// TODO(caprita): revisit how the environment is sanitized for arbirary
 		// apps.
 		Env:    impl.VanadiumEnvironment(nenv),
-		Binary: application.SignedFile{File: mockBinaryRepoName},
+		Binary: application.SignedFile{File: MockBinaryRepoName},
 	}
 }
 
-// resolveExpectNotFound verifies that the given name is not in the mounttable.
-func resolveExpectNotFound(t *testing.T, ctx *context.T, name string) {
+// ResolveExpectNotFound verifies that the given name is not in the mounttable.
+func ResolveExpectNotFound(t *testing.T, ctx *context.T, name string) {
 	if me, err := v23.GetNamespace(ctx).Resolve(ctx, name); err == nil {
 		t.Fatalf(testutil.FormatLogLine(2, "Resolve(%v) succeeded with results %v when it was expected to fail", name, me.Names()))
 	} else if expectErr := naming.ErrNoSuchName.ID; verror.ErrorID(err) != expectErr {
@@ -66,8 +66,8 @@
 	}
 }
 
-// resolve looks up the given name in the mounttable.
-func resolve(t *testing.T, ctx *context.T, name string, replicas int) []string {
+// Resolve looks up the given name in the mounttable.
+func Resolve(t *testing.T, ctx *context.T, name string, replicas int) []string {
 	me, err := v23.GetNamespace(ctx).Resolve(ctx, name)
 	if err != nil {
 		t.Fatalf("Resolve(%v) failed: %v", name, err)
@@ -89,12 +89,12 @@
 // The following set of functions are convenience wrappers around Update and
 // Revert for device manager.
 
-func deviceStub(name string) device.DeviceClientMethods {
+func DeviceStub(name string) device.DeviceClientMethods {
 	deviceName := naming.Join(name, "device")
 	return device.DeviceClient(deviceName)
 }
 
-func claimDevice(t *testing.T, ctx *context.T, claimableName, deviceName, extension, pairingToken string) {
+func ClaimDevice(t *testing.T, ctx *context.T, claimableName, deviceName, extension, pairingToken string) {
 	// Setup blessings to be granted to the claimed device
 	g := &granter{extension: extension}
 	s := options.SkipServerEndpointAuthorization{}
@@ -119,7 +119,7 @@
 	}
 }
 
-func claimDeviceExpectError(t *testing.T, ctx *context.T, name, extension, pairingToken string, errID verror.ID) {
+func ClaimDeviceExpectError(t *testing.T, ctx *context.T, name, extension, pairingToken string, errID verror.ID) {
 	// Setup blessings to be granted to the claimed device
 	g := &granter{extension: extension}
 	s := options.SkipServerEndpointAuthorization{}
@@ -129,38 +129,38 @@
 	}
 }
 
-func updateDeviceExpectError(t *testing.T, ctx *context.T, name string, errID verror.ID) {
-	if err := deviceStub(name).Update(ctx); verror.ErrorID(err) != errID {
+func UpdateDeviceExpectError(t *testing.T, ctx *context.T, name string, errID verror.ID) {
+	if err := DeviceStub(name).Update(ctx); verror.ErrorID(err) != errID {
 		t.Fatalf(testutil.FormatLogLine(2, "%q.Update expected to fail with %v, got %v [%v]", name, errID, verror.ErrorID(err), err))
 	}
 }
 
-func updateDevice(t *testing.T, ctx *context.T, name string) {
-	if err := deviceStub(name).Update(ctx); err != nil {
+func UpdateDevice(t *testing.T, ctx *context.T, name string) {
+	if err := DeviceStub(name).Update(ctx); err != nil {
 		t.Fatalf(testutil.FormatLogLine(2, "%q.Update() failed: %v [%v]", name, verror.ErrorID(err), err))
 	}
 }
 
-func revertDeviceExpectError(t *testing.T, ctx *context.T, name string, errID verror.ID) {
-	if err := deviceStub(name).Revert(ctx); verror.ErrorID(err) != errID {
+func RevertDeviceExpectError(t *testing.T, ctx *context.T, name string, errID verror.ID) {
+	if err := DeviceStub(name).Revert(ctx); verror.ErrorID(err) != errID {
 		t.Fatalf(testutil.FormatLogLine(2, "%q.Revert() expected to fail with %v, got %v [%v]", name, errID, verror.ErrorID(err), err))
 	}
 }
 
-func revertDevice(t *testing.T, ctx *context.T, name string) {
-	if err := deviceStub(name).Revert(ctx); err != nil {
+func RevertDevice(t *testing.T, ctx *context.T, name string) {
+	if err := DeviceStub(name).Revert(ctx); err != nil {
 		t.Fatalf(testutil.FormatLogLine(2, "%q.Revert() failed: %v [%v]", name, verror.ErrorID(err), err))
 	}
 }
 
-func killDevice(t *testing.T, ctx *context.T, name string) {
-	if err := deviceStub(name).Kill(ctx, killTimeout); err != nil {
+func KillDevice(t *testing.T, ctx *context.T, name string) {
+	if err := DeviceStub(name).Kill(ctx, killTimeout); err != nil {
 		t.Fatalf(testutil.FormatLogLine(2, "%q.Kill(%v) failed: %v [%v]", name, killTimeout, verror.ErrorID(err), err))
 	}
 }
 
-func shutdownDevice(t *testing.T, ctx *context.T, name string) {
-	if err := deviceStub(name).Delete(ctx); err != nil {
+func ShutdownDevice(t *testing.T, ctx *context.T, name string) {
+	if err := DeviceStub(name).Delete(ctx); err != nil {
 		t.Fatalf(testutil.FormatLogLine(2, "%q.Delete() failed: %v [%v]", name, verror.ErrorID(err), err))
 	}
 }
@@ -168,7 +168,7 @@
 // The following set of functions are convenience wrappers around various app
 // management methods.
 
-func ocfg(opt []interface{}) device.Config {
+func Ocfg(opt []interface{}) device.Config {
 	for _, o := range opt {
 		if c, ok := o.(device.Config); ok {
 			return c
@@ -177,7 +177,7 @@
 	return device.Config{}
 }
 
-func opkg(opt []interface{}) application.Packages {
+func Opkg(opt []interface{}) application.Packages {
 	for _, o := range opt {
 		if c, ok := o.(application.Packages); ok {
 			return c
@@ -186,27 +186,27 @@
 	return application.Packages{}
 }
 
-func appStub(nameComponents ...string) device.ApplicationClientMethods {
+func AppStub(nameComponents ...string) device.ApplicationClientMethods {
 	appsName := "dm/apps"
 	appName := naming.Join(append([]string{appsName}, nameComponents...)...)
 	return device.ApplicationClient(appName)
 }
 
-func statsStub(nameComponents ...string) stats.StatsClientMethods {
+func StatsStub(nameComponents ...string) stats.StatsClientMethods {
 	statsName := naming.Join(nameComponents...)
 	return stats.StatsClient(statsName)
 }
 
-func installApp(t *testing.T, ctx *context.T, opt ...interface{}) string {
-	appID, err := appStub().Install(ctx, mockApplicationRepoName, ocfg(opt), opkg(opt))
+func InstallApp(t *testing.T, ctx *context.T, opt ...interface{}) string {
+	appID, err := AppStub().Install(ctx, MockApplicationRepoName, Ocfg(opt), Opkg(opt))
 	if err != nil {
 		t.Fatalf(testutil.FormatLogLine(2, "Install failed: %v [%v]", verror.ErrorID(err), err))
 	}
 	return appID
 }
 
-func installAppExpectError(t *testing.T, ctx *context.T, expectedError verror.ID, opt ...interface{}) {
-	if _, err := appStub().Install(ctx, mockApplicationRepoName, ocfg(opt), opkg(opt)); err == nil || verror.ErrorID(err) != expectedError {
+func InstallAppExpectError(t *testing.T, ctx *context.T, expectedError verror.ID, opt ...interface{}) {
+	if _, err := AppStub().Install(ctx, MockApplicationRepoName, Ocfg(opt), Opkg(opt)); err == nil || verror.ErrorID(err) != expectedError {
 		t.Fatalf(testutil.FormatLogLine(2, "Install expected to fail with %v, got %v [%v]", expectedError, verror.ErrorID(err), err))
 	}
 }
@@ -222,19 +222,19 @@
 	return p.Bless(call.RemoteBlessings().PublicKey(), p.BlessingStore().Default(), g.extension, security.UnconstrainedUse())
 }
 
-func launchAppImpl(t *testing.T, ctx *context.T, appID, grant string) (string, error) {
-	instanceID, err := newInstanceImpl(t, ctx, appID, grant)
+func LaunchAppImpl(t *testing.T, ctx *context.T, appID, grant string) (string, error) {
+	instanceID, err := NewInstanceImpl(t, ctx, appID, grant)
 	if err != nil {
 		return "", err
 	}
-	return instanceID, appStub(appID, instanceID).Run(ctx)
+	return instanceID, AppStub(appID, instanceID).Run(ctx)
 }
 
-func newInstanceImpl(t *testing.T, ctx *context.T, appID, grant string) (string, error) {
+func NewInstanceImpl(t *testing.T, ctx *context.T, appID, grant string) (string, error) {
 	ctx, delete := context.WithCancel(ctx)
 	defer delete()
 
-	call, err := appStub(appID).Instantiate(ctx)
+	call, err := AppStub(appID).Instantiate(ctx)
 	if err != nil {
 		return "", err
 	}
@@ -262,113 +262,113 @@
 	return instanceID, nil
 }
 
-func launchApp(t *testing.T, ctx *context.T, appID string) string {
-	instanceID, err := launchAppImpl(t, ctx, appID, "forapp")
+func LaunchApp(t *testing.T, ctx *context.T, appID string) string {
+	instanceID, err := LaunchAppImpl(t, ctx, appID, "forapp")
 	if err != nil {
 		t.Fatalf(testutil.FormatLogLine(2, "launching %v failed: %v [%v]", appID, verror.ErrorID(err), err))
 	}
 	return instanceID
 }
 
-func launchAppExpectError(t *testing.T, ctx *context.T, appID string, expectedError verror.ID) {
-	if _, err := launchAppImpl(t, ctx, appID, "forapp"); err == nil || verror.ErrorID(err) != expectedError {
+func LaunchAppExpectError(t *testing.T, ctx *context.T, appID string, expectedError verror.ID) {
+	if _, err := LaunchAppImpl(t, ctx, appID, "forapp"); err == nil || verror.ErrorID(err) != expectedError {
 		t.Fatalf(testutil.FormatLogLine(2, "launching %v expected to fail with %v, got %v [%v]", appID, expectedError, verror.ErrorID(err), err))
 	}
 }
 
-func terminateApp(t *testing.T, ctx *context.T, appID, instanceID string) {
-	if err := appStub(appID, instanceID).Kill(ctx, killTimeout); err != nil {
+func TerminateApp(t *testing.T, ctx *context.T, appID, instanceID string) {
+	if err := AppStub(appID, instanceID).Kill(ctx, killTimeout); err != nil {
 		t.Fatalf(testutil.FormatLogLine(2, "Kill(%v/%v) failed: %v [%v]", appID, instanceID, verror.ErrorID(err), err))
 	}
-	if err := appStub(appID, instanceID).Delete(ctx); err != nil {
+	if err := AppStub(appID, instanceID).Delete(ctx); err != nil {
 		t.Fatalf(testutil.FormatLogLine(2, "Delete(%v/%v) failed: %v [%v]", appID, instanceID, verror.ErrorID(err), err))
 	}
 }
 
-func killApp(t *testing.T, ctx *context.T, appID, instanceID string) {
-	if err := appStub(appID, instanceID).Kill(ctx, killTimeout); err != nil {
+func KillApp(t *testing.T, ctx *context.T, appID, instanceID string) {
+	if err := AppStub(appID, instanceID).Kill(ctx, killTimeout); err != nil {
 		t.Fatalf(testutil.FormatLogLine(2, "Kill(%v/%v) failed: %v [%v]", appID, instanceID, verror.ErrorID(err), err))
 	}
 }
 
-func deleteApp(t *testing.T, ctx *context.T, appID, instanceID string) {
-	if err := appStub(appID, instanceID).Delete(ctx); err != nil {
+func DeleteApp(t *testing.T, ctx *context.T, appID, instanceID string) {
+	if err := AppStub(appID, instanceID).Delete(ctx); err != nil {
 		t.Fatalf(testutil.FormatLogLine(2, "Delete(%v/%v) failed: %v [%v]", appID, instanceID, verror.ErrorID(err), err))
 	}
 }
 
-func runApp(t *testing.T, ctx *context.T, appID, instanceID string) {
-	if err := appStub(appID, instanceID).Run(ctx); err != nil {
+func RunApp(t *testing.T, ctx *context.T, appID, instanceID string) {
+	if err := AppStub(appID, instanceID).Run(ctx); err != nil {
 		t.Fatalf(testutil.FormatLogLine(2, "Run(%v/%v) failed: %v [%v]", appID, instanceID, verror.ErrorID(err), err))
 	}
 }
 
-func runAppExpectError(t *testing.T, ctx *context.T, appID, instanceID string, expectedError verror.ID) {
-	if err := appStub(appID, instanceID).Run(ctx); err == nil || verror.ErrorID(err) != expectedError {
+func RunAppExpectError(t *testing.T, ctx *context.T, appID, instanceID string, expectedError verror.ID) {
+	if err := AppStub(appID, instanceID).Run(ctx); err == nil || verror.ErrorID(err) != expectedError {
 		t.Fatalf(testutil.FormatLogLine(2, "Run(%v/%v) expected to fail with %v, got %v [%v]", appID, instanceID, expectedError, verror.ErrorID(err), err))
 	}
 }
 
-func updateInstance(t *testing.T, ctx *context.T, appID, instanceID string) {
-	if err := appStub(appID, instanceID).Update(ctx); err != nil {
+func UpdateInstance(t *testing.T, ctx *context.T, appID, instanceID string) {
+	if err := AppStub(appID, instanceID).Update(ctx); err != nil {
 		t.Fatalf(testutil.FormatLogLine(2, "Update(%v/%v) failed: %v [%v]", appID, instanceID, verror.ErrorID(err), err))
 	}
 }
 
-func updateInstanceExpectError(t *testing.T, ctx *context.T, appID, instanceID string, expectedError verror.ID) {
-	if err := appStub(appID, instanceID).Update(ctx); err == nil || verror.ErrorID(err) != expectedError {
+func UpdateInstanceExpectError(t *testing.T, ctx *context.T, appID, instanceID string, expectedError verror.ID) {
+	if err := AppStub(appID, instanceID).Update(ctx); err == nil || verror.ErrorID(err) != expectedError {
 		t.Fatalf(testutil.FormatLogLine(2, "Update(%v/%v) expected to fail with %v, got %v [%v]", appID, instanceID, expectedError, verror.ErrorID(err), err))
 	}
 }
 
-func updateApp(t *testing.T, ctx *context.T, appID string) {
-	if err := appStub(appID).Update(ctx); err != nil {
+func UpdateApp(t *testing.T, ctx *context.T, appID string) {
+	if err := AppStub(appID).Update(ctx); err != nil {
 		t.Fatalf(testutil.FormatLogLine(2, "Update(%v) failed: %v [%v]", appID, verror.ErrorID(err), err))
 	}
 }
 
-func updateAppExpectError(t *testing.T, ctx *context.T, appID string, expectedError verror.ID) {
-	if err := appStub(appID).Update(ctx); err == nil || verror.ErrorID(err) != expectedError {
+func UpdateAppExpectError(t *testing.T, ctx *context.T, appID string, expectedError verror.ID) {
+	if err := AppStub(appID).Update(ctx); err == nil || verror.ErrorID(err) != expectedError {
 		t.Fatalf(testutil.FormatLogLine(2, "Update(%v) expected to fail with %v, got %v [%v]", appID, expectedError, verror.ErrorID(err), err))
 	}
 }
 
-func revertApp(t *testing.T, ctx *context.T, appID string) {
-	if err := appStub(appID).Revert(ctx); err != nil {
+func RevertApp(t *testing.T, ctx *context.T, appID string) {
+	if err := AppStub(appID).Revert(ctx); err != nil {
 		t.Fatalf(testutil.FormatLogLine(2, "Revert(%v) failed: %v [%v]", appID, verror.ErrorID(err), err))
 	}
 }
 
-func revertAppExpectError(t *testing.T, ctx *context.T, appID string, expectedError verror.ID) {
-	if err := appStub(appID).Revert(ctx); err == nil || verror.ErrorID(err) != expectedError {
+func RevertAppExpectError(t *testing.T, ctx *context.T, appID string, expectedError verror.ID) {
+	if err := AppStub(appID).Revert(ctx); err == nil || verror.ErrorID(err) != expectedError {
 		t.Fatalf(testutil.FormatLogLine(2, "Revert(%v) expected to fail with %v, got %v [%v]", appID, expectedError, verror.ErrorID(err), err))
 	}
 }
 
-func uninstallApp(t *testing.T, ctx *context.T, appID string) {
-	if err := appStub(appID).Uninstall(ctx); err != nil {
+func UninstallApp(t *testing.T, ctx *context.T, appID string) {
+	if err := AppStub(appID).Uninstall(ctx); err != nil {
 		t.Fatalf(testutil.FormatLogLine(2, "Uninstall(%v) failed: %v [%v]", appID, verror.ErrorID(err), err))
 	}
 }
 
-func debug(t *testing.T, ctx *context.T, nameComponents ...string) string {
-	dbg, err := appStub(nameComponents...).Debug(ctx)
+func Debug(t *testing.T, ctx *context.T, nameComponents ...string) string {
+	dbg, err := AppStub(nameComponents...).Debug(ctx)
 	if err != nil {
 		t.Fatalf(testutil.FormatLogLine(2, "Debug(%v) failed: %v [%v]", nameComponents, verror.ErrorID(err), err))
 	}
 	return dbg
 }
 
-func status(t *testing.T, ctx *context.T, nameComponents ...string) device.Status {
-	s, err := appStub(nameComponents...).Status(ctx)
+func Status(t *testing.T, ctx *context.T, nameComponents ...string) device.Status {
+	s, err := AppStub(nameComponents...).Status(ctx)
 	if err != nil {
 		t.Fatalf(testutil.FormatLogLine(3, "Status(%v) failed: %v [%v]", nameComponents, verror.ErrorID(err), err))
 	}
 	return s
 }
 
-func verifyState(t *testing.T, ctx *context.T, want interface{}, nameComponents ...string) string {
-	s := status(t, ctx, nameComponents...)
+func VerifyState(t *testing.T, ctx *context.T, want interface{}, nameComponents ...string) string {
+	s := Status(t, ctx, nameComponents...)
 	var (
 		state   interface{}
 		version string
@@ -396,7 +396,7 @@
 func (a byIdentity) Swap(i, j int)      { a[i], a[j] = a[j], a[i] }
 func (a byIdentity) Less(i, j int) bool { return a[i].IdentityName < a[j].IdentityName }
 
-func compareAssociations(t *testing.T, got, expected []device.Association) {
+func CompareAssociations(t *testing.T, got, expected []device.Association) {
 	sort.Sort(byIdentity(got))
 	sort.Sort(byIdentity(expected))
 	if !reflect.DeepEqual(got, expected) {
@@ -404,9 +404,9 @@
 	}
 }
 
-// generateSuidHelperScript builds a script to execute the test target as
+// GenerateSuidHelperScript builds a script to execute the test target as
 // a suidhelper instance and returns the path to the script.
-func generateSuidHelperScript(t *testing.T, root string) string {
+func GenerateSuidHelperScript(t *testing.T, root string) string {
 	output := "#!/bin/bash\n"
 	output += "V23_SUIDHELPER_TEST=1"
 	output += " "
@@ -425,9 +425,9 @@
 	return path
 }
 
-// generateAgentScript creates a simple script that acts as the security agent
+// GenerateAgentScript creates a simple script that acts as the security agent
 // for tests.  It blackholes arguments meant for the agent.
-func generateAgentScript(t *testing.T, root string) string {
+func GenerateAgentScript(t *testing.T, root string) string {
 	output := `
 #!/bin/bash
 ARGS=$*
@@ -454,7 +454,7 @@
 	return path
 }
 
-func ctxWithNewPrincipal(t *testing.T, ctx *context.T, idp *testutil.IDProvider, extension string) *context.T {
+func CtxWithNewPrincipal(t *testing.T, ctx *context.T, idp *testutil.IDProvider, extension string) *context.T {
 	ret, err := v23.WithPrincipal(ctx, testutil.NewPrincipal())
 	if err != nil {
 		t.Fatalf(testutil.FormatLogLine(2, "v23.WithPrincipal failed: %v", err))
@@ -467,18 +467,18 @@
 
 // TODO(rjkroege): This helper is generally useful. Use it to reduce
 // boiler plate across all device manager tests.
-func startupHelper(t *testing.T) (func(), *context.T, *modules.Shell, *application.Envelope, string, string, *testutil.IDProvider) {
+func StartupHelper(t *testing.T) (func(), *context.T, *modules.Shell, *application.Envelope, string, string, *testutil.IDProvider) {
 	ctx, shutdown := test.InitForTest()
 	v23.GetNamespace(ctx).CacheCtl(naming.DisableCache(true))
 
 	// Make a new identity context.
 	idp := testutil.NewIDProvider("root")
-	ctx = ctxWithNewPrincipal(t, ctx, idp, "self")
+	ctx = CtxWithNewPrincipal(t, ctx, idp, "self")
 
 	sh, deferFn := servicetest.CreateShellAndMountTable(t, ctx, nil)
 
 	// Set up mock application and binary repositories.
-	envelope, envCleanup := startMockRepos(t, ctx)
+	envelope, envCleanup := StartMockRepos(t, ctx)
 
 	root, rootCleanup := servicetest.SetupRootDir(t, "devicemanager")
 	if err := impl.SaveCreatorInfo(root); err != nil {
@@ -486,7 +486,7 @@
 	}
 
 	// Create a script wrapping the test target that implements suidhelper.
-	helperPath := generateSuidHelperScript(t, root)
+	helperPath := GenerateSuidHelperScript(t, root)
 
 	return func() {
 		rootCleanup()
@@ -496,9 +496,9 @@
 	}, ctx, sh, envelope, root, helperPath, idp
 }
 
-type globTestVector struct {
-	name, pattern string
-	expected      []string
+type GlobTestVector struct {
+	Name, Pattern string
+	Expected      []string
 }
 
 type globTestRegexHelper struct {
@@ -508,7 +508,7 @@
 	statsTrimRE                      *regexp.Regexp
 }
 
-func newGlobTestRegexHelper(appName string) *globTestRegexHelper {
+func NewGlobTestRegexHelper(appName string) *globTestRegexHelper {
 	return &globTestRegexHelper{
 		logFileTimeStampRE:               regexp.MustCompile("(STDOUT|STDERR)-[0-9]+$"),
 		logFileTrimInfoRE:                regexp.MustCompile(appName + `\..*\.INFO\.[0-9.-]+$`),
@@ -517,13 +517,13 @@
 	}
 }
 
-// verifyGlob verifies that for each globTestVector instance that the
+// VerifyGlob verifies that for each GlobTestVector instance that the
 // pattern returns the expected matches.
-func verifyGlob(t *testing.T, ctx *context.T, appName string, testcases []globTestVector, res *globTestRegexHelper) {
+func VerifyGlob(t *testing.T, ctx *context.T, appName string, testcases []GlobTestVector, res *globTestRegexHelper) {
 	for _, tc := range testcases {
-		results, _, err := testutil.GlobName(ctx, tc.name, tc.pattern)
+		results, _, err := testutil.GlobName(ctx, tc.Name, tc.Pattern)
 		if err != nil {
-			t.Errorf(testutil.FormatLogLine(2, "unexpected glob error for (%q, %q): %v", tc.name, tc.pattern, err))
+			t.Errorf(testutil.FormatLogLine(2, "unexpected glob error for (%q, %q): %v", tc.Name, tc.Pattern, err))
 			continue
 		}
 		filteredResults := []string{}
@@ -542,28 +542,28 @@
 			filteredResults = append(filteredResults, name)
 		}
 		sort.Strings(filteredResults)
-		sort.Strings(tc.expected)
-		if !reflect.DeepEqual(filteredResults, tc.expected) {
-			t.Errorf(testutil.FormatLogLine(2, "unexpected result for (%q, %q). Got %q, want %q", tc.name, tc.pattern, filteredResults, tc.expected))
+		sort.Strings(tc.Expected)
+		if !reflect.DeepEqual(filteredResults, tc.Expected) {
+			t.Errorf(testutil.FormatLogLine(2, "unexpected result for (%q, %q). Got %q, want %q", tc.Name, tc.Pattern, filteredResults, tc.Expected))
 		}
 	}
 }
 
-// verifyFailGlob verifies that for each globTestVector instance that the
+// VerifyFailGlob verifies that for each GlobTestVector instance that the
 // pattern returns no matches.
-func verifyFailGlob(t *testing.T, ctx *context.T, testcases []globTestVector) {
+func VerifyFailGlob(t *testing.T, ctx *context.T, testcases []GlobTestVector) {
 	for _, tc := range testcases {
-		results, _, _ := testutil.GlobName(ctx, tc.name, tc.pattern)
+		results, _, _ := testutil.GlobName(ctx, tc.Name, tc.Pattern)
 		if len(results) != 0 {
-			t.Errorf(testutil.FormatLogLine(2, "verifyFailGlob should have failed for %q, %q", tc.name, tc.pattern))
+			t.Errorf(testutil.FormatLogLine(2, "verifyFailGlob should have failed for %q, %q", tc.Name, tc.Pattern))
 		}
 	}
 }
 
-// verifyLog calls Size() on a selection of log file objects to
+// VerifyLog calls Size() on a selection of log file objects to
 // demonstrate that the log files are accessible and have been written by
 // the application.
-func verifyLog(t *testing.T, ctx *context.T, nameComponents ...string) {
+func VerifyLog(t *testing.T, ctx *context.T, nameComponents ...string) {
 	a := nameComponents
 	pattern, prefix := a[len(a)-1], a[:len(a)-1]
 	path := naming.Join(prefix...)
@@ -583,9 +583,9 @@
 	}
 }
 
-// verifyStatsValues call Value() on some of the stats objects to prove
+// VerifyStatsValues call Value() on some of the stats objects to prove
 // that they are correctly being proxied to the device manager.
-func verifyStatsValues(t *testing.T, ctx *context.T, nameComponents ...string) {
+func VerifyStatsValues(t *testing.T, ctx *context.T, nameComponents ...string) {
 	a := nameComponents
 	pattern, prefix := a[len(a)-1], a[:len(a)-1]
 	path := naming.Join(prefix...)
@@ -606,9 +606,9 @@
 	}
 }
 
-// verifyPProfCmdLine calls CmdLine() on the pprof object to validate
+// VerifyPProfCmdLine calls CmdLine() on the pprof object to validate
 // that it the proxy correctly accessess pprof names.
-func verifyPProfCmdLine(t *testing.T, ctx *context.T, appName string, nameComponents ...string) {
+func VerifyPProfCmdLine(t *testing.T, ctx *context.T, appName string, nameComponents ...string) {
 	name := naming.Join(nameComponents...)
 	c := pprof.PProfClient(name)
 	v, err := c.CmdLine(ctx)
@@ -624,13 +624,13 @@
 
 }
 
-func verifyNoRunningProcesses(t *testing.T) {
+func VerifyNoRunningProcesses(t *testing.T) {
 	if impl.RunningChildrenProcesses() {
 		t.Errorf("device manager incorrectly terminating with child processes still running")
 	}
 }
 
-func setNamespaceRootsForUnclaimedDevice(ctx *context.T) (*context.T, error) {
+func SetNamespaceRootsForUnclaimedDevice(ctx *context.T) (*context.T, error) {
 	origroots := v23.GetNamespace(ctx).Roots()
 	roots := make([]string, len(origroots))
 	for i, orig := range origroots {
diff --git a/services/device/internal/impl/mock_repo_test.go b/services/device/internal/impl/utiltest/mock_repo.go
similarity index 87%
rename from services/device/internal/impl/mock_repo_test.go
rename to services/device/internal/impl/utiltest/mock_repo.go
index 632342b..af54f84 100644
--- a/services/device/internal/impl/mock_repo_test.go
+++ b/services/device/internal/impl/utiltest/mock_repo.go
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
-package impl_test
+package utiltest
 
 import (
 	"crypto/md5"
@@ -27,12 +27,12 @@
 	"v.io/x/ref/services/internal/servicetest"
 )
 
-const mockBinaryRepoName = "br"
-const mockApplicationRepoName = "ar"
+const MockBinaryRepoName = "br"
+const MockApplicationRepoName = "ar"
 
-func startMockRepos(t *testing.T, ctx *context.T) (*application.Envelope, func()) {
-	envelope, appCleanup := startApplicationRepository(ctx)
-	binaryCleanup := startBinaryRepository(ctx)
+func StartMockRepos(t *testing.T, ctx *context.T) (*application.Envelope, func()) {
+	envelope, appCleanup := StartApplicationRepository(ctx)
+	binaryCleanup := StartBinaryRepository(ctx)
 
 	return envelope, func() {
 		binaryCleanup()
@@ -40,13 +40,13 @@
 	}
 }
 
-// startApplicationRepository sets up a server running the application
+// StartApplicationRepository sets up a server running the application
 // repository.  It returns a pointer to the envelope that the repository returns
 // to clients (so that it can be changed).  It also returns a cleanup function.
-func startApplicationRepository(ctx *context.T) (*application.Envelope, func()) {
+func StartApplicationRepository(ctx *context.T) (*application.Envelope, func()) {
 	server, _ := servicetest.NewServer(ctx)
 	invoker := new(arInvoker)
-	name := mockApplicationRepoName
+	name := MockApplicationRepoName
 	if err := server.Serve(name, repository.ApplicationServer(invoker), security.AllowEveryone()); err != nil {
 		vlog.Fatalf("Serve(%v) failed: %v", name, err)
 	}
@@ -85,11 +85,11 @@
 // serves the current running binary.
 type brInvoker struct{}
 
-// startBinaryRepository sets up a server running the binary repository and
+// StartBinaryRepository sets up a server running the binary repository and
 // returns a cleanup function.
-func startBinaryRepository(ctx *context.T) func() {
+func StartBinaryRepository(ctx *context.T) func() {
 	server, _ := servicetest.NewServer(ctx)
-	name := mockBinaryRepoName
+	name := MockBinaryRepoName
 	if err := server.Serve(name, repository.BinaryServer(new(brInvoker)), security.AllowEveryone()); err != nil {
 		vlog.Fatalf("Serve(%q) failed: %v", name, err)
 	}
@@ -103,7 +103,7 @@
 // BINARY REPOSITORY INTERFACE IMPLEMENTATION
 
 // TODO(toddw): Move the errors from dispatcher.go into a common location.
-const pkgPath = "v.io/x/ref/services/device/internal/impl"
+const pkgPath = "v.io/x/ref/services/device/internal/impl/utiltest"
 
 var ErrOperationFailed = verror.Register(pkgPath+".OperationFailed", verror.NoRetry, "")