From b0b19d87ca49add5639b8a3d8dc8e5ee1faa9649 Mon Sep 17 00:00:00 2001 From: Mikhail Klementev Date: Wed, 31 May 2023 18:21:30 +0000 Subject: [PATCH] feat: add flag to count internal errors as part of the success rate --- .github/workflows/e2e.yml | 2 +- pew.go | 14 +++++++++++--- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/.github/workflows/e2e.yml b/.github/workflows/e2e.yml index c430733..21eeac5 100644 --- a/.github/workflows/e2e.yml +++ b/.github/workflows/e2e.yml @@ -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 diff --git a/pew.go b/pew.go index b963863..51785de 100644 --- a/pew.go +++ b/pew.go @@ -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",