From 6db5ffc8c21ad4728fbefc4025c2fc940ec04775 Mon Sep 17 00:00:00 2001 From: Mikhail Klementev Date: Thu, 25 May 2023 10:02:45 +0000 Subject: [PATCH] fix: correct success rate --- pew.go | 53 ++++++++++++++++++++++++++++------------------------- 1 file changed, 28 insertions(+), 25 deletions(-) diff --git a/pew.go b/pew.go index 1e1f25a..76691bb 100644 --- a/pew.go +++ b/pew.go @@ -353,13 +353,11 @@ func testKernelExploit(q *qemu.System, ka config.Artifact, } func genOkFail(name string, ok bool) (aurv aurora.Value) { - state.Overall += 1 s := " " + name if name == "" { s = "" } if ok { - state.Success += 1 s += " SUCCESS " aurv = aurora.BgGreen(aurora.Black(s)) } else { @@ -410,32 +408,37 @@ func dumpResult(q *qemu.System, ka config.Artifact, ki distro.KernelInfo, Str("timeout", fmt.Sprintf("%v", q.KilledByTimeout)). Msg("internal") res.InternalErrorString = res.InternalError.Error() - } + } else { + colored := "" - colored := "" - switch ka.Type { - case config.KernelExploit: - colored = aurora.Sprintf("%s %s", - genOkFail("BUILD", res.Build.Ok), - genOkFail("LPE", res.Test.Ok)) - case config.KernelModule: - colored = aurora.Sprintf("%s %s %s", - genOkFail("BUILD", res.Build.Ok), - genOkFail("INSMOD", res.Run.Ok), - genOkFail("TEST", res.Test.Ok)) - case config.Script: - colored = aurora.Sprintf("%s", - genOkFail("", res.Test.Ok)) - } + state.Overall += 1 - additional := "" - if q.KernelPanic { - additional = "(panic)" - } else if q.KilledByTimeout { - additional = "(timeout)" - } + if res.Test.Ok { + state.Success += 1 + } + + switch ka.Type { + case config.KernelExploit: + colored = aurora.Sprintf("%s %s", + genOkFail("BUILD", res.Build.Ok), + genOkFail("LPE", res.Test.Ok)) + case config.KernelModule: + colored = aurora.Sprintf("%s %s %s", + genOkFail("BUILD", res.Build.Ok), + genOkFail("INSMOD", res.Run.Ok), + genOkFail("TEST", res.Test.Ok)) + case config.Script: + colored = aurora.Sprintf("%s", + genOkFail("", res.Test.Ok)) + } + + additional := "" + if q.KernelPanic { + additional = "(panic)" + } else if q.KilledByTimeout { + additional = "(timeout)" + } - if res.InternalError == nil { if additional != "" { q.Log.Info().Msgf("%v %v", colored, additional) } else {