对一组测试数据运行一次评测
(config *commonStructs.JudgeConfiguration, tc commonStructs.TestCase, id string)
| 87 | |
| 88 | // 对一组测试数据运行一次评测 |
| 89 | func (session *JudgeSession) runOneCase(config *commonStructs.JudgeConfiguration, tc commonStructs.TestCase, id string) *commonStructs.TestCaseResult { |
| 90 | session.Logger.Infof("Run test case: %s", id) |
| 91 | |
| 92 | var err error |
| 93 | |
| 94 | tcResult := commonStructs.TestCaseResult{} |
| 95 | tcResult.Handle = id |
| 96 | // 创建相关的文件路径 |
| 97 | tcResult.Input = tc.Input |
| 98 | tcResult.Output = tc.Output |
| 99 | tcResult.ProgramOut = id + "_program.out" |
| 100 | tcResult.ProgramError = id + "_program.err" |
| 101 | tcResult.CheckerOut = id + "_checker.out" |
| 102 | tcResult.CheckerError = id + "_checker.err" |
| 103 | tcResult.CheckerReport = id + "_checker.report" |
| 104 | |
| 105 | // 检查测试数据的输入输出文件是否存在 |
| 106 | err = checkTestCaseInputOutput(tc, config.ConfigDir) |
| 107 | if err != nil { |
| 108 | tcResult.JudgeResult = constants.JudgeFlagSE |
| 109 | tcResult.SeInfo = err.Error() |
| 110 | session.Logger.Error(err.Error()) |
| 111 | return &tcResult |
| 112 | } |
| 113 | |
| 114 | // 运行judge程序 |
| 115 | session.JudgeOnce(&tcResult) |
| 116 | |
| 117 | return &tcResult |
| 118 | } |
| 119 | |
| 120 | // RunJudge 执行评测 |
| 121 | func (session *JudgeSession) RunJudge() commonStructs.JudgeResult { |
no test coverage detected