[testrunner] Print test durations

Change-Id: I16d6e62ee73346dd61787437405a29954e963613
diff --git a/cmd/testrunner/outputs/tap.go b/cmd/testrunner/outputs/tap.go
index b0cfc51..7f4114e 100644
--- a/cmd/testrunner/outputs/tap.go
+++ b/cmd/testrunner/outputs/tap.go
@@ -5,6 +5,7 @@
 package outputs
 
 import (
+	"fmt"
 	"io"
 
 	"fuchsia.googlesource.com/tools/runtests"
@@ -27,5 +28,6 @@
 
 // Record writes the test's result and name to the output given at construction time.
 func (o *TAPOutput) Record(result testrunner.TestResult) {
-	o.producer.Ok(result.Result == runtests.TestSuccess, result.Name)
+	desc := fmt.Sprintf("%s (%v)", result.Name, result.EndTime.Sub(result.StartTime))
+	o.producer.Ok(result.Result == runtests.TestSuccess, desc)
 }
diff --git a/cmd/testrunner/outputs/tap_test.go b/cmd/testrunner/outputs/tap_test.go
index 1e74238..8ea616f 100644
--- a/cmd/testrunner/outputs/tap_test.go
+++ b/cmd/testrunner/outputs/tap_test.go
@@ -7,6 +7,7 @@
 import (
 	"bytes"
 	"strings"
+	"time"
 	"testing"
 
 	"fuchsia.googlesource.com/tools/cmd/testrunner/outputs"
@@ -15,12 +16,17 @@
 )
 
 func TestTapOutput(t *testing.T) {
+	s := time.Unix(0, 0)
 	inputs := []testrunner.TestResult{{
 		Name:   "test_a",
 		Result: runtests.TestSuccess,
+		StartTime: s,
+		EndTime: s.Add(time.Second * 2),
 	}, {
 		Name:   "test_b",
 		Result: runtests.TestFailure,
+		StartTime: s.Add(time.Minute * 1),
+		EndTime: s.Add(time.Minute * 2),
 	}}
 
 	var buf bytes.Buffer
@@ -32,8 +38,8 @@
 	expectedOutput := strings.TrimSpace(`
 TAP version 13
 1..10
-ok 1 test_a
-not ok 2 test_b
+ok 1 test_a (2s)
+not ok 2 test_b (1m0s)
 `)
 
 	actualOutput := strings.TrimSpace(buf.String())