From c86b063415ed6f79edf740fa112e7b1f5af996f6 Mon Sep 17 00:00:00 2001 From: undefined Date: Fri, 23 Apr 2021 12:27:30 +0800 Subject: [PATCH] judge: fix pretest for standalone judge --- packages/hydrojudge/package.json | 2 +- packages/hydrojudge/src/check.ts | 2 +- packages/hydrojudge/src/hosts/hydro.ts | 14 +------------- packages/hydrojudge/src/judge/default.ts | 2 +- 4 files changed, 4 insertions(+), 16 deletions(-) diff --git a/packages/hydrojudge/package.json b/packages/hydrojudge/package.json index 20c8fd266..af6c38f21 100644 --- a/packages/hydrojudge/package.json +++ b/packages/hydrojudge/package.json @@ -1,7 +1,7 @@ { "name": "@hydrooj/hydrojudge", "bin": "bin/hydrojudge.js", - "version": "2.5.12", + "version": "2.5.13", "main": "package.json", "author": "undefined ", "repository": "https://github.com/hydro-dev/Hydro.git", diff --git a/packages/hydrojudge/src/check.ts b/packages/hydrojudge/src/check.ts index 81ca09394..6085cba5a 100644 --- a/packages/hydrojudge/src/check.ts +++ b/packages/hydrojudge/src/check.ts @@ -8,7 +8,7 @@ import { parseFilename } from './utils'; const testlibSrc = findFileSync('@hydrooj/hydrojudge/vendor/testlib/testlib.h'); 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 { code, status, score, message, } = await checkers[config.checker_type]({ diff --git a/packages/hydrojudge/src/hosts/hydro.ts b/packages/hydrojudge/src/hosts/hydro.ts index 960cc115d..adc522ed8 100644 --- a/packages/hydrojudge/src/hosts/hydro.ts +++ b/packages/hydrojudge/src/hosts/hydro.ts @@ -67,8 +67,7 @@ class JudgeTask { tmpfs.mount(this.tmpdir, '512m'); log.info('Submission: %s/%s/%s pid=%s', this.host, this.domainId, this.rid, this.pid); try { - if (this.input) await this.doPretest(); - else await this.doSubmission(); + await this.doSubmission(); } catch (e) { if (e instanceof CompileError) { this.next({ compiler_text: compilerText(e.stdout, e.stderr) }); @@ -107,17 +106,6 @@ class JudgeTask { 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) { log.debug('Next: %d %o', id, data); data.key = 'next'; diff --git a/packages/hydrojudge/src/judge/default.ts b/packages/hydrojudge/src/judge/default.ts index 3e4a6b2c0..959f0a2a3 100644 --- a/packages/hydrojudge/src/judge/default.ts +++ b/packages/hydrojudge/src/judge/default.ts @@ -76,7 +76,7 @@ function judgeCase(c, sid) { checker: ctx.config.checker, checker_type: ctx.config.checker_type, score: ctxSubtask.subtask.score, - detail: ctx.config.detail || true, + detail: ctx.config.detail ?? true, }); } } else if (status === STATUS.STATUS_RUNTIME_ERROR && code) {