Skip to content

Commit e8bc0cb

Browse files
committed
Checking test suite duration (#4323)
**What type of PR is this?** Bug fix **What does this PR do? Why is it needed?** A test case/suite's duration can be nil in the test JSON. We should check it before dereference it. **Which issues(s) does this PR fix?** Fixes #4318 **Other notes for review**
1 parent 8251e45 commit e8bc0cb

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

go/tools/bzltestutil/xml.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,10 @@ func toXML(pkgName string, testcases map[string]*testCase) *xmlTestSuites {
188188
}
189189
c := testcases[name]
190190
if name == suiteName {
191-
duration := *c.duration
191+
var duration float64
192+
if c.duration != nil {
193+
duration = *c.duration
194+
}
192195
if c.start != nil && c.end != nil {
193196
// the duration of a test suite may be greater than c.duration
194197
// when any test case uses t.Parallel().

0 commit comments

Comments
 (0)