mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
judge: 修复多个测试点间copyIn冲突
This commit is contained in:
1 parent
421f879b36
commit
bff5c08101
3 files changed
+4
-4
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.1.24",
|
"version": "2.1.25",
|
||||||
"main": "package.json",
|
"main": "package.json",
|
||||||
"author": "masnn",
|
"author": "masnn",
|
||||||
"repository": "https://github.com/hydro-dev/Hydro.git",
|
"repository": "https://github.com/hydro-dev/Hydro.git",
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ const Score = {
|
|||||||
function judgeCase(c) {
|
function judgeCase(c) {
|
||||||
return async (ctx, ctxSubtask) => {
|
return async (ctx, ctxSubtask) => {
|
||||||
const { filename } = ctx.config;
|
const { filename } = ctx.config;
|
||||||
const { copyIn } = ctx.execute;
|
const copyIn = { ...ctx.execute.copyIn };
|
||||||
if (filename) copyIn[`${filename}.in`] = { src: c.input };
|
if (filename) copyIn[`${filename}.in`] = { src: c.input };
|
||||||
const copyOut = filename ? [`${filename}.out`] : [];
|
const copyOut = filename ? [`${filename}.out`] : [];
|
||||||
const stdin = filename ? null : c.input;
|
const stdin = filename ? null : c.input;
|
||||||
@@ -144,7 +144,7 @@ export const judge = async (ctx) => {
|
|||||||
ctx.total_memory_usage_kb = 0;
|
ctx.total_memory_usage_kb = 0;
|
||||||
ctx.total_time_usage_ms = 0;
|
ctx.total_time_usage_ms = 0;
|
||||||
// sandbox seems cannot handle concurrent tasks with output file correctly
|
// sandbox seems cannot handle concurrent tasks with output file correctly
|
||||||
ctx.queue = new Queue({ concurrency: ctx.config.concurrency || (ctx.config.filename ? 1 : 2) });
|
ctx.queue = new Queue({ concurrency: ctx.config.concurrency || 2 });
|
||||||
for (const sid in ctx.config.subtasks) tasks.push(judgeSubtask(ctx.config.subtasks[sid])(ctx));
|
for (const sid in ctx.config.subtasks) tasks.push(judgeSubtask(ctx.config.subtasks[sid])(ctx));
|
||||||
await Promise.all(tasks);
|
await Promise.all(tasks);
|
||||||
ctx.stat.done = new Date();
|
ctx.stat.done = new Date();
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ export const judge = async (ctx) => {
|
|||||||
ctx.execute = await compile(ctx.lang, ctx.code, 'code', {}, ctx.next);
|
ctx.execute = await compile(ctx.lang, ctx.code, 'code', {}, ctx.next);
|
||||||
ctx.clean.push(ctx.execute.clean);
|
ctx.clean.push(ctx.execute.clean);
|
||||||
ctx.next({ status: STATUS.STATUS_JUDGING, progress: 0 });
|
ctx.next({ status: STATUS.STATUS_JUDGING, progress: 0 });
|
||||||
const { copyIn } = ctx.execute;
|
const copyIn = { ...ctx.execute.copyIn };
|
||||||
const stdin = path.resolve(ctx.tmpdir, 'stdin');
|
const stdin = path.resolve(ctx.tmpdir, 'stdin');
|
||||||
const stdout = path.resolve(ctx.tmpdir, 'stdout');
|
const stdout = path.resolve(ctx.tmpdir, 'stdout');
|
||||||
const stderr = path.resolve(ctx.tmpdir, 'stderr');
|
const stderr = path.resolve(ctx.tmpdir, 'stderr');
|
||||||
|
|||||||
Reference in new issue
Block a user