veyron/tools/debug/testdata: fix code review comments
This change fixes a handful of issues that came up in
code review of previously-submitted code.
Change-Id: Ic06263bf97ac29a6f5173360f615ec5a62a79290
diff --git a/lib/testutil/integration/util.go b/lib/testutil/integration/util.go
index f82b759..12d2dc6 100644
--- a/lib/testutil/integration/util.go
+++ b/lib/testutil/integration/util.go
@@ -79,7 +79,8 @@
ErrorOutput() string
// Sends the given signal to this invocation. It is up to the test
- // author whether failure to deliver the signal is fatal to the test.
+ // author to decide whether failure to deliver the signal is fatal to
+ // the test.
Kill(syscall.Signal) error
// Wait waits for this invocation to finish. If either stdout or stderr
diff --git a/tools/debug/testdata/integration_test.go b/tools/debug/testdata/integration_test.go
index 0003cb0..46c4c1b 100644
--- a/tools/debug/testdata/integration_test.go
+++ b/tools/debug/testdata/integration_test.go
@@ -8,6 +8,7 @@
"regexp"
"strconv"
"strings"
+ "syscall"
"testing"
"time"
@@ -128,14 +129,14 @@
inv := binary.Start("stats", "watch", "-raw", env.RootMT()+"/__debug/stats/ipc/server/routing-id/*/methods/ReadLog/latency-ms")
- lines := make(chan string)
+ lineChan := make(chan string)
// Go off and read the invocation's stdout.
go func() {
line, err := bufio.NewReader(inv.Stdout()).ReadString('\n')
if err != nil {
t.Fatalf("Could not read line from invocation")
}
- lines <- line
+ lineChan <- line
}()
// Wait up to 10 seconds for some stats output. Either some output
@@ -143,7 +144,7 @@
select {
case <-time.After(10 * time.Second):
t.Errorf("Timed out waiting for output")
- case got := <-lines:
+ case got := <-lineChan:
// Expect one ReadLog call to have occurred.
want := "latency-ms: {Count:1"
if !strings.Contains(got, want) {
@@ -153,7 +154,7 @@
// TODO(sjr): make env cleanup take care of invocations that are still
// running at the end of the test.
- inv.Kill(15 /* SIGHUP */)
+ inv.Kill(syscall.SIGTERM)
}
func performTracedRead(debugBinary integration.TestBinary, path string) string {
@@ -221,11 +222,10 @@
binary := env.BuildGoPkg("v.io/core/veyron/tools/debug")
inv := binary.Start("pprof", "run", env.RootMT()+"/__debug/pprof", "heap", "--text")
- // Assert that a profile was written out.
+ // Assert that a profile indicating the heap size was written out.
want, got := "(.*) of (.*) total", inv.Output()
var groups []string
- if groups = regexp.MustCompile(want).FindStringSubmatch(got); groups == nil || len(groups) < 3 {
- t.Logf("groups = %v", groups)
+ if groups = regexp.MustCompile(want).FindStringSubmatch(got); len(groups) < 3 {
t.Fatalf("could not find regexp %q in output\n%s", want, got)
}