lib/testutil/integration: unexport some methods, remove StartServer

These methods are either no longer used outside the integration test
library or (in the case of StartServer) are no longer used at all.

Change-Id: I974e72b9471f4091eb62268c3e483d30ae89ef92
diff --git a/lib/testutil/integration/util.go b/lib/testutil/integration/util.go
index 531cec3..0044341 100644
--- a/lib/testutil/integration/util.go
+++ b/lib/testutil/integration/util.go
@@ -1,7 +1,6 @@
 package integration
 
 import (
-	"bufio"
 	"bytes"
 	"fmt"
 	"io"
@@ -326,9 +325,9 @@
 		e.t.Logf("using cached binary for %s at %s.", binary_path, cached_binary.Path())
 		return cached_binary
 	}
-	built_path, cleanup, err := BuildPkgs([]string{binary_path})
+	built_path, cleanup, err := buildPkg(binary_path)
 	if err != nil {
-		e.t.Fatalf("BuildPkgs() failed: %v", err)
+		e.t.Fatalf("buildPkg() failed: %v", err)
 		return nil
 	}
 	output_path := path.Join(built_path, path.Base(binary_path))
@@ -376,9 +375,9 @@
 	}
 
 	t.Log("starting root mounttable...")
-	mtHandle, mtEndpoint, err := StartRootMT(shell)
+	mtHandle, mtEndpoint, err := startRootMT(shell)
 	if err != nil {
-		t.Fatalf("StartRootMT() failed: %v", err)
+		t.Fatalf("startRootMT() failed: %v", err)
 	}
 	t.Logf("mounttable available at %s", mtEndpoint)
 
@@ -394,12 +393,12 @@
 	}
 }
 
-// BuildPkgs returns a path to a directory that contains the built
-// binaries for the given set of packages and a function that should
-// be invoked to clean up the build artifacts. Note that the clients
-// of this function should not modify the contents of this directory
-// directly and instead defer to the cleanup function.
-func BuildPkgs(pkgs []string) (string, func(), error) {
+// BuildPkg returns a path to a directory that contains the built binary for
+// the given packages and a function that should be invoked to clean up the
+// build artifacts. Note that the clients of this function should not modify
+// the contents of this directory directly and instead defer to the cleanup
+// function.
+func buildPkg(pkg string) (string, func(), error) {
 	// The VEYRON_INTEGRATION_BIN_DIR environment variable can be
 	// used to identify a directory that multiple integration
 	// tests can use to share binaries. Whoever sets this
@@ -416,25 +415,23 @@
 		}
 		binDir, cleanupFn = tmpDir, func() { os.RemoveAll(tmpDir) }
 	}
-	for _, pkg := range pkgs {
-		binFile := filepath.Join(binDir, path.Base(pkg))
-		if _, err := os.Stat(binFile); err != nil {
-			if !os.IsNotExist(err) {
-				return "", nil, err
-			}
-			cmd := exec.Command("v23", "go", "build", "-o", filepath.Join(binDir, path.Base(pkg)), pkg)
-			if err := cmd.Run(); err != nil {
-				return "", nil, err
-			}
+	binFile := filepath.Join(binDir, path.Base(pkg))
+	if _, err := os.Stat(binFile); err != nil {
+		if !os.IsNotExist(err) {
+			return "", nil, err
+		}
+		cmd := exec.Command("v23", "go", "build", "-o", filepath.Join(binDir, path.Base(pkg)), pkg)
+		if err := cmd.Run(); err != nil {
+			return "", nil, err
 		}
 	}
 	return binDir, cleanupFn, nil
 }
 
-// StartRootMT uses the given shell to start a root mount table and
+// startRootMT uses the given shell to start a root mount table and
 // returns a handle for the started command along with the object name
 // of the mount table.
-func StartRootMT(shell *modules.Shell) (modules.Handle, string, error) {
+func startRootMT(shell *modules.Shell) (modules.Handle, string, error) {
 	handle, err := shell.Start(core.RootMTCommand, nil, "--", "--veyron.tcp.address=127.0.0.1:0")
 	if err != nil {
 		return nil, "", err
@@ -455,53 +452,3 @@
 
 	return handle, name, nil
 }
-
-// StartServer starts a veyron server using the given binary and
-// arguments, waiting for the server to successfully mount itself in
-// the mount table.
-//
-// TODO(jsimsa,sadovsky): Use an instance of modules.Shell to start
-// and manage the server process to prevent leaking processes when
-// its parent terminates unexpectedly.
-func StartServer(bin string, args []string) (*os.Process, error) {
-	args = append(args, "-logtostderr", "-vmodule=publisher=2")
-	cmd := exec.Command(bin, args...)
-	outPipe, err := cmd.StderrPipe()
-	if err != nil {
-		return nil, err
-	}
-	// TODO(jsimsa): Consider using the veyron exec library to
-	// facilitate coordination and communication between the
-	// parent and the child process.
-	if err := cmd.Start(); err != nil {
-		return nil, fmt.Errorf("%q failed: %v", strings.Join(cmd.Args, " "), err)
-	}
-	// Wait for the server to mount both its tcp and ws endpoint.
-	ready := make(chan struct{}, 1)
-	go func() {
-		defer outPipe.Close()
-		scanner := bufio.NewScanner(outPipe)
-		mounts := 0
-		for scanner.Scan() {
-			line := scanner.Text()
-			// TODO(cnicolaou): find a better way of synchronizing with
-			// the child process, this is way too fragile.
-			if strings.Index(line, "ipc pub: mount") != -1 {
-				mounts++
-				if mounts == 1 {
-					close(ready)
-				}
-			}
-		}
-		if err := scanner.Err(); err != nil {
-			fmt.Fprintf(os.Stderr, "Scan() failed: %v\n", err)
-		}
-	}()
-	select {
-	case <-ready:
-		return cmd.Process, nil
-	case <-time.After(time.Minute):
-		cmd.Process.Kill()
-		return nil, fmt.Errorf("timed out waiting for %q to mount itself", strings.Join(cmd.Args, " "))
-	}
-}