mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
judge: fix pretest for standalone judge
This commit is contained in:
1 parent
ecc1e10664
commit
c86b063415
4 files changed
+4
-16
No files matched your search
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "@hydrooj/hydrojudge",
|
"name": "@hydrooj/hydrojudge",
|
||||||
"bin": "bin/hydrojudge.js",
|
"bin": "bin/hydrojudge.js",
|
||||||
"version": "2.5.12",
|
"version": "2.5.13",
|
||||||
"main": "package.json",
|
"main": "package.json",
|
||||||
"author": "undefined <i@undefined.moe>",
|
"author": "undefined <i@undefined.moe>",
|
||||||
"repository": "https://github.com/hydro-dev/Hydro.git",
|
"repository": "https://github.com/hydro-dev/Hydro.git",
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import { parseFilename } from './utils';
|
|||||||
const testlibSrc = findFileSync('@hydrooj/hydrojudge/vendor/testlib/testlib.h');
|
const testlibSrc = findFileSync('@hydrooj/hydrojudge/vendor/testlib/testlib.h');
|
||||||
|
|
||||||
export async function check(config): Promise<[number, number, string]> {
|
export async function check(config): Promise<[number, number, string]> {
|
||||||
if (!checkers[config.checker_type]) throw new SystemError(`未知比较器类型:${config.checker_type}`);
|
if (!checkers[config.checker_type]) throw new SystemError('Unknown checker type {0}', [config.checker_type]);
|
||||||
const {
|
const {
|
||||||
code, status, score, message,
|
code, status, score, message,
|
||||||
} = await checkers[config.checker_type]({
|
} = await checkers[config.checker_type]({
|
||||||
|
|||||||
@@ -67,8 +67,7 @@ class JudgeTask {
|
|||||||
tmpfs.mount(this.tmpdir, '512m');
|
tmpfs.mount(this.tmpdir, '512m');
|
||||||
log.info('Submission: %s/%s/%s pid=%s', this.host, this.domainId, this.rid, this.pid);
|
log.info('Submission: %s/%s/%s pid=%s', this.host, this.domainId, this.rid, this.pid);
|
||||||
try {
|
try {
|
||||||
if (this.input) await this.doPretest();
|
await this.doSubmission();
|
||||||
else await this.doSubmission();
|
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
if (e instanceof CompileError) {
|
if (e instanceof CompileError) {
|
||||||
this.next({ compiler_text: compilerText(e.stdout, e.stderr) });
|
this.next({ compiler_text: compilerText(e.stdout, e.stderr) });
|
||||||
@@ -107,17 +106,6 @@ class JudgeTask {
|
|||||||
await judge[this.config.type || 'default'].judge(this);
|
await judge[this.config.type || 'default'].judge(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
async doPretest() {
|
|
||||||
this.folder = path.resolve(this.tmpdir, 'data');
|
|
||||||
await this.session.recordPretestData(this.rid, this.folder);
|
|
||||||
this.config = await readCases(
|
|
||||||
this.folder,
|
|
||||||
{ detail: this.session.config.detail },
|
|
||||||
{ next: this.next },
|
|
||||||
);
|
|
||||||
await judge[this.config.type || 'default'].judge(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
next(data, id?: number) {
|
next(data, id?: number) {
|
||||||
log.debug('Next: %d %o', id, data);
|
log.debug('Next: %d %o', id, data);
|
||||||
data.key = 'next';
|
data.key = 'next';
|
||||||
|
|||||||
@@ -76,7 +76,7 @@ function judgeCase(c, sid) {
|
|||||||
checker: ctx.config.checker,
|
checker: ctx.config.checker,
|
||||||
checker_type: ctx.config.checker_type,
|
checker_type: ctx.config.checker_type,
|
||||||
score: ctxSubtask.subtask.score,
|
score: ctxSubtask.subtask.score,
|
||||||
detail: ctx.config.detail || true,
|
detail: ctx.config.detail ?? true,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
} else if (status === STATUS.STATUS_RUNTIME_ERROR && code) {
|
} else if (status === STATUS.STATUS_RUNTIME_ERROR && code) {
|
||||||
|
|||||||
Reference in new issue
Block a user