dev #10
|  | @ -1,7 +1,10 @@ | |||
| from typing import List | ||||
| 
 | ||||
| from joj3_config_generator.models import joj1, repo, result, task | ||||
| from joj3_config_generator.processers.repo import get_healthcheck_config, get_teapot_config | ||||
| from joj3_config_generator.processers.repo import ( | ||||
|     get_healthcheck_config, | ||||
|     get_teapot_config, | ||||
| ) | ||||
| from joj3_config_generator.processers.task import ( | ||||
|     fix_diff, | ||||
|     fix_dummy, | ||||
|  | @ -14,10 +17,10 @@ from joj3_config_generator.processers.task import ( | |||
| 
 | ||||
| def convert(repo_conf: repo.Config, task_conf: task.Config) -> result.Config: | ||||
|     # Create the base ResultConf object | ||||
|     result_conf = ResultConfig( | ||||
|         name=task_conf.task, | ||||
|     result_conf = result.Config( | ||||
|         name=task_conf.task.name, | ||||
|         # TODO: specify the exact folder difference | ||||
|         log_path=f"{task_conf.task.replace(' ', '-')}.log", | ||||
|         log_path=f"/home/tt/.cache/joj3/{task_conf.task.type_}.log", | ||||
|         expire_unix_timestamp=( | ||||
|             int(task_conf.release.deadline.timestamp()) | ||||
|             if task_conf.release.deadline | ||||
|  | @ -38,7 +41,7 @@ def convert(repo_conf: repo.Config, task_conf: task.Config) -> result.Config: | |||
|         conf_stage = fix_result_detail(task_stage, conf_stage) | ||||
|         conf_stage = fix_dummy(task_stage, conf_stage) | ||||
|         conf_stage = fix_keyword(task_stage, conf_stage) | ||||
|         conf_stage = fix_diff(task_stage, conf_stage) | ||||
|         conf_stage = fix_diff(task_stage, conf_stage, task_conf) | ||||
|         result_conf.stage.stages.append(conf_stage) | ||||
| 
 | ||||
|     return result_conf | ||||
|  | @ -76,7 +79,14 @@ def convert_joj1(joj1_conf: joj1.Config) -> task.Config: | |||
|     ) | ||||
| 
 | ||||
|     return task.Config( | ||||
|         task=joj1_conf.languages[0].language if joj1_conf.languages else "Unnamed Task", | ||||
|         task=task.Task( | ||||
|             name=( | ||||
|                 joj1_conf.languages[0].language | ||||
|                 if joj1_conf.languages | ||||
|                 else "Unnamed Task" | ||||
|             ), | ||||
|             type_="", | ||||
|         ),  # FIXME: fix this type later | ||||
|         release=task.Release(deadline=release_deadline), | ||||
|         stages=stages, | ||||
|     ) | ||||
|  |  | |||
|  | @ -83,7 +83,14 @@ class Release(BaseModel): | |||
|     deadline: Optional[datetime]  # RFC 3339 formatted date-time with offset | ||||
| 
 | ||||
| 
 | ||||
| 
					
					jon-lee marked this conversation as resolved
					
						
						
							Outdated
						
					
				 | ||||
| class Task(BaseModel): | ||||
|     type_: Optional[str] = Field( | ||||
| 
					
					jon-lee marked this conversation as resolved
					
						
						
							Outdated
						
					
				 
				
					
						李衍志523370910113
						commented  this should be the  this should be the `StrEnum` 
				
					
						张泊明518370910136
						commented  yes yes 
				
					
						李衍志523370910113
						commented  It is supported now. It is supported now. | ||||
|         "", serialization_alias="type", validation_alias="type" | ||||
|     ) | ||||
|     name: str | ||||
| 
 | ||||
| 
 | ||||
| class Config(BaseModel): | ||||
|     task: str  # Task name (e.g., hw3 ex5) | ||||
|     task: Task | ||||
|     release: Release  # Release configuration | ||||
|     stages: List[Stage]  # list of stage configurations | ||||
|  |  | |||
|  | @ -1,6 +1,5 @@ | |||
| import hashlib | ||||
| import shlex | ||||
| import socket | ||||
| from pathlib import Path | ||||
| 
 | ||||
| from joj3_config_generator.models import repo, result, task | ||||
|  | @ -16,9 +15,18 @@ def get_grading_repo_name() -> str: | |||
| def get_teapot_config(repo_conf: repo.Config, task_conf: task.Config) -> result.Teapot: | ||||
|     teapot = result.Teapot( | ||||
|         # TODO: fix the log path | ||||
|         log_path=f"{task_conf.task.replace(' ', '-')}-joint-teapot-debug.log", | ||||
|         scoreboard_path=f"{task_conf.task.replace(' ', '-')}-scoreboard.csv", | ||||
|         failed_table_path=f"{task_conf.task.replace(' ', '-')}-failed-table.md", | ||||
|         log_path=f"/home/tt/.cache/joj3/{task_conf.task.type_}-joint-teapot-debug.log", | ||||
|         # FIXME: may need to fix the path below | ||||
|         scoreboard_path=( | ||||
|             f"{task_conf.task.type_.split("/")[0]}/{task_conf.task.type_.split("/")[1]}-scoreboard.csv" | ||||
|             if task_conf.task.type_ is not None | ||||
|             else "scoreboard.csv" | ||||
|         ), | ||||
|         failed_table_path=( | ||||
|             f"{task_conf.task.type_.split("/")[0]}/{task_conf.task.type_.split("/")[1]}-failed-table.md" | ||||
|             if task_conf.task.type_ is not None | ||||
|             else "failed-table.md" | ||||
|         ), | ||||
|         grading_repo_name=get_grading_repo_name(), | ||||
|     ) | ||||
|     return teapot | ||||
|  | @ -53,9 +61,11 @@ def get_healthcheck_cmd(repo_conf: repo.Config) -> result.Cmd: | |||
| 
 | ||||
|     cmd = result.Cmd( | ||||
|         args=shlex.split(args), | ||||
|         # FIXME: easier to edit within global scope | ||||
|         copy_in={ | ||||
|             f"./repo-health-checker": result.CmdFile(src=f"./repo-health-checker") | ||||
|             # This path is hardcoded | ||||
|             f"./repo-health-checker": result.CmdFile( | ||||
|                 src="/usr/local/bin/repo-health-checker" | ||||
|             ) | ||||
|         }, | ||||
|     ) | ||||
|     return cmd | ||||
|  |  | |||
|  | @ -197,7 +197,7 @@ def fix_dummy( | |||
| 
 | ||||
| 
 | ||||
| def fix_diff( | ||||
|     task_stage: task.Stage, conf_stage: result.StageDetail | ||||
|     task_stage: task.Stage, conf_stage: result.StageDetail, task_conf: task.Config | ||||
| ) -> result.StageDetail: | ||||
|     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) | ||||
|  | @ -233,7 +233,7 @@ def fix_diff( | |||
|             stage_cases.append( | ||||
|                 result.OptionalCmd( | ||||
|                     stdin=result.CmdFile( | ||||
|                         src=f"/home/tt/.config/joj/{conf_stage.name}/{case}.in" | ||||
|                         src=f"/home/tt/.config/joj/{task_conf.task.type_}/{case}.in" | ||||
|                     ), | ||||
|                     cpu_limit=cpu_limit, | ||||
|                     clock_limit=clock_limit, | ||||
|  | @ -255,7 +255,7 @@ def fix_diff( | |||
|                             { | ||||
|                                 "score": diff_output.score, | ||||
|                                 "fileName": "stdout", | ||||
|                                 "answerPath": f"/home/tt/.config/joj/{conf_stage.name}/{case}.out", | ||||
|                                 "answerPath": f"/home/tt/.config/joj/{task_conf.task.type_}/{case}.out", | ||||
|                                 "forceQuitOnDiff": diff_output.forcequit, | ||||
|                                 "alwaysHide": diff_output.hide, | ||||
|                                 "compareSpace": not diff_output.ignorespaces, | ||||
|  |  | |||
|  | @ -6,5 +6,5 @@ sandbox_token = "test" | |||
| [files] | ||||
| whitelist_patterns = ["*.py", "*.txt", "*.md"] | ||||
| whitelist_file = ".whitelist" | ||||
| required = [ "Changelog.md", "Readme.md" ] | ||||
| required = ["Readme.md" ] | ||||
| immutable = [".gitignore", ".gitattributes", ".gitea/workflows/push.yaml", ".gitea/workflows/release.yaml" ] | ||||
|  |  | |||
|  | @ -1,7 +1,7 @@ | |||
| { | ||||
|     "name": "p2 m3", | ||||
|     "logPath": "p2-m3.log", | ||||
|     "expireUnixTimestamp": 1728748740, | ||||
|     "name": "hw 6 ex3", | ||||
|     "logPath": "/home/tt/.cache/joj3/tests/homework/h6/e3.log", | ||||
|     "expireUnixTimestamp": 1731686399, | ||||
|     "stage": { | ||||
|         "sandboxExecServer": "172.17.0.1:5051", | ||||
|         "sandboxToken": "test", | ||||
|  | @ -18,7 +18,6 @@ | |||
|                                 "./repo-health-checker", | ||||
|                                 "-root=.", | ||||
|                                 "-repoSize=50.5", | ||||
|                                 "-meta=Changelog.md", | ||||
|                                 "-meta=Readme.md", | ||||
|                                 "-checkFileSumList=a5b63323a692d3d8b952442969649b4f823d58dae26429494f613df160710dfc,b1bbad25b830db0a77b15a033f9ca1b7ab44c1d2d05056412bd3e4421645f0bf,1965adff52af61da8b9e089ff580d60f7e4c294a2930b9809c5cbdf76528de4d,c8bd62bf5297bac738b3845612fd595d677884093070904375463ab7953fce28", | ||||
|                                 "-checkFileNameList=.gitignore,.gitattributes,.gitea/workflows/push.yaml,.gitea/workflows/release.yaml" | ||||
|  | @ -57,7 +56,7 @@ | |||
|                             "cpuSetLimit": "", | ||||
|                             "copyIn": { | ||||
|                                 "./repo-health-checker": { | ||||
|                                     "src": "./repo-health-checker", | ||||
|                                     "src": "/usr/local/bin/repo-health-checker", | ||||
|                                     "max": 4194304, | ||||
|                                     "streamIn": false, | ||||
|                                     "streamOut": false, | ||||
|  | @ -88,84 +87,6 @@ | |||
|                     } | ||||
|                 ] | ||||
|             }, | ||||
|             { | ||||
|                 "name": "Abuse of strings detected", | ||||
|                 "executor": { | ||||
|                     "name": "sandbox", | ||||
|                     "with": { | ||||
|                         "default": { | ||||
|                             "args": [ | ||||
|                                 "./strdetect", | ||||
|                                 "src/" | ||||
|                             ], | ||||
|                             "env": [ | ||||
|                                 "PATH=/usr/bin:/bin:/usr/local/bin" | ||||
|                             ], | ||||
|                             "stdin": { | ||||
|                                 "content": "", | ||||
|                                 "max": 4194304, | ||||
|                                 "streamIn": false, | ||||
|                                 "streamOut": false, | ||||
|                                 "pipe": false | ||||
|                             }, | ||||
|                             "stdout": { | ||||
|                                 "name": "stdout", | ||||
|                                 "max": 4000000000, | ||||
|                                 "streamIn": false, | ||||
|                                 "streamOut": false, | ||||
|                                 "pipe": false | ||||
|                             }, | ||||
|                             "stderr": { | ||||
|                                 "name": "stderr", | ||||
|                                 "max": 4000000000, | ||||
|                                 "streamIn": false, | ||||
|                                 "streamOut": false, | ||||
|                                 "pipe": false | ||||
|                             }, | ||||
|                             "cpuLimit": 4000000000, | ||||
|                             "realCpuLimit": 0, | ||||
|                             "clockLimit": 8000000000, | ||||
|                             "memoryLimit": 4194304, | ||||
|                             "stackLimit": 0, | ||||
|                             "procLimit": 50, | ||||
|                             "cpuRateLimit": 0, | ||||
|                             "cpuSetLimit": "", | ||||
|                             "copyIn": { | ||||
|                                 "tools/strdetec": { | ||||
|                                     "src": "/home/tt/.config/joj/tools/strdetec", | ||||
|                                     "max": 4194304, | ||||
|                                     "streamIn": false, | ||||
|                                     "streamOut": false, | ||||
|                                     "pipe": false | ||||
|                                 } | ||||
|                             }, | ||||
|                             "copyInCached": { | ||||
|                                 "tools/strdetec": "tools/strdetec" | ||||
|                             }, | ||||
|                             "copyInDir": ".", | ||||
|                             "copyOut": [], | ||||
|                             "copyOutCached": [], | ||||
|                             "copyOutMax": 0, | ||||
|                             "copyOutDir": "", | ||||
|                             "tty": false, | ||||
|                             "strictMemoryLimit": false, | ||||
|                             "dataSegmentLimit": false, | ||||
|                             "addressSpaceLimit": false | ||||
|                         }, | ||||
|                         "cases": [] | ||||
|                     } | ||||
|                 }, | ||||
|                 "parsers": [ | ||||
|                     { | ||||
|                         "name": "result-status", | ||||
|                         "with": { | ||||
|                             "score": 0, | ||||
|                             "comment": "", | ||||
|                             "forceQuitOnNotAccepted": true | ||||
|                         } | ||||
|                     } | ||||
|                 ] | ||||
|             }, | ||||
|             { | ||||
|                 "name": "Compilation", | ||||
|                 "executor": { | ||||
|  | @ -173,7 +94,7 @@ | |||
|                     "with": { | ||||
|                         "default": { | ||||
|                             "args": [ | ||||
|                                 "compile" | ||||
|                                 "./tools/compile" | ||||
|                             ], | ||||
|                             "env": [ | ||||
|                                 "PATH=/usr/bin:/bin:/usr/local/bin" | ||||
|  | @ -222,7 +143,7 @@ | |||
|                             "copyInDir": ".", | ||||
|                             "copyOut": [], | ||||
|                             "copyOutCached": [ | ||||
|                                 "build/onecard", | ||||
|                                 "h6/build/ex3", | ||||
|                                 "build/asan", | ||||
|                                 "build/ubsan", | ||||
|                                 "build/msan", | ||||
|  | @ -255,7 +176,7 @@ | |||
|                     { | ||||
|                         "name": "dummy", | ||||
|                         "with": { | ||||
|                             "score": 1, | ||||
|                             "score": 0, | ||||
|                             "comment": "Congratulations! Your code compiled successfully.", | ||||
|                             "forceQuitOnNotAccepted": true | ||||
|                         } | ||||
|  | @ -263,7 +184,7 @@ | |||
|                     { | ||||
|                         "name": "result-status", | ||||
|                         "with": { | ||||
|                             "score": 1, | ||||
|                             "score": 0, | ||||
|                             "comment": "Congratulations! Your code compiled successfully.", | ||||
|                             "forceQuitOnNotAccepted": true | ||||
|                         } | ||||
|  | @ -744,87 +665,6 @@ | |||
|                     } | ||||
|                 ] | ||||
|             }, | ||||
|             { | ||||
|                 "name": "[run] onecard", | ||||
|                 "executor": { | ||||
|                     "name": "sandbox", | ||||
|                     "with": { | ||||
|                         "default": { | ||||
|                             "args": [ | ||||
|                                 "./onecard", | ||||
|                                 "-a" | ||||
|                             ], | ||||
|                             "env": [ | ||||
|                                 "PATH=/usr/bin:/bin:/usr/local/bin" | ||||
|                             ], | ||||
|                             "stdin": { | ||||
|                                 "content": "", | ||||
|                                 "max": 4194304, | ||||
|                                 "streamIn": false, | ||||
|                                 "streamOut": false, | ||||
|                                 "pipe": false | ||||
|                             }, | ||||
|                             "stdout": { | ||||
|                                 "name": "stdout", | ||||
|                                 "max": 4000000000, | ||||
|                                 "streamIn": false, | ||||
|                                 "streamOut": false, | ||||
|                                 "pipe": false | ||||
|                             }, | ||||
|                             "stderr": { | ||||
|                                 "name": "stderr", | ||||
|                                 "max": 4000000000, | ||||
|                                 "streamIn": false, | ||||
|                                 "streamOut": false, | ||||
|                                 "pipe": false | ||||
|                             }, | ||||
|                             "cpuLimit": 4000000000, | ||||
|                             "realCpuLimit": 0, | ||||
|                             "clockLimit": 8000000000, | ||||
|                             "memoryLimit": 4194304, | ||||
|                             "stackLimit": 0, | ||||
|                             "procLimit": 50, | ||||
|                             "cpuRateLimit": 0, | ||||
|                             "cpuSetLimit": "", | ||||
|                             "copyIn": {}, | ||||
|                             "copyInCached": {}, | ||||
|                             "copyInDir": ".", | ||||
|                             "copyOut": [], | ||||
|                             "copyOutCached": [], | ||||
|                             "copyOutMax": 0, | ||||
|                             "copyOutDir": "", | ||||
|                             "tty": false, | ||||
|                             "strictMemoryLimit": false, | ||||
|                             "dataSegmentLimit": false, | ||||
|                             "addressSpaceLimit": false | ||||
|                         }, | ||||
|                         "cases": [] | ||||
|                     } | ||||
|                 }, | ||||
|                 "parsers": [ | ||||
|                     { | ||||
|                         "name": "result-status", | ||||
|                         "with": { | ||||
|                             "score": 1, | ||||
|                             "comment": "", | ||||
|                             "forceQuitOnNotAccepted": false | ||||
|                         } | ||||
|                     }, | ||||
|                     { | ||||
|                         "name": "result-detail", | ||||
|                         "with": { | ||||
|                             "score": 0, | ||||
|                             "comment": "", | ||||
|                             "showFiles": [ | ||||
|                                 "stderr" | ||||
|                             ], | ||||
|                             "showExitStatus": true, | ||||
|                             "showRuntime": true, | ||||
|                             "showMemory": true | ||||
|                         } | ||||
|                     } | ||||
|                 ] | ||||
|             }, | ||||
|             { | ||||
|                 "name": "[run] address sanitizer", | ||||
|                 "executor": { | ||||
|  | @ -1067,13 +907,424 @@ | |||
|                         } | ||||
|                     } | ||||
|                 ] | ||||
|             }, | ||||
|             { | ||||
|                 "name": "[joj] ex3", | ||||
|                 "executor": { | ||||
|                     "name": "sandbox", | ||||
|                     "with": { | ||||
|                         "default": { | ||||
|                             "args": [ | ||||
|                                 "./ex3" | ||||
|                             ], | ||||
|                             "env": [ | ||||
|                                 "PATH=/usr/bin:/bin:/usr/local/bin" | ||||
|                             ], | ||||
|                             "stdin": { | ||||
|                                 "content": "", | ||||
|                                 "max": 4194304, | ||||
|                                 "streamIn": false, | ||||
|                                 "streamOut": false, | ||||
|                                 "pipe": false | ||||
|                             }, | ||||
|                             "stdout": { | ||||
|                                 "name": "stdout", | ||||
|                                 "max": 4000000000, | ||||
|                                 "streamIn": false, | ||||
|                                 "streamOut": false, | ||||
|                                 "pipe": false | ||||
|                             }, | ||||
|                             "stderr": { | ||||
|                                 "name": "stderr", | ||||
|                                 "max": 4000000000, | ||||
|                                 "streamIn": false, | ||||
|                                 "streamOut": false, | ||||
|                                 "pipe": false | ||||
|                             }, | ||||
|                             "cpuLimit": 4000000000, | ||||
|                             "realCpuLimit": 0, | ||||
|                             "clockLimit": 8000000000, | ||||
|                             "memoryLimit": 4194304, | ||||
|                             "stackLimit": 0, | ||||
|                             "procLimit": 50, | ||||
|                             "cpuRateLimit": 0, | ||||
|                             "cpuSetLimit": "", | ||||
|                             "copyIn": { | ||||
|                                 "h6/build/ex2": { | ||||
|                                     "src": "/home/tt/.config/joj/h6/build/ex2", | ||||
|                                     "max": 4194304, | ||||
|                                     "streamIn": false, | ||||
|                                     "streamOut": false, | ||||
|                                     "pipe": false | ||||
|                                 }, | ||||
|                                 "h6/build/ex4": { | ||||
|                                     "src": "/home/tt/.config/joj/h6/build/ex4", | ||||
|                                     "max": 4194304, | ||||
|                                     "streamIn": false, | ||||
|                                     "streamOut": false, | ||||
|                                     "pipe": false | ||||
|                                 }, | ||||
|                                 "h6/build/ex5": { | ||||
|                                     "src": "/home/tt/.config/joj/h6/build/ex5", | ||||
|                                     "max": 4194304, | ||||
|                                     "streamIn": false, | ||||
|                                     "streamOut": false, | ||||
|                                     "pipe": false | ||||
|                                 }, | ||||
|                                 "h6/build/ex6": { | ||||
|                                     "src": "/home/tt/.config/joj/h6/build/ex6", | ||||
|                                     "max": 4194304, | ||||
|                                     "streamIn": false, | ||||
|                                     "streamOut": false, | ||||
|                                     "pipe": false | ||||
|                                 }, | ||||
|                                 "h6/build/ex7": { | ||||
|                                     "src": "/home/tt/.config/joj/h6/build/ex7", | ||||
|                                     "max": 4194304, | ||||
|                                     "streamIn": false, | ||||
|                                     "streamOut": false, | ||||
|                                     "pipe": false | ||||
|                                 } | ||||
|                             }, | ||||
|                             "copyInCached": { | ||||
|                                 "h6/build/ex2": "h6/build/ex2", | ||||
|                                 "h6/build/ex4": "h6/build/ex4", | ||||
|                                 "h6/build/ex5": "h6/build/ex5", | ||||
|                                 "h6/build/ex6": "h6/build/ex6", | ||||
|                                 "h6/build/ex7": "h6/build/ex7" | ||||
|                             }, | ||||
|                             "copyInDir": ".", | ||||
|                             "copyOut": [], | ||||
|                             "copyOutCached": [], | ||||
|                             "copyOutMax": 0, | ||||
|                             "copyOutDir": "", | ||||
|                             "tty": false, | ||||
|                             "strictMemoryLimit": false, | ||||
|                             "dataSegmentLimit": false, | ||||
|                             "addressSpaceLimit": false | ||||
|                         }, | ||||
|                         "cases": [ | ||||
|                             { | ||||
|                                 "env": [ | ||||
|                                     "PATH=/usr/bin:/bin:/usr/local/bin" | ||||
|                                 ], | ||||
|                                 "stdin": { | ||||
|                                     "src": "/home/tt/.config/joj/tests/homework/h6/e3/case0.in", | ||||
|                                     "max": 4194304, | ||||
|                                     "streamIn": false, | ||||
|                                     "streamOut": false, | ||||
|                                     "pipe": false | ||||
|                                 }, | ||||
|                                 "cpuLimit": 30000000000, | ||||
|                                 "clockLimit": 60000000000, | ||||
|                                 "memoryLimit": 33554432, | ||||
|                                 "procLimit": 50 | ||||
|                             }, | ||||
|                             { | ||||
|                                 "env": [ | ||||
|                                     "PATH=/usr/bin:/bin:/usr/local/bin" | ||||
|                                 ], | ||||
|                                 "stdin": { | ||||
|                                     "src": "/home/tt/.config/joj/tests/homework/h6/e3/case1.in", | ||||
|                                     "max": 4194304, | ||||
|                                     "streamIn": false, | ||||
|                                     "streamOut": false, | ||||
|                                     "pipe": false | ||||
|                                 }, | ||||
|                                 "cpuLimit": 30000000000, | ||||
|                                 "clockLimit": 60000000000, | ||||
|                                 "memoryLimit": 33554432, | ||||
|                                 "procLimit": 50 | ||||
|                             }, | ||||
|                             { | ||||
|                                 "env": [ | ||||
|                                     "PATH=/usr/bin:/bin:/usr/local/bin" | ||||
|                                 ], | ||||
|                                 "stdin": { | ||||
|                                     "src": "/home/tt/.config/joj/tests/homework/h6/e3/case2.in", | ||||
|                                     "max": 4194304, | ||||
|                                     "streamIn": false, | ||||
|                                     "streamOut": false, | ||||
|                                     "pipe": false | ||||
|                                 }, | ||||
|                                 "cpuLimit": 30000000000, | ||||
|                                 "clockLimit": 60000000000, | ||||
|                                 "memoryLimit": 33554432, | ||||
|                                 "procLimit": 50 | ||||
|                             }, | ||||
|                             { | ||||
|                                 "env": [ | ||||
|                                     "PATH=/usr/bin:/bin:/usr/local/bin" | ||||
|                                 ], | ||||
|                                 "stdin": { | ||||
|                                     "src": "/home/tt/.config/joj/tests/homework/h6/e3/case3.in", | ||||
|                                     "max": 4194304, | ||||
|                                     "streamIn": false, | ||||
|                                     "streamOut": false, | ||||
|                                     "pipe": false | ||||
|                                 }, | ||||
|                                 "cpuLimit": 30000000000, | ||||
|                                 "clockLimit": 60000000000, | ||||
|                                 "memoryLimit": 33554432, | ||||
|                                 "procLimit": 50 | ||||
|                             }, | ||||
|                             { | ||||
|                                 "env": [ | ||||
|                                     "PATH=/usr/bin:/bin:/usr/local/bin" | ||||
|                                 ], | ||||
|                                 "stdin": { | ||||
|                                     "src": "/home/tt/.config/joj/tests/homework/h6/e3/case4.in", | ||||
|                                     "max": 4194304, | ||||
|                                     "streamIn": false, | ||||
|                                     "streamOut": false, | ||||
|                                     "pipe": false | ||||
|                                 }, | ||||
|                                 "cpuLimit": 30000000000, | ||||
|                                 "clockLimit": 60000000000, | ||||
|                                 "memoryLimit": 33554432, | ||||
|                                 "procLimit": 50 | ||||
|                             }, | ||||
|                             { | ||||
|                                 "env": [ | ||||
|                                     "PATH=/usr/bin:/bin:/usr/local/bin" | ||||
|                                 ], | ||||
|                                 "stdin": { | ||||
|                                     "src": "/home/tt/.config/joj/tests/homework/h6/e3/case5.in", | ||||
|                                     "max": 4194304, | ||||
|                                     "streamIn": false, | ||||
|                                     "streamOut": false, | ||||
|                                     "pipe": false | ||||
|                                 }, | ||||
|                                 "cpuLimit": 30000000000, | ||||
|                                 "clockLimit": 60000000000, | ||||
|                                 "memoryLimit": 33554432, | ||||
|                                 "procLimit": 50 | ||||
|                             }, | ||||
|                             { | ||||
|                                 "env": [ | ||||
|                                     "PATH=/usr/bin:/bin:/usr/local/bin" | ||||
|                                 ], | ||||
|                                 "stdin": { | ||||
|                                     "src": "/home/tt/.config/joj/tests/homework/h6/e3/case6.in", | ||||
|                                     "max": 4194304, | ||||
|                                     "streamIn": false, | ||||
|                                     "streamOut": false, | ||||
|                                     "pipe": false | ||||
|                                 }, | ||||
|                                 "cpuLimit": 30000000000, | ||||
|                                 "clockLimit": 60000000000, | ||||
|                                 "memoryLimit": 33554432, | ||||
|                                 "procLimit": 50 | ||||
|                             }, | ||||
|                             { | ||||
|                                 "env": [ | ||||
|                                     "PATH=/usr/bin:/bin:/usr/local/bin" | ||||
|                                 ], | ||||
|                                 "stdin": { | ||||
|                                     "src": "/home/tt/.config/joj/tests/homework/h6/e3/case7.in", | ||||
|                                     "max": 4194304, | ||||
|                                     "streamIn": false, | ||||
|                                     "streamOut": false, | ||||
|                                     "pipe": false | ||||
|                                 }, | ||||
|                                 "cpuLimit": 30000000000, | ||||
|                                 "clockLimit": 60000000000, | ||||
|                                 "memoryLimit": 33554432, | ||||
|                                 "procLimit": 50 | ||||
|                             }, | ||||
|                             { | ||||
|                                 "env": [ | ||||
|                                     "PATH=/usr/bin:/bin:/usr/local/bin" | ||||
|                                 ], | ||||
|                                 "stdin": { | ||||
|                                     "src": "/home/tt/.config/joj/tests/homework/h6/e3/case8.in", | ||||
|                                     "max": 4194304, | ||||
|                                     "streamIn": false, | ||||
|                                     "streamOut": false, | ||||
|                                     "pipe": false | ||||
|                                 }, | ||||
|                                 "cpuLimit": 30000000000, | ||||
|                                 "clockLimit": 60000000000, | ||||
|                                 "memoryLimit": 33554432, | ||||
|                                 "procLimit": 50 | ||||
|                             }, | ||||
|                             { | ||||
|                                 "env": [ | ||||
|                                     "PATH=/usr/bin:/bin:/usr/local/bin" | ||||
|                                 ], | ||||
|                                 "stdin": { | ||||
|                                     "src": "/home/tt/.config/joj/tests/homework/h6/e3/case9.in", | ||||
|                                     "max": 4194304, | ||||
|                                     "streamIn": false, | ||||
|                                     "streamOut": false, | ||||
|                                     "pipe": false | ||||
|                                 }, | ||||
|                                 "cpuLimit": 30000000000, | ||||
|                                 "clockLimit": 60000000000, | ||||
|                                 "memoryLimit": 33554432, | ||||
|                                 "procLimit": 50 | ||||
|                             } | ||||
|                         ] | ||||
|                     } | ||||
|                 }, | ||||
|                 "parsers": [ | ||||
|                     { | ||||
|                         "name": "diff", | ||||
|                         "with": { | ||||
|                             "name": "diff", | ||||
|                             "cases": [ | ||||
|                                 { | ||||
|                                     "outputs": [ | ||||
|                                         { | ||||
|                                             "score": 0, | ||||
|                                             "fileName": "stdout", | ||||
|                                             "answerPath": "/home/tt/.config/joj/tests/homework/h6/e3/case0.out", | ||||
|                                             "forceQuitOnDiff": true, | ||||
|                                             "alwaysHide": false, | ||||
|                                             "compareSpace": true | ||||
|                                         } | ||||
|                                     ] | ||||
|                                 }, | ||||
|                                 { | ||||
|                                     "outputs": [ | ||||
|                                         { | ||||
|                                             "score": 0, | ||||
|                                             "fileName": "stdout", | ||||
|                                             "answerPath": "/home/tt/.config/joj/tests/homework/h6/e3/case1.out", | ||||
|                                             "forceQuitOnDiff": true, | ||||
|                                             "alwaysHide": false, | ||||
|                                             "compareSpace": true | ||||
|                                         } | ||||
|                                     ] | ||||
|                                 }, | ||||
|                                 { | ||||
|                                     "outputs": [ | ||||
|                                         { | ||||
|                                             "score": 0, | ||||
|                                             "fileName": "stdout", | ||||
|                                             "answerPath": "/home/tt/.config/joj/tests/homework/h6/e3/case2.out", | ||||
|                                             "forceQuitOnDiff": true, | ||||
|                                             "alwaysHide": false, | ||||
|                                             "compareSpace": true | ||||
|                                         } | ||||
|                                     ] | ||||
|                                 }, | ||||
|                                 { | ||||
|                                     "outputs": [ | ||||
|                                         { | ||||
|                                             "score": 0, | ||||
|                                             "fileName": "stdout", | ||||
|                                             "answerPath": "/home/tt/.config/joj/tests/homework/h6/e3/case3.out", | ||||
|                                             "forceQuitOnDiff": true, | ||||
|                                             "alwaysHide": false, | ||||
|                                             "compareSpace": true | ||||
|                                         } | ||||
|                                     ] | ||||
|                                 }, | ||||
|                                 { | ||||
|                                     "outputs": [ | ||||
|                                         { | ||||
|                                             "score": 0, | ||||
|                                             "fileName": "stdout", | ||||
|                                             "answerPath": "/home/tt/.config/joj/tests/homework/h6/e3/case4.out", | ||||
|                                             "forceQuitOnDiff": true, | ||||
|                                             "alwaysHide": false, | ||||
|                                             "compareSpace": true | ||||
|                                         } | ||||
|                                     ] | ||||
|                                 }, | ||||
|                                 { | ||||
|                                     "outputs": [ | ||||
|                                         { | ||||
|                                             "score": 0, | ||||
|                                             "fileName": "stdout", | ||||
|                                             "answerPath": "/home/tt/.config/joj/tests/homework/h6/e3/case5.out", | ||||
|                                             "forceQuitOnDiff": true, | ||||
|                                             "alwaysHide": false, | ||||
|                                             "compareSpace": true | ||||
|                                         } | ||||
|                                     ] | ||||
|                                 }, | ||||
|                                 { | ||||
|                                     "outputs": [ | ||||
|                                         { | ||||
|                                             "score": 0, | ||||
|                                             "fileName": "stdout", | ||||
|                                             "answerPath": "/home/tt/.config/joj/tests/homework/h6/e3/case6.out", | ||||
|                                             "forceQuitOnDiff": true, | ||||
|                                             "alwaysHide": false, | ||||
|                                             "compareSpace": true | ||||
|                                         } | ||||
|                                     ] | ||||
|                                 }, | ||||
|                                 { | ||||
|                                     "outputs": [ | ||||
|                                         { | ||||
|                                             "score": 0, | ||||
|                                             "fileName": "stdout", | ||||
|                                             "answerPath": "/home/tt/.config/joj/tests/homework/h6/e3/case7.out", | ||||
|                                             "forceQuitOnDiff": true, | ||||
|                                             "alwaysHide": false, | ||||
|                                             "compareSpace": true | ||||
|                                         } | ||||
|                                     ] | ||||
|                                 }, | ||||
|                                 { | ||||
|                                     "outputs": [ | ||||
|                                         { | ||||
|                                             "score": 0, | ||||
|                                             "fileName": "stdout", | ||||
|                                             "answerPath": "/home/tt/.config/joj/tests/homework/h6/e3/case8.out", | ||||
|                                             "forceQuitOnDiff": true, | ||||
|                                             "alwaysHide": false, | ||||
|                                             "compareSpace": true | ||||
|                                         } | ||||
|                                     ] | ||||
|                                 }, | ||||
|                                 { | ||||
|                                     "outputs": [ | ||||
|                                         { | ||||
|                                             "score": 0, | ||||
|                                             "fileName": "stdout", | ||||
|                                             "answerPath": "/home/tt/.config/joj/tests/homework/h6/e3/case9.out", | ||||
|                                             "forceQuitOnDiff": true, | ||||
|                                             "alwaysHide": false, | ||||
|                                             "compareSpace": true | ||||
|                                         } | ||||
|                                     ] | ||||
|                                 } | ||||
|                             ] | ||||
|                         } | ||||
|                     }, | ||||
|                     { | ||||
|                         "name": "dummy", | ||||
|                         "with": { | ||||
|                             "score": 0, | ||||
|                             "comment": "", | ||||
|                             "forceQuitOnNotAccepted": true | ||||
|                         } | ||||
|                     }, | ||||
|                     { | ||||
|                         "name": "result-detail", | ||||
|                         "with": { | ||||
|                             "score": 0, | ||||
|                             "comment": "", | ||||
|                             "showFiles": [ | ||||
|                                 "stderr" | ||||
|                             ], | ||||
|                             "showExitStatus": true, | ||||
|                             "showRuntime": true, | ||||
|                             "showMemory": true | ||||
|                         } | ||||
|                     } | ||||
|                 ] | ||||
|             } | ||||
|         ] | ||||
|     }, | ||||
|     "teapot": { | ||||
|         "logPath": "p2-m3-joint-teapot-debug.log", | ||||
|         "scoreboardPath": "p2-m3-scoreboard.csv", | ||||
|         "failedTablePath": "p2-m3-failed-table.md", | ||||
|         "logPath": "/home/tt/.cache/joj3/tests/homework/h6/e3-joint-teapot-debug.log", | ||||
|         "scoreboardPath": "tests/homework-scoreboard.csv", | ||||
|         "failedTablePath": "tests/homework-failed-table.md", | ||||
|         "gradingRepoName": "engr151-joj", | ||||
|         "skipIssue": false, | ||||
|         "skipScoreboard": false, | ||||
|  |  | |||
|  | @ -1,31 +1,20 @@ | |||
| # p2 repo config | ||||
| # general task configuration | ||||
| task.name = "hw 6 ex3" # task name | ||||
| 
 | ||||
| task="p2 m3" # task name | ||||
| task.type = "tests/homework/h6/e3" | ||||
| 
 | ||||
| release.deadline = 2024-10-12 23:59:00+08:00 | ||||
| release.deadline = 2024-11-15 23:59:59+08:00 | ||||
| release.stages = [ "compile" ] | ||||
| 
 | ||||
| [files] | ||||
| immutable = [".gitignore", ".gitattributes", ".gitea/workflows/push.yaml", ".gitea/workflows/release.yaml" ] | ||||
| required = [ "Changelog.md", "Readme.md" ] | ||||
| 
 | ||||
| [[stages]] | ||||
| name = "Abuse of strings detected" | ||||
| command = "./strdetect src/" | ||||
| files.import = [ "tools/strdetec" ] | ||||
| 
 | ||||
| parsers = [ "result-status" ] | ||||
| 
 | ||||
| 
 | ||||
| [[stages]] | ||||
| name = "Compilation" | ||||
| command = "compile" | ||||
| command = "./tools/compile" # eg. script running cmake commands | ||||
| files.import = [ "tools/compile" ] | ||||
| files.export = [ "build/onecard", "build/asan", "build/ubsan", "build/msan", "build/compile_commands.json" ] | ||||
| files.export = [ "h6/build/ex3", "build/asan", "build/ubsan", "build/msan", "build/compile_commands.json" ] | ||||
| 
 | ||||
| # compile parsers | ||||
| parsers = [ "result-detail", "dummy", "result-status" ] | ||||
| result-status.comment = "Congratulations! Your code compiled successfully." | ||||
| result-status.score = 1 | ||||
| dummy.comment = "\n\n### Details\n" | ||||
| result-detail.exitstatus = true | ||||
| result-detail.stderr = true | ||||
|  | @ -89,17 +78,6 @@ result-detail.stderr = true | |||
| result-detail.time = false | ||||
| result-detail.mem = false | ||||
| 
 | ||||
| [[stages]] | ||||
| name = "[run] onecard" | ||||
| group = "run" | ||||
| command="./onecard -a" | ||||
| files.import = [ "build/onecard" ] | ||||
| 
 | ||||
| parsers = [ "result-status", "result-detail" ] | ||||
| result-status.score = 1 | ||||
| result-status.forcequit = false | ||||
| result-detail.exitstatus = true | ||||
| result-detail.stderr = true | ||||
| 
 | ||||
| [[stages]] | ||||
| name = "[run] address sanitizer" | ||||
|  | @ -135,3 +113,65 @@ result-status.score = 1 | |||
| result-status.forcequit = false | ||||
| result-detail.exitstatus = true | ||||
| result-detail.stderr = true | ||||
| 
 | ||||
| [[stages]] | ||||
| name = "[joj] ex3" | ||||
| group = "joj" | ||||
| command="./ex3" | ||||
| files.import = [ "h6/build/ex2", "h6/build/ex3", "h6/build/ex4", "h6/build/ex5", "h6/build/ex6", "h6/build/ex7" ] | ||||
| score = 10 | ||||
| 
 | ||||
| parsers = [ "diff", "dummy", "result-detail" ] | ||||
| result-detail.exitstatus = true | ||||
| result-detail.stderr = true | ||||
| 
 | ||||
| # will be removed as long as the name is fixed | ||||
| case0.score = 10 | ||||
| case0.limit.cpu = 30 | ||||
| case0.limit.mem = 32 | ||||
| case0.limit.stdout = 8 | ||||
| 
 | ||||
| case1.score = 10 | ||||
| case1.limit.cpu = 30 | ||||
| case1.limit.mem = 32 | ||||
| case1.limit.stdout = 8 | ||||
| 
 | ||||
| case2.score = 10 | ||||
| case2.limit.cpu = 30 | ||||
| case2.limit.mem = 32 | ||||
| case2.limit.stdout = 8 | ||||
| 
 | ||||
| case3.score = 10 | ||||
| case3.limit.cpu = 30 | ||||
| case3.limit.mem = 32 | ||||
| case3.limit.stdout = 8 | ||||
| 
 | ||||
| case4.score = 10 | ||||
| case4.limit.cpu = 30 | ||||
| case4.limit.mem = 32 | ||||
| case4.limit.stdout = 8 | ||||
| 
 | ||||
| case5.score = 10 | ||||
| case5.limit.cpu = 30 | ||||
| case5.limit.mem = 32 | ||||
| case5.limit.stdout = 8 | ||||
| 
 | ||||
| case6.score = 10 | ||||
| case6.limit.cpu = 30 | ||||
| case6.limit.mem = 32 | ||||
| case6.limit.stdout = 8 | ||||
| 
 | ||||
| case7.score = 10 | ||||
| case7.limit.cpu = 30 | ||||
| case7.limit.mem = 32 | ||||
| case7.limit.stdout = 8 | ||||
| 
 | ||||
| case8.score = 10 | ||||
| case8.limit.cpu = 30 | ||||
| case8.limit.mem = 32 | ||||
| case8.limit.stdout = 8 | ||||
| 
 | ||||
| case9.score = 10 | ||||
| case9.limit.cpu = 30 | ||||
| case9.limit.mem = 32 | ||||
| case9.limit.stdout = 8 | ||||
|  |  | |||
|  | @ -7,6 +7,7 @@ import rtoml | |||
| from joj3_config_generator.convert import convert | ||||
| from joj3_config_generator.models import repo, task | ||||
| 
 | ||||
| 
 | ||||
| def read_convert_files( | ||||
|     case_name: str, | ||||
| ) -> Tuple[repo.Config, task.Config, Dict[str, Any]]: | ||||
|  | @ -27,5 +28,7 @@ def read_convert_files( | |||
| 
 | ||||
| def load_case(case_name: str) -> None: | ||||
|     repo, task, expected_result = read_convert_files(case_name) | ||||
|     result = convert(repo, task).model_dump(mode="json", by_alias=True, exclude_none=True) | ||||
|     result = convert(repo, task).model_dump( | ||||
|         mode="json", by_alias=True, exclude_none=True | ||||
|     ) | ||||
|     assert result == expected_result | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue
	
	Block a user
	
deprecated
@bomingzh any suggestions on the structure?
fixed with
model_configstr here need to be a
StrEnumnow.But I guess we don't know the set of case in advance, making it dynamic
StrEnumis meaninglessline changed, the comment is for
parsers