judge: 错误详情上报

pull/15/head
undefined 4 years ago
parent 4798153ce9
commit de7223e055

@ -1,9 +1,16 @@
# Hydro
[![FOSSA Status](https://app.fossa.com/api/projects/git%2Bgithub.com%2Fhydro-dev%2FHydro.svg?type=shield)](https://app.fossa.com/projects/git%2Bgithub.com%2Fhydro-dev%2FHydro?ref=badge_shield)
Hydro是一个高效的信息学在线测评系统。特点易于部署轻量功能强大且易于扩展。
使用安装脚本ubuntu18.04
```sh
curl -sSL https://cdn.jsdelivr.net/gh/hydro-dev/Hydro@master/install/ubuntu-1804.sh | bash
```
其他平台请参照文档手动安装。
[中文文档](https://hydro.js.org/)
欢迎 star 本项目,这是对开发者的鼓励。

@ -1,7 +1,7 @@
{
"name": "@hydrooj/hydrojudge",
"bin": "bin/hydrojudge.js",
"version": "2.1.12",
"version": "2.1.13",
"main": "package.json",
"author": "masnn",
"repository": "https://github.com/hydro-dev/Hydro.git",

@ -59,7 +59,7 @@ function judgeCase(c) {
checker: ctx.config.checker,
checker_type: ctx.config.checker_type,
score: ctxSubtask.subtask.score,
detail: ctx.config.detail,
detail: ctx.config.detail || true,
});
}
} else if (status === STATUS.STATUS_RUNTIME_ERROR && code) {
@ -124,7 +124,7 @@ export const judge = async (ctx) => {
})(),
(async () => {
if (!ctx.config.checker_type || ctx.config.checker_type === 'default') {
return { execute: '', copyIn: {}, clean: Promise.resolve };
return { execute: '', copyIn: {}, clean: () => Promise.resolve() };
}
const copyIn = {};
for (const file of ctx.config.judge_extra_files) {

@ -86,15 +86,18 @@ async function postInit() {
async function cacheOpen(domainId: string, pid: string, version: string) {
const filePath = path.join(homedir(), '.cache', 'hydro', 'judge', domainId, pid);
logger.debug('Cache found at %s', filePath);
if (fs.existsSync(filePath)) {
let ver: string;
try {
ver = fs.readFileSync(path.join(filePath, 'version')).toString();
} catch (e) { /* ignore */ }
if (version === ver) return filePath;
fs.removeSync(filePath);
if (version === ver) {
logger.debug('Cache found at %s', filePath);
return filePath;
}
await fs.remove(filePath);
}
logger.debug('Downloading testdata to %s', filePath);
fs.ensureDirSync(filePath);
await problemData(domainId, pid, filePath);
fs.writeFileSync(path.join(filePath, 'version'), version);
@ -108,15 +111,18 @@ async function postInit() {
logger.debug('Next: %d %o', id, data);
data.domainId = that.domainId;
data.rid = new ObjectID(that.rid);
data.time = data.time_ms || data.time;
data.memory = data.memory_kb || data.memory;
data.compilerText = data.compiler_text || data.compilerText;
if (data.time_ms) data.time = data.time_ms;
if (data.memory_kb) data.memory = data.memory_kb;
if (data.compiler_text) data.compilerText = data.compiler_text;
delete data.time_ms;
delete data.memory_kb;
delete data.compiler_text;
if (data.case) {
data.case = {
status: data.case.status,
time: data.case.time_ms || data.case.time,
memory: data.case.memory_kb || data.case.memory,
message: data.message || data.judgeText,
message: data.case.message || data.case.judgeText || '',
};
}
if (id) {

@ -1,6 +1,6 @@
{
"name": "hydrooj",
"version": "2.13.29",
"version": "2.13.30",
"bin": "bin/hydrooj.js",
"main": "dist/loader.js",
"typings": "dist/loader.d.ts",

@ -42,7 +42,7 @@ export async function next(body: JudgeResultBody) {
const c: TestCase = {
memory: body.case.memory,
time: body.case.time,
message: body.case.message,
message: body.case.message || '',
status: body.case.status,
};
rdoc.testCases.push(c);

Loading…
Cancel
Save