Merge "veyron/lib/testutil/integration: remove Stderr and ErrorOutput calls"
diff --git a/lib/testutil/integration/testdata/integration_test.go b/lib/testutil/integration/testdata/integration_test.go
index 97308d7..deceb00 100644
--- a/lib/testutil/integration/testdata/integration_test.go
+++ b/lib/testutil/integration/testdata/integration_test.go
@@ -22,7 +22,9 @@
}
// TODO(sjr): revive this once stderr handling is fixed.
- // if want, got := "hello world\n", bash.Start("-c", "echo hello world 1>&2").ErrorOutput(); want != got {
- // t.Fatalf("unexpected output, want %s, got %s", want, got)
- // }
+ inv := bash.Start("-c", "echo hello world 1>&2")
+ inv.WaitOrDie(nil, nil)
+ if want, got := "hello world\n", inv.ErrorOutput(); want != got {
+ t.Fatalf("unexpected output, want %s, got %s", want, got)
+ }
}
diff --git a/lib/testutil/integration/util.go b/lib/testutil/integration/util.go
index 8f5b314..0c3e357 100644
--- a/lib/testutil/integration/util.go
+++ b/lib/testutil/integration/util.go
@@ -126,19 +126,25 @@
WithEnv(env []string) TestBinary
}
+// Invocation represents a single invocation of a TestBinary.
+//
+// Any bytes written by the invocation to its standard error may be recovered
+// using the Wait or WaitOrDie functions.
+//
+// For example:
+// bin := env.BinaryFromPath("/bin/bash")
+// inv := bin.Start("-c", "echo hello world 1>&2")
+// var buf bytes.Buffer
+// inv.WaitOrDie(nil, bufio.NewReader(buf))
+// // buf.Bytes() now contains 'hello world\n'
type Invocation interface {
Stdin() io.Writer
Stdout() io.Reader
- Stderr() io.Reader
// Output reads the invocation's stdout until EOF and then returns what
// was read as a string.
Output() string
- // ErrorOutput reads the invocation's stderr until EOF and then returns
- // what was read as a string.
- ErrorOutput() string
-
// Sends the given signal to this invocation. It is up to the test
// author to decide whether failure to deliver the signal is fatal to
// the test.
@@ -232,14 +238,6 @@
return readerToString(i.env.t, i.Stdout())
}
-func (i *integrationTestBinaryInvocation) Stderr() io.Reader {
- return (*i.handle).Stderr()
-}
-
-func (i *integrationTestBinaryInvocation) ErrorOutput() string {
- return readerToString(i.env.t, i.Stderr())
-}
-
func (i *integrationTestBinaryInvocation) Wait(stdout, stderr io.Writer) error {
return (*i.handle).Shutdown(stdout, stderr)
}