1
0
mirror of https://github.com/golang/go synced 2024-11-25 07:17:56 -07:00

go: rely on exit code to tell if test passed

R=adg, dsymonds
CC=golang-dev
https://golang.org/cl/5532066
This commit is contained in:
Russ Cox 2012-01-10 20:13:02 -08:00
parent 4a6b07f235
commit 091ef25a5e

View File

@ -440,8 +440,6 @@ func (b *builder) test(p *Package) (buildAction, runAction, printAction *action,
return pmainAction, runAction, printAction, nil
}
var pass = []byte("\nPASS\n")
// runTest is the action for running a test binary.
func (b *builder) runTest(a *action) error {
args := []string{a.deps[0].target}
@ -469,7 +467,7 @@ func (b *builder) runTest(a *action) error {
out, err := cmd.CombinedOutput()
t1 := time.Now()
t := fmt.Sprintf("%.3fs", t1.Sub(t0).Seconds())
if err == nil && (bytes.Equal(out, pass[1:]) || bytes.HasSuffix(out, pass)) {
if err == nil {
fmt.Fprintf(a.testOutput, "ok \t%s\t%s\n", a.p.ImportPath, t)
if testShowPass {
a.testOutput.Write(out)