feat(parser): only check result status in resultstatus and healthcheck parser
Some checks failed
build / build (push) Failing after 6s
build / trigger-build-image (push) Has been skipped
submodules sync / sync (push) Has been cancelled

This commit is contained in:
张泊明518370910136 2024-11-03 01:51:03 -04:00
parent 3eab0e732b
commit e68de4fcc5
GPG Key ID: D47306D7062CDA9D
4 changed files with 3 additions and 38 deletions

View File

@ -1,10 +1,8 @@
package clangtidy
import (
"fmt"
"strings"
"github.com/criyle/go-judge/envexec"
"github.com/joint-online-judge/JOJ3/internal/stage"
)
@ -26,19 +24,7 @@ type ClangTidy struct{}
func Parse(executorResult stage.ExecutorResult, conf Conf) stage.ParserResult {
stdout := executorResult.Files[conf.Stdout]
stderr := executorResult.Files[conf.Stderr]
if executorResult.Status != stage.Status(envexec.StatusAccepted) {
if !((executorResult.Status == stage.Status(envexec.StatusNonzeroExitStatus)) &&
(executorResult.ExitStatus == 1)) {
return stage.ParserResult{
Score: 0,
Comment: fmt.Sprintf(
"Unexpected executor status: %s.\nStderr: %s",
executorResult.Status, stderr,
),
}
}
}
// stderr := executorResult.Files[conf.Stderr]
lines := strings.SplitAfter(stdout, "\n")
messages := ParseLines(lines, conf)
formattedMessages := Format(messages)

View File

@ -5,7 +5,6 @@ import (
"fmt"
"strings"
"github.com/criyle/go-judge/envexec"
"github.com/joint-online-judge/JOJ3/internal/stage"
)
@ -37,16 +36,6 @@ type CppCheck struct{}
func Parse(executorResult stage.ExecutorResult, conf Conf) stage.ParserResult {
// stdout := executorResult.Files[conf.Stdout]
stderr := executorResult.Files[conf.Stderr]
if executorResult.Status != stage.Status(envexec.StatusAccepted) {
return stage.ParserResult{
Score: 0,
Comment: fmt.Sprintf(
"Unexpected executor status: %s.\nStderr: %s",
executorResult.Status, stderr,
),
}
}
records := make([]Record, 0)
lines := strings.Split(stderr, "\n")
for _, line := range lines {

View File

@ -21,7 +21,7 @@ func Parse(executorResult stage.ExecutorResult, conf Conf) (stage.ParserResult,
return stage.ParserResult{
Score: 0,
Comment: fmt.Sprintf(
"Unexpected executor status: %s.\n`stdout`: ```%s\n```\n`stderr`: ```%s\n```",
"Unexpected executor status: %s.\n`stdout`:\n```%s\n```\n`stderr`:\n```%s\n```",
executorResult.Status, stdout, stderr,
),
}, true

View File

@ -4,7 +4,6 @@ import (
"encoding/json"
"fmt"
"github.com/criyle/go-judge/envexec"
"github.com/joint-online-judge/JOJ3/internal/stage"
"github.com/joint-online-judge/JOJ3/pkg/sample"
)
@ -20,16 +19,7 @@ type Sample struct{}
func Parse(executorResult stage.ExecutorResult, conf Conf) stage.ParserResult {
stdout := executorResult.Files[conf.Stdout]
stderr := executorResult.Files[conf.Stderr]
if executorResult.Status != stage.Status(envexec.StatusAccepted) {
return stage.ParserResult{
Score: 0,
Comment: fmt.Sprintf(
"Unexpected executor status: %s.\nStderr: %s",
executorResult.Status, stderr,
),
}
}
// stderr := executorResult.Files[conf.Stderr]
var sampleResult sample.Result
err := json.Unmarshal([]byte(stdout), &sampleResult)
if err != nil {