feat: parameter to display the output of successful stages
This commit is contained in:
parent
a852e2d9e9
commit
fee3b44c6e
@ -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,
|
||||
endless bool, cBinary,
|
||||
outputOnSuccess, endless bool, cBinary,
|
||||
cEndlessStress string, cEndlessTimeout time.Duration,
|
||||
dump func(q *qemu.System, ka Artifact, ki distro.KernelInfo,
|
||||
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)
|
||||
return
|
||||
} 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
|
||||
} else {
|
||||
@ -404,14 +408,14 @@ func (ka Artifact) Process(slog zerolog.Logger, ki distro.KernelInfo,
|
||||
})
|
||||
|
||||
start := time.Now()
|
||||
copyArtifactAndTest(slog, q, ka, &result, remoteTest)
|
||||
copyArtifactAndTest(slog, q, ka, &result, remoteTest, outputOnSuccess)
|
||||
slog.Debug().Str("duration", time.Since(start).String()).
|
||||
Msgf("test completed (success: %v)", result.Test.Ok)
|
||||
|
||||
if result.Build.Ok {
|
||||
if !result.Run.Ok || !result.Test.Ok {
|
||||
slog.Error().Msgf("qemu output\n%v\n", qemuTestOutput)
|
||||
} else {
|
||||
} else if outputOnSuccess {
|
||||
slog.Info().Msgf("qemu output\n%v\n", qemuTestOutput)
|
||||
}
|
||||
}
|
||||
|
@ -281,7 +281,7 @@ func CopyFile(sourcePath, destinationPath string) (err error) {
|
||||
}
|
||||
|
||||
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
|
||||
for _, f := range ka.TestFiles {
|
||||
@ -346,7 +346,11 @@ func copyArtifactAndTest(slog zerolog.Logger, q *qemu.System, ka Artifact,
|
||||
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")
|
||||
if err != nil {
|
||||
|
@ -87,6 +87,8 @@ type PewCmd struct {
|
||||
Threshold float64 `help:"reliablity threshold for exit code" default:"1.00"`
|
||||
IncludeInternalErrors bool `help:"count internal errors as part of the success rate"`
|
||||
|
||||
OutputOnSuccess bool `help:"show output on success"`
|
||||
|
||||
Endless bool `help:"endless tests"`
|
||||
EndlessTimeout time.Duration `help:"timeout between tests" default:"1m"`
|
||||
EndlessStress string `help:"endless stress script" type:"existingfile"`
|
||||
@ -445,7 +447,7 @@ func (cmd PewCmd) testArtifact(swg *sizedwaitgroup.SizedWaitGroup,
|
||||
Str("kernel", ki.KernelRelease).
|
||||
Logger()
|
||||
|
||||
ka.Process(slog, ki,
|
||||
ka.Process(slog, ki, cmd.OutputOnSuccess,
|
||||
cmd.Endless, cmd.Binary, cmd.EndlessStress, cmd.EndlessTimeout,
|
||||
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)
|
||||
|
@ -131,7 +131,7 @@ func (pj *jobProcessor) Process(res *Resources) (err error) {
|
||||
var result *artifact.Result
|
||||
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,
|
||||
res *artifact.Result) {
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user