aboutsummaryrefslogtreecommitdiffstats
path: root/pkg
diff options
context:
space:
mode:
authorDmitry Vyukov <dvyukov@google.com>2024-07-24 16:09:29 +0200
committerAlexander Potapenko <glider@google.com>2024-07-24 14:25:55 +0000
commit2a6d160e07672878ddd03bdbc8abc8440730a4a8 (patch)
treed8f7b5411d6f1f1b90e618d7ee574fb6de9b8d3c /pkg
parent448d098d2ccb0225cf5fdc6b7a6c8cca0438ac77 (diff)
pkg/runtest: fix nil deref on test failures
Diffstat (limited to 'pkg')
-rw-r--r--pkg/runtest/run.go6
1 files changed, 5 insertions, 1 deletions
diff --git a/pkg/runtest/run.go b/pkg/runtest/run.go
index 110ec15d4..501f92dd3 100644
--- a/pkg/runtest/run.go
+++ b/pkg/runtest/run.go
@@ -537,8 +537,12 @@ func checkResult(req *runRequest) error {
return err
}
if req.repeat != len(infos) {
+ infoCalls := -1
+ if req.result.Info != nil {
+ infoCalls = len(req.result.Info.Calls)
+ }
return fmt.Errorf("should repeat %v times, but repeated %v, prog calls %v, info calls %v\n%s",
- req.repeat, len(infos), req.Prog.Calls, len(req.result.Info.Calls), req.result.Output)
+ req.repeat, len(infos), req.Prog.Calls, infoCalls, req.result.Output)
}
}
calls := make(map[string]bool)