judge: support fileIO on pretest (#840)

This commit is contained in:
panda authored and GitHub committed 2024-07-15 14:11:29 +08:00
1 parent e3e69c7c7d
commit 0ad2a172d5
2 files changed
+3 -2

No files matched your search

+1
View File
@@ -18,6 +18,7 @@ export const judge = async (ctx: JudgeTask) => {
// Allow 2x limits for better debugging
time: parseTimeMS(ctx.config.time || '1s') * 2,
memory: parseMemoryMB(ctx.config.memory || '128m'),
filename: ctx.config.filename,
addressSpaceLimit: address_space_limit,
processLimit: process_limit,
},
+2 -2
View File
@@ -74,7 +74,7 @@ function parseArgs(execute: string): string[] {
function proc(params: Parameter): Cmd {
const copyOut = supportOptional
? params.copyOut
? (params.copyOut || [])
: (params.copyOut || []).map((i) => (i.endsWith('?') ? i.substring(0, i.length - 1) : i));
const stdioLimit = parseMemoryMB(getConfig('stdio_size'));
const stdioSize = params.cacheStdoutAndStderr ? stdioLimit : 4;
@@ -82,7 +82,7 @@ function proc(params: Parameter): Cmd {
if (params.cacheStdoutAndStderr) {
copyOutCached.push('stdout', 'stderr');
if (params.filename) copyOutCached.push(`${params.filename}.out?`);
}
} else if (params.filename) copyOut.push(`${params.filename}.out${supportOptional ? '?' : ''}`);
const copyIn = { ...(params.copyIn || {}) };
const stdin = params.stdin || { content: '' };
if (params.filename) copyIn[`${params.filename}.in`] = stdin;