ffeat: diff finish
This commit is contained in:
parent
ad35dffbaf
commit
ac3e656ec1
|
@ -307,5 +307,73 @@ def fix_comment(task_stage: TaskStage, conf_stage: ResultStage) -> ResultStage:
|
||||||
|
|
||||||
|
|
||||||
def fix_diff(task_stage: TaskStage, conf_stage: ResultStage) -> ResultStage:
|
def fix_diff(task_stage: TaskStage, conf_stage: ResultStage) -> ResultStage:
|
||||||
|
if task_stage.parsers is not None and "diff" in task_stage.parsers:
|
||||||
|
diff_parser = next((p for p in conf_stage.parsers if p.name == "diff"), None)
|
||||||
|
skip = task_stage.skip or []
|
||||||
|
cases = task_stage.cases or {}
|
||||||
|
finalized_cases = [case for case in cases if case not in skip]
|
||||||
|
|
||||||
|
stage_cases = []
|
||||||
|
parser_cases = []
|
||||||
|
|
||||||
|
for case in finalized_cases:
|
||||||
|
case_stage = task_stage.cases.get(case) if task_stage.cases else None
|
||||||
|
if not case_stage:
|
||||||
|
continue
|
||||||
|
|
||||||
|
# Ensure case_stage.limit is defined before accessing .cpu and .mem
|
||||||
|
cpu_limit = (
|
||||||
|
case_stage.limit.cpu * 1_000_000_000
|
||||||
|
if case_stage.limit and case_stage.limit.cpu is not None
|
||||||
|
else 0
|
||||||
|
)
|
||||||
|
clock_limit = (
|
||||||
|
2 * case_stage.limit.cpu * 1_000_000_000
|
||||||
|
if case_stage.limit and case_stage.limit.cpu is not None
|
||||||
|
else 0
|
||||||
|
)
|
||||||
|
memory_limit = (
|
||||||
|
case_stage.limit.mem * 1_024 * 1_024
|
||||||
|
if case_stage.limit and case_stage.limit.mem is not None
|
||||||
|
else 0
|
||||||
|
)
|
||||||
|
|
||||||
|
stage_cases.append(
|
||||||
|
OptionalCmd(
|
||||||
|
stdin=CmdFile(
|
||||||
|
src=f"/home/tt/.config/joj/{conf_stage.name}/{case}.in"
|
||||||
|
),
|
||||||
|
cpu_limit=cpu_limit,
|
||||||
|
clock_limit=clock_limit,
|
||||||
|
memory_limit=memory_limit,
|
||||||
|
proc_limit=50,
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
# Ensure case_stage.diff and case_stage.diff.output are defined
|
||||||
|
diff_output = (
|
||||||
|
case_stage.diff.output
|
||||||
|
if case_stage.diff and case_stage.diff.output
|
||||||
|
else None
|
||||||
|
)
|
||||||
|
if diff_output:
|
||||||
|
parser_cases.append(
|
||||||
|
{
|
||||||
|
"outputs": [
|
||||||
|
{
|
||||||
|
"score": diff_output.score,
|
||||||
|
"fileName": "stdout",
|
||||||
|
"answerPath": f"/home/tt/.config/joj/{conf_stage.name}/{case}.out",
|
||||||
|
"forceQuitOnDiff": diff_output.forcequit,
|
||||||
|
"alwaysHide": diff_output.hide,
|
||||||
|
"compareSpace": not diff_output.ignorespaces,
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
if diff_parser and task_stage.diff is not None:
|
||||||
|
diff_parser.with_.update({"name": "diff", "cases": parser_cases})
|
||||||
|
conf_stage.executor.with_.cases = stage_cases
|
||||||
|
|
||||||
return conf_stage
|
return conf_stage
|
||||||
|
|
|
@ -879,13 +879,168 @@
|
||||||
"dataSegmentLimit": false,
|
"dataSegmentLimit": false,
|
||||||
"addressSpaceLimit": false
|
"addressSpaceLimit": false
|
||||||
},
|
},
|
||||||
"cases": []
|
"cases": [
|
||||||
|
{
|
||||||
|
"args": null,
|
||||||
|
"env": [
|
||||||
|
"PATH=/usr/bin:/bin:/usr/local/bin"
|
||||||
|
],
|
||||||
|
"stdin": {
|
||||||
|
"src": "/home/tt/.config/joj/judge-base/case4.in",
|
||||||
|
"content": null,
|
||||||
|
"fileId": null,
|
||||||
|
"name": null,
|
||||||
|
"max": 4194304,
|
||||||
|
"symlink": null,
|
||||||
|
"streamIn": false,
|
||||||
|
"streamOut": false,
|
||||||
|
"pipe": false
|
||||||
|
},
|
||||||
|
"stdout": null,
|
||||||
|
"stderr": null,
|
||||||
|
"cpuLimit": 30000000000,
|
||||||
|
"realCpuLimit": null,
|
||||||
|
"clockLimit": 60000000000,
|
||||||
|
"memoryLimit": 10485760,
|
||||||
|
"stackLimit": null,
|
||||||
|
"procLimit": 50,
|
||||||
|
"cpuRateLimit": null,
|
||||||
|
"cpuSetLimit": null,
|
||||||
|
"copyIn": null,
|
||||||
|
"copyInCached": null,
|
||||||
|
"copyInDir": null,
|
||||||
|
"copyOut": null,
|
||||||
|
"copyOutCached": null,
|
||||||
|
"copyOutMax": null,
|
||||||
|
"copyOutDir": null,
|
||||||
|
"tty": null,
|
||||||
|
"strictMemoryLimit": null,
|
||||||
|
"dataSegmentLimit": null,
|
||||||
|
"addressSpaceLimit": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"args": null,
|
||||||
|
"env": [
|
||||||
|
"PATH=/usr/bin:/bin:/usr/local/bin"
|
||||||
|
],
|
||||||
|
"stdin": {
|
||||||
|
"src": "/home/tt/.config/joj/judge-base/case5.in",
|
||||||
|
"content": null,
|
||||||
|
"fileId": null,
|
||||||
|
"name": null,
|
||||||
|
"max": 4194304,
|
||||||
|
"symlink": null,
|
||||||
|
"streamIn": false,
|
||||||
|
"streamOut": false,
|
||||||
|
"pipe": false
|
||||||
|
},
|
||||||
|
"stdout": null,
|
||||||
|
"stderr": null,
|
||||||
|
"cpuLimit": 4000000000,
|
||||||
|
"realCpuLimit": null,
|
||||||
|
"clockLimit": 8000000000,
|
||||||
|
"memoryLimit": 4194304,
|
||||||
|
"stackLimit": null,
|
||||||
|
"procLimit": 50,
|
||||||
|
"cpuRateLimit": null,
|
||||||
|
"cpuSetLimit": null,
|
||||||
|
"copyIn": null,
|
||||||
|
"copyInCached": null,
|
||||||
|
"copyInDir": null,
|
||||||
|
"copyOut": null,
|
||||||
|
"copyOutCached": null,
|
||||||
|
"copyOutMax": null,
|
||||||
|
"copyOutDir": null,
|
||||||
|
"tty": null,
|
||||||
|
"strictMemoryLimit": null,
|
||||||
|
"dataSegmentLimit": null,
|
||||||
|
"addressSpaceLimit": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"args": null,
|
||||||
|
"env": [
|
||||||
|
"PATH=/usr/bin:/bin:/usr/local/bin"
|
||||||
|
],
|
||||||
|
"stdin": {
|
||||||
|
"src": "/home/tt/.config/joj/judge-base/case8.in",
|
||||||
|
"content": null,
|
||||||
|
"fileId": null,
|
||||||
|
"name": null,
|
||||||
|
"max": 4194304,
|
||||||
|
"symlink": null,
|
||||||
|
"streamIn": false,
|
||||||
|
"streamOut": false,
|
||||||
|
"pipe": false
|
||||||
|
},
|
||||||
|
"stdout": null,
|
||||||
|
"stderr": null,
|
||||||
|
"cpuLimit": 4000000000,
|
||||||
|
"realCpuLimit": null,
|
||||||
|
"clockLimit": 8000000000,
|
||||||
|
"memoryLimit": 4194304,
|
||||||
|
"stackLimit": null,
|
||||||
|
"procLimit": 50,
|
||||||
|
"cpuRateLimit": null,
|
||||||
|
"cpuSetLimit": null,
|
||||||
|
"copyIn": null,
|
||||||
|
"copyInCached": null,
|
||||||
|
"copyInDir": null,
|
||||||
|
"copyOut": null,
|
||||||
|
"copyOutCached": null,
|
||||||
|
"copyOutMax": null,
|
||||||
|
"copyOutDir": null,
|
||||||
|
"tty": null,
|
||||||
|
"strictMemoryLimit": null,
|
||||||
|
"dataSegmentLimit": null,
|
||||||
|
"addressSpaceLimit": null
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"parsers": [
|
"parsers": [
|
||||||
{
|
{
|
||||||
"name": "diff",
|
"name": "diff",
|
||||||
"with": {}
|
"with": {
|
||||||
|
"name": "diff",
|
||||||
|
"cases": [
|
||||||
|
{
|
||||||
|
"outputs": [
|
||||||
|
{
|
||||||
|
"score": 0,
|
||||||
|
"fileName": "stdout",
|
||||||
|
"answerPath": "/home/tt/.config/joj/judge-base/case4.out",
|
||||||
|
"forceQuitOnDiff": true,
|
||||||
|
"alwaysHide": false,
|
||||||
|
"compareSpace": true
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"outputs": [
|
||||||
|
{
|
||||||
|
"score": 0,
|
||||||
|
"fileName": "stdout",
|
||||||
|
"answerPath": "/home/tt/.config/joj/judge-base/case5.out",
|
||||||
|
"forceQuitOnDiff": true,
|
||||||
|
"alwaysHide": false,
|
||||||
|
"compareSpace": true
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"outputs": [
|
||||||
|
{
|
||||||
|
"score": 0,
|
||||||
|
"fileName": "stdout",
|
||||||
|
"answerPath": "/home/tt/.config/joj/judge-base/case8.out",
|
||||||
|
"forceQuitOnDiff": true,
|
||||||
|
"alwaysHide": false,
|
||||||
|
"compareSpace": true
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "dummy",
|
"name": "dummy",
|
||||||
|
@ -975,13 +1130,168 @@
|
||||||
"dataSegmentLimit": false,
|
"dataSegmentLimit": false,
|
||||||
"addressSpaceLimit": false
|
"addressSpaceLimit": false
|
||||||
},
|
},
|
||||||
"cases": []
|
"cases": [
|
||||||
|
{
|
||||||
|
"args": null,
|
||||||
|
"env": [
|
||||||
|
"PATH=/usr/bin:/bin:/usr/local/bin"
|
||||||
|
],
|
||||||
|
"stdin": {
|
||||||
|
"src": "/home/tt/.config/joj/judge-msan/case4.in",
|
||||||
|
"content": null,
|
||||||
|
"fileId": null,
|
||||||
|
"name": null,
|
||||||
|
"max": 4194304,
|
||||||
|
"symlink": null,
|
||||||
|
"streamIn": false,
|
||||||
|
"streamOut": false,
|
||||||
|
"pipe": false
|
||||||
|
},
|
||||||
|
"stdout": null,
|
||||||
|
"stderr": null,
|
||||||
|
"cpuLimit": 30000000000,
|
||||||
|
"realCpuLimit": null,
|
||||||
|
"clockLimit": 60000000000,
|
||||||
|
"memoryLimit": 10485760,
|
||||||
|
"stackLimit": null,
|
||||||
|
"procLimit": 50,
|
||||||
|
"cpuRateLimit": null,
|
||||||
|
"cpuSetLimit": null,
|
||||||
|
"copyIn": null,
|
||||||
|
"copyInCached": null,
|
||||||
|
"copyInDir": null,
|
||||||
|
"copyOut": null,
|
||||||
|
"copyOutCached": null,
|
||||||
|
"copyOutMax": null,
|
||||||
|
"copyOutDir": null,
|
||||||
|
"tty": null,
|
||||||
|
"strictMemoryLimit": null,
|
||||||
|
"dataSegmentLimit": null,
|
||||||
|
"addressSpaceLimit": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"args": null,
|
||||||
|
"env": [
|
||||||
|
"PATH=/usr/bin:/bin:/usr/local/bin"
|
||||||
|
],
|
||||||
|
"stdin": {
|
||||||
|
"src": "/home/tt/.config/joj/judge-msan/case5.in",
|
||||||
|
"content": null,
|
||||||
|
"fileId": null,
|
||||||
|
"name": null,
|
||||||
|
"max": 4194304,
|
||||||
|
"symlink": null,
|
||||||
|
"streamIn": false,
|
||||||
|
"streamOut": false,
|
||||||
|
"pipe": false
|
||||||
|
},
|
||||||
|
"stdout": null,
|
||||||
|
"stderr": null,
|
||||||
|
"cpuLimit": 4000000000,
|
||||||
|
"realCpuLimit": null,
|
||||||
|
"clockLimit": 8000000000,
|
||||||
|
"memoryLimit": 4194304,
|
||||||
|
"stackLimit": null,
|
||||||
|
"procLimit": 50,
|
||||||
|
"cpuRateLimit": null,
|
||||||
|
"cpuSetLimit": null,
|
||||||
|
"copyIn": null,
|
||||||
|
"copyInCached": null,
|
||||||
|
"copyInDir": null,
|
||||||
|
"copyOut": null,
|
||||||
|
"copyOutCached": null,
|
||||||
|
"copyOutMax": null,
|
||||||
|
"copyOutDir": null,
|
||||||
|
"tty": null,
|
||||||
|
"strictMemoryLimit": null,
|
||||||
|
"dataSegmentLimit": null,
|
||||||
|
"addressSpaceLimit": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"args": null,
|
||||||
|
"env": [
|
||||||
|
"PATH=/usr/bin:/bin:/usr/local/bin"
|
||||||
|
],
|
||||||
|
"stdin": {
|
||||||
|
"src": "/home/tt/.config/joj/judge-msan/case6.in",
|
||||||
|
"content": null,
|
||||||
|
"fileId": null,
|
||||||
|
"name": null,
|
||||||
|
"max": 4194304,
|
||||||
|
"symlink": null,
|
||||||
|
"streamIn": false,
|
||||||
|
"streamOut": false,
|
||||||
|
"pipe": false
|
||||||
|
},
|
||||||
|
"stdout": null,
|
||||||
|
"stderr": null,
|
||||||
|
"cpuLimit": 4000000000,
|
||||||
|
"realCpuLimit": null,
|
||||||
|
"clockLimit": 8000000000,
|
||||||
|
"memoryLimit": 4194304,
|
||||||
|
"stackLimit": null,
|
||||||
|
"procLimit": 50,
|
||||||
|
"cpuRateLimit": null,
|
||||||
|
"cpuSetLimit": null,
|
||||||
|
"copyIn": null,
|
||||||
|
"copyInCached": null,
|
||||||
|
"copyInDir": null,
|
||||||
|
"copyOut": null,
|
||||||
|
"copyOutCached": null,
|
||||||
|
"copyOutMax": null,
|
||||||
|
"copyOutDir": null,
|
||||||
|
"tty": null,
|
||||||
|
"strictMemoryLimit": null,
|
||||||
|
"dataSegmentLimit": null,
|
||||||
|
"addressSpaceLimit": null
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"parsers": [
|
"parsers": [
|
||||||
{
|
{
|
||||||
"name": "diff",
|
"name": "diff",
|
||||||
"with": {}
|
"with": {
|
||||||
|
"name": "diff",
|
||||||
|
"cases": [
|
||||||
|
{
|
||||||
|
"outputs": [
|
||||||
|
{
|
||||||
|
"score": 0,
|
||||||
|
"fileName": "stdout",
|
||||||
|
"answerPath": "/home/tt/.config/joj/judge-msan/case4.out",
|
||||||
|
"forceQuitOnDiff": true,
|
||||||
|
"alwaysHide": false,
|
||||||
|
"compareSpace": true
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"outputs": [
|
||||||
|
{
|
||||||
|
"score": 0,
|
||||||
|
"fileName": "stdout",
|
||||||
|
"answerPath": "/home/tt/.config/joj/judge-msan/case5.out",
|
||||||
|
"forceQuitOnDiff": true,
|
||||||
|
"alwaysHide": false,
|
||||||
|
"compareSpace": true
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"outputs": [
|
||||||
|
{
|
||||||
|
"score": 0,
|
||||||
|
"fileName": "stdout",
|
||||||
|
"answerPath": "/home/tt/.config/joj/judge-msan/case6.out",
|
||||||
|
"forceQuitOnDiff": true,
|
||||||
|
"alwaysHide": true,
|
||||||
|
"compareSpace": true
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "dummy",
|
"name": "dummy",
|
||||||
|
|
Loading…
Reference in New Issue
Block a user