1
0

feat: parameter to display the output of successful stages

This commit is contained in:
dump_stack() 2024-10-07 20:59:16 +00:00
parent a852e2d9e9
commit fee3b44c6e
Signed by: dump_stack
GPG Key ID: C9905BA72B5E02BB
4 changed files with 18 additions and 8 deletions

View File

@ -241,7 +241,7 @@ func (ka Artifact) Supported(ki distro.KernelInfo) (supported bool, err error) {
} }
func (ka Artifact) Process(slog zerolog.Logger, ki distro.KernelInfo, func (ka Artifact) Process(slog zerolog.Logger, ki distro.KernelInfo,
endless bool, cBinary, outputOnSuccess, endless bool, cBinary,
cEndlessStress string, cEndlessTimeout time.Duration, cEndlessStress string, cEndlessTimeout time.Duration,
dump func(q *qemu.System, ka Artifact, ki distro.KernelInfo, dump func(q *qemu.System, ka Artifact, ki distro.KernelInfo,
result *Result)) { result *Result)) {
@ -340,7 +340,11 @@ func (ka Artifact) Process(slog zerolog.Logger, ki distro.KernelInfo,
slog.Error().Err(err).Msgf("build failure\n%v\n", result.Build.Output) slog.Error().Err(err).Msgf("build failure\n%v\n", result.Build.Output)
return return
} else { } else {
slog.Info().Msgf("build success\n%v\n", result.Build.Output) if outputOnSuccess {
slog.Info().Msgf("build success\n%v\n", result.Build.Output)
} else {
slog.Info().Msg("build success")
}
} }
result.Build.Ok = true result.Build.Ok = true
} else { } else {
@ -404,14 +408,14 @@ func (ka Artifact) Process(slog zerolog.Logger, ki distro.KernelInfo,
}) })
start := time.Now() start := time.Now()
copyArtifactAndTest(slog, q, ka, &result, remoteTest) copyArtifactAndTest(slog, q, ka, &result, remoteTest, outputOnSuccess)
slog.Debug().Str("duration", time.Since(start).String()). slog.Debug().Str("duration", time.Since(start).String()).
Msgf("test completed (success: %v)", result.Test.Ok) Msgf("test completed (success: %v)", result.Test.Ok)
if result.Build.Ok { if result.Build.Ok {
if !result.Run.Ok || !result.Test.Ok { if !result.Run.Ok || !result.Test.Ok {
slog.Error().Msgf("qemu output\n%v\n", qemuTestOutput) slog.Error().Msgf("qemu output\n%v\n", qemuTestOutput)
} else { } else if outputOnSuccess {
slog.Info().Msgf("qemu output\n%v\n", qemuTestOutput) slog.Info().Msgf("qemu output\n%v\n", qemuTestOutput)
} }
} }

View File

@ -281,7 +281,7 @@ func CopyFile(sourcePath, destinationPath string) (err error) {
} }
func copyArtifactAndTest(slog zerolog.Logger, q *qemu.System, ka Artifact, func copyArtifactAndTest(slog zerolog.Logger, q *qemu.System, ka Artifact,
res *Result, remoteTest string) (err error) { res *Result, remoteTest string, outputOnSuccess bool) (err error) {
// Copy all test files to the remote machine // Copy all test files to the remote machine
for _, f := range ka.TestFiles { for _, f := range ka.TestFiles {
@ -346,7 +346,11 @@ func copyArtifactAndTest(slog zerolog.Logger, q *qemu.System, ka Artifact,
return return
} }
slog.Info().Msgf("test success\n%v\n", res.Test.Output) if outputOnSuccess {
slog.Info().Msgf("test success\n%v\n", res.Test.Output)
} else {
slog.Info().Msg("test success")
}
_, err = q.Command("root", "echo") _, err = q.Command("root", "echo")
if err != nil { if err != nil {

View File

@ -87,6 +87,8 @@ type PewCmd struct {
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"` IncludeInternalErrors bool `help:"count internal errors as part of the success rate"`
OutputOnSuccess bool `help:"show output on success"`
Endless bool `help:"endless tests"` Endless bool `help:"endless tests"`
EndlessTimeout time.Duration `help:"timeout between tests" default:"1m"` EndlessTimeout time.Duration `help:"timeout between tests" default:"1m"`
EndlessStress string `help:"endless stress script" type:"existingfile"` EndlessStress string `help:"endless stress script" type:"existingfile"`
@ -445,7 +447,7 @@ func (cmd PewCmd) testArtifact(swg *sizedwaitgroup.SizedWaitGroup,
Str("kernel", ki.KernelRelease). Str("kernel", ki.KernelRelease).
Logger() Logger()
ka.Process(slog, ki, ka.Process(slog, ki, cmd.OutputOnSuccess,
cmd.Endless, cmd.Binary, cmd.EndlessStress, cmd.EndlessTimeout, cmd.Endless, cmd.Binary, cmd.EndlessStress, cmd.EndlessTimeout,
func(q *qemu.System, ka artifact.Artifact, ki distro.KernelInfo, result *artifact.Result) { func(q *qemu.System, ka artifact.Artifact, ki distro.KernelInfo, result *artifact.Result) {
dumpResult(q, ka, ki, result, cmd.Dist, cmd.Tag, cmd.Binary, cmd.DB) dumpResult(q, ka, ki, result, cmd.Dist, cmd.Tag, cmd.Binary, cmd.DB)

View File

@ -131,7 +131,7 @@ func (pj *jobProcessor) Process(res *Resources) (err error) {
var result *artifact.Result var result *artifact.Result
var dq *qemu.System var dq *qemu.System
pj.job.Artifact.Process(pj.log, pj.job.Target, false, "", "", 0, pj.job.Artifact.Process(pj.log, pj.job.Target, false, false, "", "", 0,
func(q *qemu.System, ka artifact.Artifact, ki distro.KernelInfo, func(q *qemu.System, ka artifact.Artifact, ki distro.KernelInfo,
res *artifact.Result) { res *artifact.Result) {