Skip to content

Commit d339d08

Browse files
Bryan C. Millsgopherbot
Bryan C. Mills
authored andcommitted
cmd/go: add timestamps to script test output
Go tests don't include timestamps by default, but we would like to have them in order to correlate builder failures with server and network logs. Since many of the Go tests with external network and service dependencies are script tests for the 'go' command, logging timestamps here adds a lot of logging value with one simple and very low-risk change. For #50541. For #52490. For #52545. For #52851. Change-Id: If3fa86deb4a216ec6a1abc4e6f4ee9b05030a729 Reviewed-on: https://go-review.googlesource.com/c/go/+/405714 Reviewed-by: Dmitri Shuralyov <[email protected]> Auto-Submit: Bryan Mills <[email protected]> Reviewed-by: Dmitri Shuralyov <[email protected]> TryBot-Result: Gopher Robot <[email protected]> Run-TryBot: Bryan Mills <[email protected]>
1 parent 949b3e9 commit d339d08

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/cmd/go/script_test.go

+4-1
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ func TestScript(t *testing.T) {
8181
t.Run(name, func(t *testing.T) {
8282
t.Parallel()
8383
ctx, cancel := context.WithCancel(ctx)
84+
defer cancel()
8485
ts := &testScript{
8586
t: t,
8687
ctx: ctx,
@@ -94,7 +95,6 @@ func TestScript(t *testing.T) {
9495
defer removeAll(ts.workdir)
9596
}
9697
ts.run()
97-
cancel()
9898
})
9999
}
100100
}
@@ -210,6 +210,9 @@ func (ts *testScript) setup() {
210210
ts.envMap[kv[:i]] = kv[i+1:]
211211
}
212212
}
213+
214+
fmt.Fprintf(&ts.log, "# (%s)\n", time.Now().UTC().Format(time.RFC3339))
215+
ts.mark = ts.log.Len()
213216
}
214217

215218
// goVersion returns the current Go version.

0 commit comments

Comments
 (0)