refactor: logs
This commit is contained in:
parent
b32c097446
commit
7cb5877fd0
@ -12,7 +12,6 @@ import (
|
|||||||
|
|
||||||
"github.com/naoina/toml"
|
"github.com/naoina/toml"
|
||||||
"github.com/rs/zerolog"
|
"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/config/dotfiles"
|
||||||
"code.dumpstack.io/tools/out-of-tree/distro"
|
"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()).
|
slog.Debug().Str("duration", time.Since(start).String()).
|
||||||
Msg("build done")
|
Msg("build done")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error().Err(err).Msg("build")
|
slog.Error().Err(err).Msg("build")
|
||||||
return
|
return
|
||||||
|
} else {
|
||||||
|
slog.Info().Err(err).Msg("build success")
|
||||||
}
|
}
|
||||||
result.Build.Ok = true
|
result.Build.Ok = true
|
||||||
} else {
|
} else {
|
||||||
|
@ -313,8 +313,7 @@ func copyArtifactAndTest(slog zerolog.Logger, q *qemu.System, ka Artifact,
|
|||||||
|
|
||||||
res.Test.Output, err = testKernelModule(q, ka, remoteTest)
|
res.Test.Output, err = testKernelModule(q, ka, remoteTest)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
slog.Error().Err(err).Msg(res.Test.Output)
|
break
|
||||||
return
|
|
||||||
}
|
}
|
||||||
res.Test.Ok = true
|
res.Test.Ok = true
|
||||||
case KernelExploit:
|
case KernelExploit:
|
||||||
@ -327,16 +326,14 @@ func copyArtifactAndTest(slog zerolog.Logger, q *qemu.System, ka Artifact,
|
|||||||
res.Test.Output, err = testKernelExploit(q, ka, remoteTest,
|
res.Test.Output, err = testKernelExploit(q, ka, remoteTest,
|
||||||
remoteExploit)
|
remoteExploit)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
slog.Error().Err(err).Msg(res.Test.Output)
|
break
|
||||||
return
|
|
||||||
}
|
}
|
||||||
res.Run.Ok = true // does not really used
|
res.Run.Ok = true // does not really used
|
||||||
res.Test.Ok = true
|
res.Test.Ok = true
|
||||||
case Script:
|
case Script:
|
||||||
res.Test.Output, err = runScript(q, remoteTest)
|
res.Test.Output, err = runScript(q, remoteTest)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
slog.Error().Err(err).Msg(res.Test.Output)
|
break
|
||||||
return
|
|
||||||
}
|
}
|
||||||
res.Run.Ok = true
|
res.Run.Ok = true
|
||||||
res.Test.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.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")
|
_, err = q.Command("root", "echo")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
Loading…
Reference in New Issue
Block a user