1
0

feat: add flag to count internal errors as part of the success rate

This commit is contained in:
dump_stack() 2023-05-31 18:21:30 +00:00
parent 5396375b47
commit b0b19d87ca
Signed by: dump_stack
GPG Key ID: BE44DA8C062D87DC
2 changed files with 12 additions and 4 deletions

View File

@ -115,7 +115,7 @@ jobs:
echo 'WorkingDirectory=/root/test' >> test.service
echo 'TimeoutStopSec=1' >> test.service
echo 'ExecStart=/usr/local/bin/out-of-tree kernel autogen --threads=4 --max=256 --shuffle' >> test.service
echo 'ExecStart=/usr/local/bin/out-of-tree pew --qemu-timeout=4m --threads=4' >> test.service
echo 'ExecStart=/usr/local/bin/out-of-tree pew --qemu-timeout=4m --threads=4 --include-internal-errors' >> test.service
scp test.service root@$IP:/etc/systemd/system/test.service

14
pew.go
View File

@ -50,7 +50,8 @@ type PewCmd struct {
QemuAfterStartTimeout time.Duration `help:"timeout after starting of the qemu vm before tests"`
DockerTimeout time.Duration `help:"timeout for docker"`
Threshold float64 `help:"reliablity threshold for exit code" default:"1.00"`
Threshold float64 `help:"reliablity threshold for exit code" default:"1.00"`
IncludeInternalErrors bool `help:"count internal errors as part of the success rate"`
Endless bool `help:"endless tests"`
EndlessTimeout time.Duration `help:"timeout between tests" default:"1m"`
@ -140,9 +141,16 @@ func (cmd *PewCmd) Run(g *Globals) (err error) {
}
if state.InternalErrors > 0 {
s := "not counted towards success rate"
if cmd.IncludeInternalErrors {
s = "included in success rate"
}
log.Warn().Msgf("%d internal errors "+
"(not counted towards success rate)",
state.InternalErrors)
"(%s)", state.InternalErrors, s)
}
if cmd.IncludeInternalErrors {
state.Overall += float64(state.InternalErrors)
}
msg := fmt.Sprintf("Success rate: %.02f (%d/%d), Threshold: %.02f",