From 27abdc3687ebb8ea25e289966ebe9f51a27caf65 Mon Sep 17 00:00:00 2001 From: Mikhail Klementev Date: Wed, 9 Oct 2024 09:10:19 +0000 Subject: [PATCH] fix: do not print output on error if real-time output is enabled --- artifact/artifact.go | 10 +++++++--- artifact/process.go | 6 +++++- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/artifact/artifact.go b/artifact/artifact.go index 18a69ea..9613e53 100644 --- a/artifact/artifact.go +++ b/artifact/artifact.go @@ -338,7 +338,11 @@ func (ka Artifact) Process(slog zerolog.Logger, ki distro.KernelInfo, slog.Debug().Str("duration", time.Since(start).String()). Msg("build done") if err != nil { - slog.Error().Err(err).Msgf("build failure\n%v\n", result.Build.Output) + if !realtimeOutput { + slog.Error().Err(err).Msgf("build failure\n%v\n", result.Build.Output) + } else { + slog.Error().Err(err).Msg("build failure") + } return } else { if outputOnSuccess && !realtimeOutput { @@ -423,10 +427,10 @@ func (ka Artifact) Process(slog zerolog.Logger, ki distro.KernelInfo, slog.Debug().Str("duration", time.Since(start).String()). Msgf("test completed (success: %v)", result.Test.Ok) - if result.Build.Ok { + if result.Build.Ok && !realtimeOutput { if !result.Run.Ok || !result.Test.Ok { slog.Error().Msgf("qemu output\n%v\n", qemuTestOutput) - } else if outputOnSuccess && !realtimeOutput { + } else if outputOnSuccess { slog.Info().Msgf("qemu output\n%v\n", qemuTestOutput) } } diff --git a/artifact/process.go b/artifact/process.go index edd3f2f..1378a5f 100644 --- a/artifact/process.go +++ b/artifact/process.go @@ -352,7 +352,11 @@ func copyArtifactAndTest(slog zerolog.Logger, q *qemu.System, ka Artifact, } if err != nil || !res.Test.Ok { - slog.Error().Err(err).Msgf("test error\n%v\n", res.Test.Output) + if !realtimeOutput { + slog.Error().Err(err).Msgf("test failure\n%v\n", res.Test.Output) + } else { + slog.Error().Err(err).Msg("test failure") + } return }