fix: specified case with base dir
This commit is contained in:
parent
04839aecbd
commit
09f15f21ad
|
@ -197,16 +197,19 @@ def fix_diff(
|
||||||
task_path: Path,
|
task_path: Path,
|
||||||
) -> None:
|
) -> None:
|
||||||
base_dir = JOJ3_CONFIG_ROOT / task_path.parent
|
base_dir = JOJ3_CONFIG_ROOT / task_path.parent
|
||||||
|
case_base_dir = Path(task_stage.base_case_dir)
|
||||||
# cases not specified in the toml config (auto-detected)
|
# cases not specified in the toml config (auto-detected)
|
||||||
unspecified_cases = get_unspecified_cases(
|
unspecified_cases = get_unspecified_cases(
|
||||||
task_root, task_path, Path(task_stage.base_case_dir), task_stage.cases
|
task_root, task_path, case_base_dir, task_stage.cases
|
||||||
)
|
)
|
||||||
# cases specified in toml config but not skipped
|
# cases specified in toml config but not skipped
|
||||||
specified_cases = [(case, task_stage.cases[case]) for case in task_stage.cases]
|
specified_cases = [(case, task_stage.cases[case]) for case in task_stage.cases]
|
||||||
stage_cases = []
|
stage_cases = []
|
||||||
parser_cases = []
|
parser_cases = []
|
||||||
for case_name, case in specified_cases:
|
for case_name, case in specified_cases:
|
||||||
stdin, stdout = get_stdin_stdout(task_root, task_path, case_name, case)
|
stdin, stdout = get_stdin_stdout(
|
||||||
|
task_root, task_path, case_base_dir, case_name, case
|
||||||
|
)
|
||||||
if stdout is None:
|
if stdout is None:
|
||||||
logger.warning(
|
logger.warning(
|
||||||
f"In file {task_root / task_path}, "
|
f"In file {task_root / task_path}, "
|
||||||
|
@ -281,10 +284,12 @@ def fix_diff(
|
||||||
|
|
||||||
|
|
||||||
def get_unspecified_cases(
|
def get_unspecified_cases(
|
||||||
task_root: Path, task_path: Path, base_dir: Path, cases: Dict[str, task.Case]
|
task_root: Path, task_path: Path, case_base_dir: Path, cases: Dict[str, task.Case]
|
||||||
) -> List[str]:
|
) -> List[str]:
|
||||||
testcases = set()
|
testcases = set()
|
||||||
for testcases_path in ((task_root / task_path).parent / base_dir).glob("**/*.in"):
|
for testcases_path in ((task_root / task_path).parent / case_base_dir).glob(
|
||||||
|
"**/*.in"
|
||||||
|
):
|
||||||
if not testcases_path.with_suffix(".out").exists():
|
if not testcases_path.with_suffix(".out").exists():
|
||||||
logger.warning(
|
logger.warning(
|
||||||
f"In file {task_root / task_path}, "
|
f"In file {task_root / task_path}, "
|
||||||
|
@ -311,9 +316,13 @@ def get_unspecified_cases(
|
||||||
|
|
||||||
|
|
||||||
def get_stdin_stdout(
|
def get_stdin_stdout(
|
||||||
task_root: Path, task_path: Path, case_name: str, case: task.Case
|
task_root: Path,
|
||||||
|
task_path: Path,
|
||||||
|
case_base_dir: Path,
|
||||||
|
case_name: str,
|
||||||
|
case: task.Case,
|
||||||
) -> Tuple[result.Stdin, Optional[str]]:
|
) -> Tuple[result.Stdin, Optional[str]]:
|
||||||
base_dir = (task_root / task_path).parent
|
base_dir = (task_root / task_path).parent / case_base_dir
|
||||||
stdin: result.Stdin = result.MemoryFile(content="")
|
stdin: result.Stdin = result.MemoryFile(content="")
|
||||||
stdout = None
|
stdout = None
|
||||||
for case_stdout_path in base_dir.glob("**/*.out"):
|
for case_stdout_path in base_dir.glob("**/*.out"):
|
||||||
|
|
|
@ -330,7 +330,7 @@
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "[joj] ex2-asan base dir",
|
"name": "[joj] ex2-asan base dir task1",
|
||||||
"groups": [
|
"groups": [
|
||||||
"joj"
|
"joj"
|
||||||
],
|
],
|
||||||
|
@ -390,6 +390,11 @@
|
||||||
"src": "/home/tt/.config/joj/diff/task1/case5.in"
|
"src": "/home/tt/.config/joj/diff/task1/case5.in"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"stdin": {
|
||||||
|
"src": "/home/tt/.config/joj/diff/task1/case9.in"
|
||||||
|
}
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"stdin": {
|
"stdin": {
|
||||||
"src": "/home/tt/.config/joj/diff/task1/case4.in"
|
"src": "/home/tt/.config/joj/diff/task1/case4.in"
|
||||||
|
@ -429,6 +434,21 @@
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"outputs": [
|
||||||
|
{
|
||||||
|
"score": 99999,
|
||||||
|
"filename": "stdout",
|
||||||
|
"answerPath": "/home/tt/.config/joj/diff/task1/case9.out",
|
||||||
|
"compareSpace": false,
|
||||||
|
"alwaysHide": false,
|
||||||
|
"forceQuitOnDiff": false,
|
||||||
|
"maxDiffLength": 2048,
|
||||||
|
"maxDiffLines": 50,
|
||||||
|
"hideCommonPrefix": false
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"outputs": [
|
"outputs": [
|
||||||
{
|
{
|
||||||
|
@ -497,6 +517,175 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "[joj] ex2-asan base dir task2",
|
||||||
|
"groups": [
|
||||||
|
"joj"
|
||||||
|
],
|
||||||
|
"executor": {
|
||||||
|
"name": "sandbox",
|
||||||
|
"with": {
|
||||||
|
"default": {
|
||||||
|
"args": [
|
||||||
|
"./h7/build/ex2-asan",
|
||||||
|
"-a"
|
||||||
|
],
|
||||||
|
"env": [
|
||||||
|
"PATH=/usr/bin:/bin:/usr/local/bin"
|
||||||
|
],
|
||||||
|
"stdin": {
|
||||||
|
"content": ""
|
||||||
|
},
|
||||||
|
"stdout": {
|
||||||
|
"name": "stdout",
|
||||||
|
"max": 10485760,
|
||||||
|
"pipe": true
|
||||||
|
},
|
||||||
|
"stderr": {
|
||||||
|
"name": "stderr",
|
||||||
|
"max": 10485760,
|
||||||
|
"pipe": true
|
||||||
|
},
|
||||||
|
"cpuLimit": 3000000000,
|
||||||
|
"clockLimit": 6000000000,
|
||||||
|
"memoryLimit": 10485760,
|
||||||
|
"stackLimit": 0,
|
||||||
|
"procLimit": 50,
|
||||||
|
"cpuRateLimit": 0,
|
||||||
|
"cpuSetLimit": "",
|
||||||
|
"copyIn": {
|
||||||
|
"h7/build/ex2-asan": {
|
||||||
|
"src": "/home/tt/.config/joj/h7/build/ex2-asan"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"copyInCached": {},
|
||||||
|
"copyInDir": ".",
|
||||||
|
"copyOut": [
|
||||||
|
"stdout",
|
||||||
|
"stderr"
|
||||||
|
],
|
||||||
|
"copyOutCached": [],
|
||||||
|
"copyOutMax": 0,
|
||||||
|
"copyOutDir": "",
|
||||||
|
"tty": false,
|
||||||
|
"strictMemoryLimit": false,
|
||||||
|
"dataSegmentLimit": false,
|
||||||
|
"addressSpaceLimit": false
|
||||||
|
},
|
||||||
|
"cases": [
|
||||||
|
{
|
||||||
|
"stdin": {
|
||||||
|
"src": "/home/tt/.config/joj/diff/task2/case9.in"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"stdin": {
|
||||||
|
"src": "/home/tt/.config/joj/diff/task2/case6.in"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"stdin": {
|
||||||
|
"src": "/home/tt/.config/joj/diff/task2/case7.in"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"stdin": {
|
||||||
|
"src": "/home/tt/.config/joj/diff/task2/case8.in"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"parsers": [
|
||||||
|
{
|
||||||
|
"name": "diff",
|
||||||
|
"with": {
|
||||||
|
"name": "diff",
|
||||||
|
"cases": [
|
||||||
|
{
|
||||||
|
"outputs": [
|
||||||
|
{
|
||||||
|
"score": 99999,
|
||||||
|
"filename": "stdout",
|
||||||
|
"answerPath": "/home/tt/.config/joj/diff/task2/case9.out",
|
||||||
|
"compareSpace": false,
|
||||||
|
"alwaysHide": false,
|
||||||
|
"forceQuitOnDiff": false,
|
||||||
|
"maxDiffLength": 2048,
|
||||||
|
"maxDiffLines": 50,
|
||||||
|
"hideCommonPrefix": false
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"outputs": [
|
||||||
|
{
|
||||||
|
"score": 100,
|
||||||
|
"filename": "stdout",
|
||||||
|
"answerPath": "/home/tt/.config/joj/diff/task2/case6.out",
|
||||||
|
"compareSpace": false,
|
||||||
|
"alwaysHide": false,
|
||||||
|
"forceQuitOnDiff": false,
|
||||||
|
"maxDiffLength": 2048,
|
||||||
|
"maxDiffLines": 50,
|
||||||
|
"hideCommonPrefix": false
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"outputs": [
|
||||||
|
{
|
||||||
|
"score": 100,
|
||||||
|
"filename": "stdout",
|
||||||
|
"answerPath": "/home/tt/.config/joj/diff/task2/case7.out",
|
||||||
|
"compareSpace": false,
|
||||||
|
"alwaysHide": false,
|
||||||
|
"forceQuitOnDiff": false,
|
||||||
|
"maxDiffLength": 2048,
|
||||||
|
"maxDiffLines": 50,
|
||||||
|
"hideCommonPrefix": false
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"outputs": [
|
||||||
|
{
|
||||||
|
"score": 100,
|
||||||
|
"filename": "stdout",
|
||||||
|
"answerPath": "/home/tt/.config/joj/diff/task2/case8.out",
|
||||||
|
"compareSpace": false,
|
||||||
|
"alwaysHide": false,
|
||||||
|
"forceQuitOnDiff": false,
|
||||||
|
"maxDiffLength": 2048,
|
||||||
|
"maxDiffLines": 50,
|
||||||
|
"hideCommonPrefix": false
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "result-detail",
|
||||||
|
"with": {
|
||||||
|
"score": 0,
|
||||||
|
"comment": "",
|
||||||
|
"showExxecutorStatus": true,
|
||||||
|
"showExitStatus": true,
|
||||||
|
"showError": false,
|
||||||
|
"showTime": true,
|
||||||
|
"showMemory": true,
|
||||||
|
"showRuntime": true,
|
||||||
|
"showProcPeak": false,
|
||||||
|
"showFiles": [
|
||||||
|
"stderr"
|
||||||
|
],
|
||||||
|
"filesInCodeBlock": true,
|
||||||
|
"maxFileLength": 2048
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"preStages": [],
|
"preStages": [],
|
||||||
|
|
|
@ -43,7 +43,7 @@ case5.diff.score = 2590
|
||||||
|
|
||||||
|
|
||||||
[[stages]]
|
[[stages]]
|
||||||
name = "[joj] ex2-asan base dir"
|
name = "[joj] ex2-asan base dir task1"
|
||||||
command = "./h7/build/ex2-asan -a"
|
command = "./h7/build/ex2-asan -a"
|
||||||
base-case-dir = "task1"
|
base-case-dir = "task1"
|
||||||
files.import = ["h7/build/ex2-asan"]
|
files.import = ["h7/build/ex2-asan"]
|
||||||
|
@ -59,3 +59,21 @@ result-detail.stderr = true
|
||||||
diff.score = 100
|
diff.score = 100
|
||||||
|
|
||||||
case5.diff.score = 2590
|
case5.diff.score = 2590
|
||||||
|
case9.diff.score = 99999
|
||||||
|
|
||||||
|
[[stages]]
|
||||||
|
name = "[joj] ex2-asan base dir task2"
|
||||||
|
command = "./h7/build/ex2-asan -a"
|
||||||
|
base-case-dir = "task2"
|
||||||
|
files.import = ["h7/build/ex2-asan"]
|
||||||
|
limit.cpu = "3s"
|
||||||
|
limit.mem = "10m"
|
||||||
|
limit.stdout = "10m"
|
||||||
|
limit.stderr = "10m"
|
||||||
|
|
||||||
|
parsers = ["diff", "result-detail"]
|
||||||
|
result-detail.exit-status = true
|
||||||
|
result-detail.stderr = true
|
||||||
|
|
||||||
|
diff.score = 100
|
||||||
|
case9.diff.score = 99999
|
||||||
|
|
0
tests/convert/diff/task1/case9.in
Normal file
0
tests/convert/diff/task1/case9.in
Normal file
0
tests/convert/diff/task1/case9.out
Normal file
0
tests/convert/diff/task1/case9.out
Normal file
0
tests/convert/diff/task2/case9.in
Normal file
0
tests/convert/diff/task2/case9.in
Normal file
0
tests/convert/diff/task2/case9.out
Normal file
0
tests/convert/diff/task2/case9.out
Normal file
Loading…
Reference in New Issue
Block a user