feat(parser): make stdout & stderr file in conf
This commit is contained in:
parent
d56e3e5ebc
commit
cda3faeb9a
|
@ -17,13 +17,15 @@ type Conf struct {
|
||||||
Score int `default:"100"`
|
Score int `default:"100"`
|
||||||
RootDir string `default:"/w"`
|
RootDir string `default:"/w"`
|
||||||
Matches []Match
|
Matches []Match
|
||||||
|
Stdout string `default:"stdout"`
|
||||||
|
Stderr string `default:"stderr"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type ClangTidy struct{}
|
type ClangTidy struct{}
|
||||||
|
|
||||||
func Parse(executorResult stage.ExecutorResult, conf Conf) stage.ParserResult {
|
func Parse(executorResult stage.ExecutorResult, conf Conf) stage.ParserResult {
|
||||||
stdout := executorResult.Files["stdout"]
|
stdout := executorResult.Files[conf.Stdout]
|
||||||
stderr := executorResult.Files["stderr"]
|
stderr := executorResult.Files[conf.Stderr]
|
||||||
if executorResult.Status != stage.Status(envexec.StatusAccepted) {
|
if executorResult.Status != stage.Status(envexec.StatusAccepted) {
|
||||||
if !((executorResult.Status == stage.Status(envexec.StatusNonzeroExitStatus)) &&
|
if !((executorResult.Status == stage.Status(envexec.StatusNonzeroExitStatus)) &&
|
||||||
(executorResult.ExitStatus == 1)) {
|
(executorResult.ExitStatus == 1)) {
|
||||||
|
|
|
@ -19,6 +19,8 @@ type Match struct {
|
||||||
type Conf struct {
|
type Conf struct {
|
||||||
Score int `default:"100"`
|
Score int `default:"100"`
|
||||||
Matches []Match
|
Matches []Match
|
||||||
|
Stdout string `default:"stdout"`
|
||||||
|
Stderr string `default:"stderr"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type Record struct {
|
type Record struct {
|
||||||
|
@ -31,8 +33,8 @@ type Record struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
func Parse(executorResult stage.ExecutorResult, conf Conf) stage.ParserResult {
|
func Parse(executorResult stage.ExecutorResult, conf Conf) stage.ParserResult {
|
||||||
// stdout := executorResult.Files["stdout"]
|
// stdout := executorResult.Files[conf.Stdout]
|
||||||
stderr := executorResult.Files["stderr"]
|
stderr := executorResult.Files[conf.Stderr]
|
||||||
|
|
||||||
if executorResult.Status != stage.Status(envexec.StatusAccepted) {
|
if executorResult.Status != stage.Status(envexec.StatusAccepted) {
|
||||||
return stage.ParserResult{
|
return stage.ParserResult{
|
||||||
|
|
|
@ -9,9 +9,14 @@ import (
|
||||||
|
|
||||||
type Healthcheck struct{}
|
type Healthcheck struct{}
|
||||||
|
|
||||||
func Parse(executorResult stage.ExecutorResult) (stage.ParserResult, bool) {
|
type Conf struct {
|
||||||
stdout := executorResult.Files["stdout"]
|
Stdout string `default:"stdout"`
|
||||||
stderr := executorResult.Files["stderr"]
|
Stderr string `default:"stderr"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func Parse(executorResult stage.ExecutorResult, conf Conf) (stage.ParserResult, bool) {
|
||||||
|
stdout := executorResult.Files[conf.Stdout]
|
||||||
|
stderr := executorResult.Files[conf.Stderr]
|
||||||
if executorResult.Status != stage.Status(envexec.StatusAccepted) {
|
if executorResult.Status != stage.Status(envexec.StatusAccepted) {
|
||||||
return stage.ParserResult{
|
return stage.ParserResult{
|
||||||
Score: 0,
|
Score: 0,
|
||||||
|
@ -30,10 +35,14 @@ func Parse(executorResult stage.ExecutorResult) (stage.ParserResult, bool) {
|
||||||
func (*Healthcheck) Run(results []stage.ExecutorResult, confAny any) (
|
func (*Healthcheck) Run(results []stage.ExecutorResult, confAny any) (
|
||||||
[]stage.ParserResult, bool, error,
|
[]stage.ParserResult, bool, error,
|
||||||
) {
|
) {
|
||||||
|
conf, err := stage.DecodeConf[Conf](confAny)
|
||||||
|
if err != nil {
|
||||||
|
return nil, true, err
|
||||||
|
}
|
||||||
var res []stage.ParserResult
|
var res []stage.ParserResult
|
||||||
forceQuit := false
|
forceQuit := false
|
||||||
for _, result := range results {
|
for _, result := range results {
|
||||||
parserResult, forceQuitResult := Parse(result)
|
parserResult, forceQuitResult := Parse(result, *conf)
|
||||||
res = append(res, parserResult)
|
res = append(res, parserResult)
|
||||||
forceQuit = forceQuit || forceQuitResult
|
forceQuit = forceQuit || forceQuitResult
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,13 +12,15 @@ import (
|
||||||
type Conf struct {
|
type Conf struct {
|
||||||
Score int
|
Score int
|
||||||
Comment string
|
Comment string
|
||||||
|
Stdout string `default:"stdout"`
|
||||||
|
Stderr string `default:"stderr"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type Sample struct{}
|
type Sample struct{}
|
||||||
|
|
||||||
func Parse(executorResult stage.ExecutorResult, conf Conf) stage.ParserResult {
|
func Parse(executorResult stage.ExecutorResult, conf Conf) stage.ParserResult {
|
||||||
stdout := executorResult.Files["stdout"]
|
stdout := executorResult.Files[conf.Stdout]
|
||||||
stderr := executorResult.Files["stderr"]
|
stderr := executorResult.Files[conf.Stderr]
|
||||||
if executorResult.Status != stage.Status(envexec.StatusAccepted) {
|
if executorResult.Status != stage.Status(envexec.StatusAccepted) {
|
||||||
return stage.ParserResult{
|
return stage.ParserResult{
|
||||||
Score: 0,
|
Score: 0,
|
||||||
|
|
Loading…
Reference in New Issue
Block a user