1
0

refactor: logs

This commit is contained in:
dump_stack() 2024-10-07 16:47:39 +00:00
parent b32c097446
commit 7cb5877fd0
Signed by: dump_stack
GPG Key ID: C9905BA72B5E02BB
2 changed files with 12 additions and 9 deletions

View File

@ -12,7 +12,6 @@ import (
"github.com/naoina/toml"
"github.com/rs/zerolog"
"github.com/rs/zerolog/log"
"code.dumpstack.io/tools/out-of-tree/config/dotfiles"
"code.dumpstack.io/tools/out-of-tree/distro"
@ -338,8 +337,10 @@ func (ka Artifact) Process(slog zerolog.Logger, ki distro.KernelInfo,
slog.Debug().Str("duration", time.Since(start).String()).
Msg("build done")
if err != nil {
log.Error().Err(err).Msg("build")
slog.Error().Err(err).Msg("build")
return
} else {
slog.Info().Err(err).Msg("build success")
}
result.Build.Ok = true
} else {

View File

@ -313,8 +313,7 @@ func copyArtifactAndTest(slog zerolog.Logger, q *qemu.System, ka Artifact,
res.Test.Output, err = testKernelModule(q, ka, remoteTest)
if err != nil {
slog.Error().Err(err).Msg(res.Test.Output)
return
break
}
res.Test.Ok = true
case KernelExploit:
@ -327,16 +326,14 @@ func copyArtifactAndTest(slog zerolog.Logger, q *qemu.System, ka Artifact,
res.Test.Output, err = testKernelExploit(q, ka, remoteTest,
remoteExploit)
if err != nil {
slog.Error().Err(err).Msg(res.Test.Output)
return
break
}
res.Run.Ok = true // does not really used
res.Test.Ok = true
case Script:
res.Test.Output, err = runScript(q, remoteTest)
if err != nil {
slog.Error().Err(err).Msg(res.Test.Output)
return
break
}
res.Run.Ok = true
res.Test.Ok = true
@ -344,7 +341,12 @@ func copyArtifactAndTest(slog zerolog.Logger, q *qemu.System, ka Artifact,
slog.Fatal().Msg("Unsupported artifact type")
}
slog.Info().Msgf("\n%v\n", res.Test.Output)
if err != nil || !res.Test.Ok {
slog.Error().Err(err).Msgf("test error\n%v\n", res.Test.Output)
return
}
slog.Info().Msgf("test success\n%v\n", res.Test.Output)
_, err = q.Command("root", "echo")
if err != nil {