feat: add error counters output
This commit is contained in:
parent
c54616594c
commit
c7bc206ad8
25
pew.go
25
pew.go
@ -139,16 +139,30 @@ func (cmd *PewCmd) Run(g *Globals) (err error) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
log.Info().Msgf("Success rate: %.02f, Threshold: %.02f",
|
if state.InternalErrors > 0 {
|
||||||
successRate(state), cmd.Threshold)
|
log.Warn().Msgf("%d internal errors "+
|
||||||
if successRate(state) < cmd.Threshold {
|
"(not counted towards success rate)",
|
||||||
err = errors.New("reliability threshold not met")
|
state.InternalErrors)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
msg := fmt.Sprintf("Success rate: %.02f (%d/%d), Threshold: %.02f",
|
||||||
|
successRate(state),
|
||||||
|
int(state.Success), int(state.Overall),
|
||||||
|
cmd.Threshold)
|
||||||
|
|
||||||
|
if successRate(state) < cmd.Threshold {
|
||||||
|
log.Error().Msg(msg)
|
||||||
|
err = errors.New("reliability threshold not met")
|
||||||
|
} else {
|
||||||
|
log.Info().Msg(msg)
|
||||||
|
}
|
||||||
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
type runstate struct {
|
type runstate struct {
|
||||||
Overall, Success float64
|
Overall, Success float64
|
||||||
|
InternalErrors int
|
||||||
}
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
@ -403,11 +417,12 @@ func dumpResult(q *qemu.System, ka config.Artifact, ki distro.KernelInfo,
|
|||||||
// TODO refactor
|
// TODO refactor
|
||||||
|
|
||||||
if res.InternalError != nil {
|
if res.InternalError != nil {
|
||||||
q.Log.Error().Err(res.InternalError).
|
q.Log.Warn().Err(res.InternalError).
|
||||||
Str("panic", fmt.Sprintf("%v", q.KernelPanic)).
|
Str("panic", fmt.Sprintf("%v", q.KernelPanic)).
|
||||||
Str("timeout", fmt.Sprintf("%v", q.KilledByTimeout)).
|
Str("timeout", fmt.Sprintf("%v", q.KilledByTimeout)).
|
||||||
Msg("internal")
|
Msg("internal")
|
||||||
res.InternalErrorString = res.InternalError.Error()
|
res.InternalErrorString = res.InternalError.Error()
|
||||||
|
state.InternalErrors += 1
|
||||||
} else {
|
} else {
|
||||||
colored := ""
|
colored := ""
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user