feat: rough distrubte json function
This commit is contained in:
		
							parent
							
								
									b755efac6d
								
							
						
					
					
						commit
						b298a2ac3a
					
				|  | @ -1,4 +1,8 @@ | |||
| from typing import List | ||||
| import json | ||||
| import os | ||||
| from typing import Any, List | ||||
| 
 | ||||
| import rtoml | ||||
| 
 | ||||
| from joj3_config_generator.models import joj1, repo, result, task | ||||
| from joj3_config_generator.processers.repo import ( | ||||
|  | @ -90,3 +94,25 @@ def convert_joj1(joj1_conf: joj1.Config) -> task.Config: | |||
|         release=task.Release(deadline=release_deadline), | ||||
|         stages=stages, | ||||
|     ) | ||||
| 
 | ||||
| 
 | ||||
| def distribute_json(folder_path: str, repo_obj: Any) -> None: | ||||
|     for root, _, files in os.walk(folder_path): | ||||
|         for file in files: | ||||
|             if file.endswith(".toml"): | ||||
|                 toml_file_path = os.path.join(root, file) | ||||
|                 json_file_path = os.path.join(root, file.replace(".toml", ".json")) | ||||
|                 with open(toml_file_path) as toml_file: | ||||
|                     task_toml = toml_file.read() | ||||
|                 task_obj = rtoml.loads(task_toml) | ||||
|                 result_model = convert(repo.Config(**repo_obj), task.Config(**task_obj)) | ||||
|                 result_dict = result_model.model_dump(by_alias=True, exclude_none=True) | ||||
| 
 | ||||
|                 with open(json_file_path, "w") as result_file: | ||||
|                     json.dump(result_dict, result_file, ensure_ascii=False, indent=4) | ||||
|                     result_file.write("\n") | ||||
|                     print(f"Successfully convert {toml_file_path} into json!") | ||||
|                     assert os.path.exists( | ||||
|                         json_file_path | ||||
|                     ), f"Failed to convert {toml_file_path} into json!" | ||||
|     return 0 | ||||
|  |  | |||
|  | @ -10,6 +10,7 @@ import yaml | |||
| 
 | ||||
| from joj3_config_generator.convert import convert as convert_conf | ||||
| from joj3_config_generator.convert import convert_joj1 as convert_joj1_conf | ||||
| from joj3_config_generator.convert import distribute_json | ||||
| from joj3_config_generator.models import joj1, repo, task | ||||
| from joj3_config_generator.utils.logger import logger | ||||
| 
 | ||||
|  | @ -69,4 +70,9 @@ def convert(root: Path = Path(".")) -> Dict[str, Any]: | |||
|         json.dump(result_dict, result_file, ensure_ascii=False, indent=4) | ||||
|         result_file.write("\n") | ||||
| 
 | ||||
|     # FIXME: change the path to the server | ||||
|     homework_name = "h8" | ||||
|     folder_path = f"/mnt/c/Users/Nuvole/Desktop/engr151-joj/home/tt/.config/joj/tests/homework/{homework_name}" | ||||
|     assert os.path.exists(folder_path), f"there exists no {folder_path}" | ||||
|     distribute_json(folder_path, repo_obj) | ||||
|     return result_dict | ||||
|  |  | |||
|  | @ -52,7 +52,9 @@ class OptionalCmd(BaseModel): | |||
|     stderr: Optional[CmdFile] = None | ||||
|     cpu_limit: Optional[int] = Field(4 * 1000000000000, serialization_alias="cpuLimit") | ||||
|     real_cpu_limit: Optional[int] = Field(None, serialization_alias="realCpuLimit") | ||||
|     clock_limit: Optional[int] = Field(8 * 1000000000000, serialization_alias="clockLimit") | ||||
|     clock_limit: Optional[int] = Field( | ||||
|         8 * 1000000000000, serialization_alias="clockLimit" | ||||
|     ) | ||||
|     memory_limit: Optional[int] = Field( | ||||
|         800 * 1024 * 1024, serialization_alias="memoryLimit" | ||||
|     ) | ||||
|  |  | |||
|  | @ -15,7 +15,7 @@ class ParserResultDetail(BaseModel): | |||
| class ParserDummy(BaseModel): | ||||
|     comment: Optional[str] = "" | ||||
|     score: Optional[int] = 0 | ||||
|     forcequit: Optional[bool] = True | ||||
|     forcequit: Optional[bool] = False | ||||
| 
 | ||||
| 
 | ||||
| class ParserKeyword(BaseModel): | ||||
|  | @ -27,7 +27,7 @@ class Outputs(BaseModel): | |||
|     score: Optional[int] = 0 | ||||
|     ignorespaces: Optional[bool] = True | ||||
|     hide: Optional[bool] = False | ||||
|     forcequit: Optional[bool] = True | ||||
|     forcequit: Optional[bool] = False | ||||
| 
 | ||||
| 
 | ||||
| class ParserDiff(BaseModel): | ||||
|  | @ -48,6 +48,8 @@ class Limit(BaseModel): | |||
| 
 | ||||
| class Stage(BaseModel): | ||||
|     name: Optional[str] = None  # Stage name | ||||
|     group: Optional[str] = None  # TODO: may need to formulate this | ||||
|     path: Optional[str] = None  # FIXME: this is highly possible to be removed in future | ||||
|     command: Optional[str] = None  # Command to run | ||||
|     files: Optional[Files] = None | ||||
|     in_: Optional[str] = Field(None, alias="in") | ||||
|  |  | |||
|  | @ -1,5 +1,5 @@ | |||
| import shlex | ||||
| from typing import Tuple, List | ||||
| from typing import List, Tuple | ||||
| 
 | ||||
| from joj3_config_generator.models import result, task | ||||
| 
 | ||||
|  | @ -12,7 +12,8 @@ def get_conf_stage( | |||
|         # TODO: we may have cq in future | ||||
|         group=( | ||||
|             "joj" | ||||
|             if (task_stage.name is not None) and (("joj" in task_stage.name) or ("run" in task_stage.name)) | ||||
|             if (task_stage.name is not None) | ||||
|             and (("joj" in task_stage.name) or ("run" in task_stage.name)) | ||||
|             else None | ||||
|         ), | ||||
|         executor=result.Executor( | ||||
|  | @ -47,10 +48,7 @@ def get_executorWithConfig( | |||
|         and (task_stage.files is not None) | ||||
|         else [] | ||||
|     ) | ||||
|     copy_out_files = [ | ||||
|         "stdout", | ||||
|         "stderr" | ||||
|     ] | ||||
|     copy_out_files = ["stdout", "stderr"] | ||||
|     executor_with_config = result.ExecutorWith( | ||||
|         default=result.Cmd( | ||||
|             args=( | ||||
|  | @ -237,28 +235,19 @@ def fix_diff( | |||
|                 if case_stage.limit and case_stage.limit.mem is not None | ||||
|                 else 0 | ||||
|             ) | ||||
|             command = ( | ||||
|                 case_stage.command  | ||||
|                 if case_stage.command is not None | ||||
|                 else None | ||||
|             ) | ||||
|             stdin = ( | ||||
|                 case_stage.in_  | ||||
|                 if case_stage.in_ is not None | ||||
|                 else f"{case}.in" | ||||
|             ) | ||||
|             stdout = ( | ||||
|                 case_stage.out_ | ||||
|                 if case_stage.out_ is not None | ||||
|                 else f"{case}.out" | ||||
|             ) | ||||
|             command = case_stage.command if case_stage.command is not None else None | ||||
|             stdin = case_stage.in_ if case_stage.in_ is not None else f"{case}.in" | ||||
|             stdout = case_stage.out_ if case_stage.out_ is not None else f"{case}.out" | ||||
| 
 | ||||
|             stage_cases.append( | ||||
|                 result.OptionalCmd( | ||||
|                     stdin=result.CmdFile( | ||||
|                         src=f"/home/tt/.config/joj/{task_conf.task.type_}/{stdin}" | ||||
|                         # src=f"/home/tt/.config/joj/{task_conf.task.type_}/{stdin}" | ||||
|                         src=f"/home/tt/.config/joj/{task_stage.path}/{stdin}" | ||||
|                     ), | ||||
|                     args=( | ||||
|                         shlex.split(case_stage.command) if command is not None else None | ||||
|                     ), | ||||
|                     args=shlex.split(case_stage.command) if command is not None else None, | ||||
|                     cpu_limit=cpu_limit, | ||||
|                     clock_limit=clock_limit, | ||||
|                     memory_limit=memory_limit, | ||||
|  | @ -279,7 +268,8 @@ def fix_diff( | |||
|                             { | ||||
|                                 "score": diff_output.score, | ||||
|                                 "fileName": "stdout", | ||||
|                                 "answerPath": f"/home/tt/.config/joj/{task_conf.task.type_}/{stdout}", | ||||
|                                 # "answerPath": f"/home/tt/.config/joj/{task_conf.task.type_}/{stdout}", | ||||
|                                 "answerPath": f"/home/tt/.config/joj/{task_stage.path}/{stdin}", | ||||
|                                 "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 = ["Readme.md" ] | ||||
| immutable = [".gitignore", ".gitattributes", ".gitea/workflows/push.yaml", ".gitea/workflows/release.yaml" ] | ||||
| required = ["README.md" ] | ||||
| immutable = [".gitignore", ".gitattributes", ".gitea/workflows/release.yaml" ] | ||||
|  |  | |||
|  | @ -1,7 +1,7 @@ | |||
| { | ||||
|     "name": "hw 6 ex1", | ||||
|     "logPath": "/home/tt/.cache/joj3/tests/homework/h6/e1.log", | ||||
|     "expireUnixTimestamp": 1732031999, | ||||
|     "name": "e2", | ||||
|     "logPath": "/home/tt/.cache/joj3/exam/e2.log", | ||||
|     "expireUnixTimestamp": 1735574399, | ||||
|     "stage": { | ||||
|         "sandboxExecServer": "172.17.0.1:5051", | ||||
|         "sandboxToken": "test", | ||||
|  | @ -17,9 +17,9 @@ | |||
|                                 "/tmp/repo-health-checker", | ||||
|                                 "-root=.", | ||||
|                                 "-repoSize=50.5", | ||||
|                                 "-meta=Readme.md", | ||||
|                                 "-checkFileSumList=a5b63323a692d3d8b952442969649b4f823d58dae26429494f613df160710dfc,b1bbad25b830db0a77b15a033f9ca1b7ab44c1d2d05056412bd3e4421645f0bf,7300de510e1674f6d533ae799eb5395fae6d5fbe6f64ff5047480e503602a4da,ad7ba6fbee5d80e018e4190e31bd842553d540044f0faf13592d73cef93a061b", | ||||
|                                 "-checkFileNameList=.gitignore,.gitattributes,.gitea/workflows/push.yaml,.gitea/workflows/release.yaml" | ||||
|                                 "-meta=README.md", | ||||
|                                 "-checkFileSumList=12e3ffc45b2cf64a83f208d982b23559ac6b73e68055ba396fe291efeec3732a,b1bbad25b830db0a77b15a033f9ca1b7ab44c1d2d05056412bd3e4421645f0bf,46b08d7120f3947261eba15fd6323561f310b4732e8528c01e0144db1ce18375", | ||||
|                                 "-checkFileNameList=.gitignore,.gitattributes,.gitea/workflows/release.yaml" | ||||
|                             ], | ||||
|                             "env": [ | ||||
|                                 "PATH=/usr/bin:/bin:/usr/local/bin" | ||||
|  | @ -110,6 +110,22 @@ | |||
|                                 "tools/compile": { | ||||
|                                     "src": "/home/tt/.config/joj/tools/compile", | ||||
|                                     "max": 419430400 | ||||
|                                 }, | ||||
|                                 "h6/build/ex3-main.c": { | ||||
|                                     "src": "/home/tt/.config/joj/h6/build/ex3-main.c", | ||||
|                                     "max": 419430400 | ||||
|                                 }, | ||||
|                                 "h6/build/ex4-main.c": { | ||||
|                                     "src": "/home/tt/.config/joj/h6/build/ex4-main.c", | ||||
|                                     "max": 419430400 | ||||
|                                 }, | ||||
|                                 "h6/build/ex5-main.c": { | ||||
|                                     "src": "/home/tt/.config/joj/h6/build/ex5-main.c", | ||||
|                                     "max": 419430400 | ||||
|                                 }, | ||||
|                                 "h6/build/ex7-main.c": { | ||||
|                                     "src": "/home/tt/.config/joj/h6/build/ex7-main.c", | ||||
|                                     "max": 419430400 | ||||
|                                 } | ||||
|                             }, | ||||
|                             "copyInCached": {}, | ||||
|  | @ -119,10 +135,34 @@ | |||
|                                 "stderr" | ||||
|                             ], | ||||
|                             "copyOutCached": [ | ||||
|                                 "h6/build/ex1", | ||||
|                                 "h6/build/ex1-asan", | ||||
|                                 "h6/build/ex1-ubsan", | ||||
|                                 "h6/build/ex1-msan", | ||||
|                                 "h6/build/ex2", | ||||
|                                 "h6/build/ex2-asan", | ||||
|                                 "h6/build/ex2-ubsan", | ||||
|                                 "h6/build/ex2-msan", | ||||
|                                 "h6/build/ex3", | ||||
|                                 "h6/build/ex3-asan", | ||||
|                                 "h6/build/ex3-ubsan", | ||||
|                                 "h6/build/ex3-msan", | ||||
|                                 "h6/build/ex4", | ||||
|                                 "h6/build/ex4-asan", | ||||
|                                 "h6/build/ex4-ubsan", | ||||
|                                 "h6/build/ex4-msan", | ||||
|                                 "h6/build/ex5", | ||||
|                                 "h6/build/ex5-asan", | ||||
|                                 "h6/build/ex5-ubsan", | ||||
|                                 "h6/build/ex5-msan", | ||||
|                                 "h6/build/ex6", | ||||
|                                 "h6/build/ex6-asan", | ||||
|                                 "h6/build/ex6-ubsan", | ||||
|                                 "h6/build/ex6-msan", | ||||
|                                 "h6/build/ex7", | ||||
|                                 "h6/build/ex7-asan", | ||||
|                                 "h6/build/ex7-ubsan", | ||||
|                                 "h6/build/ex7-msan", | ||||
|                                 "h6/build/ex3-main.c", | ||||
|                                 "h6/build/ex4-main.c", | ||||
|                                 "h6/build/ex5-main.c", | ||||
|                                 "h6/build/ex7-main.c", | ||||
|                                 "h6/build/compile_commands.json" | ||||
|                             ], | ||||
|                             "copyOutMax": 0, | ||||
|  | @ -149,484 +189,12 @@ | |||
|                             "showMemory": false | ||||
|                         } | ||||
|                     }, | ||||
|                     { | ||||
|                         "name": "dummy", | ||||
|                         "with": { | ||||
|                             "score": 0, | ||||
|                             "comment": "Congratulations! Your code compiled successfully.", | ||||
|                             "forceQuitOnNotAccepted": true | ||||
|                         } | ||||
|                     }, | ||||
|                     { | ||||
|                         "name": "result-status", | ||||
|                         "with": { | ||||
|                             "score": 0, | ||||
|                             "comment": "Congratulations! Your code compiled successfully.", | ||||
|                             "forceQuitOnNotAccepted": true | ||||
|                         } | ||||
|                     } | ||||
|                 ] | ||||
|             }, | ||||
|             { | ||||
|                 "name": "[cq] Filelength", | ||||
|                 "executor": { | ||||
|                     "name": "sandbox", | ||||
|                     "with": { | ||||
|                         "default": { | ||||
|                             "args": [ | ||||
|                                 "./tools/filelength", | ||||
|                                 "400", | ||||
|                                 "300", | ||||
|                                 "*.c", | ||||
|                                 "*.h" | ||||
|                             ], | ||||
|                             "env": [ | ||||
|                                 "PATH=/usr/bin:/bin:/usr/local/bin" | ||||
|                             ], | ||||
|                             "stdin": { | ||||
|                                 "content": "", | ||||
|                                 "max": 419430400 | ||||
|                             }, | ||||
|                             "stdout": { | ||||
|                                 "name": "stdout", | ||||
|                                 "max": 800000000000000 | ||||
|                             }, | ||||
|                             "stderr": { | ||||
|                                 "name": "stderr", | ||||
|                                 "max": 800000000000000 | ||||
|                             }, | ||||
|                             "cpuLimit": 1000000000000000, | ||||
|                             "realCpuLimit": 0, | ||||
|                             "clockLimit": 2000000000000000, | ||||
|                             "memoryLimit": 838860800, | ||||
|                             "stackLimit": 0, | ||||
|                             "procLimit": 50, | ||||
|                             "cpuRateLimit": 0, | ||||
|                             "cpuSetLimit": "", | ||||
|                             "copyIn": { | ||||
|                                 "tools/filelength": { | ||||
|                                     "src": "/home/tt/.config/joj/tools/filelength", | ||||
|                                     "max": 419430400 | ||||
|                                 } | ||||
|                             }, | ||||
|                             "copyInCached": { | ||||
|                                 "h6/build/ex1": "h6/build/ex1", | ||||
|                                 "h6/build/ex1-asan": "h6/build/ex1-asan", | ||||
|                                 "h6/build/ex1-ubsan": "h6/build/ex1-ubsan", | ||||
|                                 "h6/build/ex1-msan": "h6/build/ex1-msan", | ||||
|                                 "h6/build/compile_commands.json": "h6/build/compile_commands.json" | ||||
|                             }, | ||||
|                             "copyInDir": ".", | ||||
|                             "copyOut": [ | ||||
|                                 "stdout", | ||||
|                                 "stderr" | ||||
|                             ], | ||||
|                             "copyOutCached": [], | ||||
|                             "copyOutMax": 0, | ||||
|                             "copyOutDir": "", | ||||
|                             "tty": false, | ||||
|                             "strictMemoryLimit": false, | ||||
|                             "dataSegmentLimit": false, | ||||
|                             "addressSpaceLimit": false | ||||
|                         }, | ||||
|                         "cases": [] | ||||
|                     } | ||||
|                 }, | ||||
|                 "parsers": [ | ||||
|                     { | ||||
|                         "name": "keyword", | ||||
|                         "with": { | ||||
|                             "matches": [ | ||||
|                                 { | ||||
|                                     "keywords": [ | ||||
|                                         "recommended" | ||||
|                                     ], | ||||
|                                     "score": 10 | ||||
|                                 }, | ||||
|                                 { | ||||
|                                     "keywords": [ | ||||
|                                         "max" | ||||
|                                     ], | ||||
|                                     "score": 20 | ||||
|                                 } | ||||
|                             ] | ||||
|                         } | ||||
|                     }, | ||||
|                     { | ||||
|                         "name": "dummy", | ||||
|                         "with": { | ||||
|                             "score": 0, | ||||
|                             "comment": "", | ||||
|                             "forceQuitOnNotAccepted": true | ||||
|                         } | ||||
|                     }, | ||||
|                     { | ||||
|                         "name": "result-detail", | ||||
|                         "with": { | ||||
|                             "score": 0, | ||||
|                             "comment": "", | ||||
|                             "showFiles": [ | ||||
|                                 "stdout" | ||||
|                             ], | ||||
|                             "showExitStatus": true, | ||||
|                             "showRuntime": false, | ||||
|                             "showMemory": false | ||||
|                         } | ||||
|                     } | ||||
|                 ] | ||||
|             }, | ||||
|             { | ||||
|                 "name": "[cq] Clang-tidy", | ||||
|                 "executor": { | ||||
|                     "name": "sandbox", | ||||
|                     "with": { | ||||
|                         "default": { | ||||
|                             "args": [ | ||||
|                                 "run-clang-tidy-18", | ||||
|                                 "-header-filter=.*", | ||||
|                                 "-quiet", | ||||
|                                 "-load=/usr/local/lib/libcodequality.so", | ||||
|                                 "-p", | ||||
|                                 "h6/build" | ||||
|                             ], | ||||
|                             "env": [ | ||||
|                                 "PATH=/usr/bin:/bin:/usr/local/bin" | ||||
|                             ], | ||||
|                             "stdin": { | ||||
|                                 "content": "", | ||||
|                                 "max": 419430400 | ||||
|                             }, | ||||
|                             "stdout": { | ||||
|                                 "name": "stdout", | ||||
|                                 "max": 65000000000000 | ||||
|                             }, | ||||
|                             "stderr": { | ||||
|                                 "name": "stderr", | ||||
|                                 "max": 800000000000000 | ||||
|                             }, | ||||
|                             "cpuLimit": 1000000000000000, | ||||
|                             "realCpuLimit": 0, | ||||
|                             "clockLimit": 2000000000000000, | ||||
|                             "memoryLimit": 838860800, | ||||
|                             "stackLimit": 0, | ||||
|                             "procLimit": 50, | ||||
|                             "cpuRateLimit": 0, | ||||
|                             "cpuSetLimit": "", | ||||
|                             "copyIn": { | ||||
|                                 "projects/p2/.clang-tidy": { | ||||
|                                     "src": "/home/tt/.config/joj/projects/p2/.clang-tidy", | ||||
|                                     "max": 419430400 | ||||
|                                 } | ||||
|                             }, | ||||
|                             "copyInCached": { | ||||
|                                 "h6/build/ex1": "h6/build/ex1", | ||||
|                                 "h6/build/ex1-asan": "h6/build/ex1-asan", | ||||
|                                 "h6/build/ex1-ubsan": "h6/build/ex1-ubsan", | ||||
|                                 "h6/build/ex1-msan": "h6/build/ex1-msan", | ||||
|                                 "h6/build/compile_commands.json": "h6/build/compile_commands.json" | ||||
|                             }, | ||||
|                             "copyInDir": ".", | ||||
|                             "copyOut": [ | ||||
|                                 "stdout", | ||||
|                                 "stderr" | ||||
|                             ], | ||||
|                             "copyOutCached": [], | ||||
|                             "copyOutMax": 0, | ||||
|                             "copyOutDir": "", | ||||
|                             "tty": false, | ||||
|                             "strictMemoryLimit": false, | ||||
|                             "dataSegmentLimit": false, | ||||
|                             "addressSpaceLimit": false | ||||
|                         }, | ||||
|                         "cases": [] | ||||
|                     } | ||||
|                 }, | ||||
|                 "parsers": [ | ||||
|                     { | ||||
|                         "name": "clangtidy", | ||||
|                         "with": { | ||||
|                             "matches": [ | ||||
|                                 { | ||||
|                                     "keywords": [ | ||||
|                                         "readability-function-size" | ||||
|                                     ], | ||||
|                                     "score": 10 | ||||
|                                 }, | ||||
|                                 { | ||||
|                                     "keywords": [ | ||||
|                                         "codequality-no-global-variables", | ||||
|                                         "codequality-no-header-guard", | ||||
|                                         "codequality-no-fflush-stdin" | ||||
|                                     ], | ||||
|                                     "score": 20 | ||||
|                                 }, | ||||
|                                 { | ||||
|                                     "keywords": [ | ||||
|                                         "codequality-unchecked-malloc-result", | ||||
|                                         "readability-duplicate-include", | ||||
|                                         "readability-identifier-naming", | ||||
|                                         "readability-redundant", | ||||
|                                         "readability-misplaced-array-index", | ||||
|                                         "cppcoreguidelines-init-variables", | ||||
|                                         "bugprone-suspicious-string-compare", | ||||
|                                         "google-global-names-in-headers", | ||||
|                                         "clang-diagnostic", | ||||
|                                         "clang-analyzer", | ||||
|                                         "misc", | ||||
|                                         "performance", | ||||
|                                         "portability" | ||||
|                                     ], | ||||
|                                     "score": 5 | ||||
|                                 }, | ||||
|                                 { | ||||
|                                     "keywords": [ | ||||
|                                         "readability-misleading-indentation" | ||||
|                                     ], | ||||
|                                     "score": 15 | ||||
|                                 } | ||||
|                             ] | ||||
|                         } | ||||
|                     }, | ||||
|                     { | ||||
|                         "name": "dummy", | ||||
|                         "with": { | ||||
|                             "score": 0, | ||||
|                             "comment": "", | ||||
|                             "forceQuitOnNotAccepted": true | ||||
|                         } | ||||
|                     }, | ||||
|                     { | ||||
|                         "name": "result-detail", | ||||
|                         "with": { | ||||
|                             "score": 0, | ||||
|                             "comment": "", | ||||
|                             "showFiles": [ | ||||
|                                 "stdout" | ||||
|                             ], | ||||
|                             "showExitStatus": true, | ||||
|                             "showRuntime": false, | ||||
|                             "showMemory": false | ||||
|                         } | ||||
|                     } | ||||
|                 ] | ||||
|             }, | ||||
|             { | ||||
|                 "name": "[cq] Cppcheck", | ||||
|                 "executor": { | ||||
|                     "name": "sandbox", | ||||
|                     "with": { | ||||
|                         "default": { | ||||
|                             "args": [ | ||||
|                                 "cppcheck", | ||||
|                                 "--template={\"file\":\"{file}\",\"line\":{line}, \"column\":{column}, \"severity\":\"{severity}\", \"message\":\"{message}\", \"id\":\"{id}\"}", | ||||
|                                 "--force", | ||||
|                                 "--enable=all", | ||||
|                                 "--suppress=missingIncludeSystem", | ||||
|                                 "--quiet", | ||||
|                                 "./" | ||||
|                             ], | ||||
|                             "env": [ | ||||
|                                 "PATH=/usr/bin:/bin:/usr/local/bin" | ||||
|                             ], | ||||
|                             "stdin": { | ||||
|                                 "content": "", | ||||
|                                 "max": 419430400 | ||||
|                             }, | ||||
|                             "stdout": { | ||||
|                                 "name": "stdout", | ||||
|                                 "max": 800000000000000 | ||||
|                             }, | ||||
|                             "stderr": { | ||||
|                                 "name": "stderr", | ||||
|                                 "max": 65000000000000 | ||||
|                             }, | ||||
|                             "cpuLimit": 1000000000000000, | ||||
|                             "realCpuLimit": 0, | ||||
|                             "clockLimit": 2000000000000000, | ||||
|                             "memoryLimit": 838860800, | ||||
|                             "stackLimit": 0, | ||||
|                             "procLimit": 50, | ||||
|                             "cpuRateLimit": 0, | ||||
|                             "cpuSetLimit": "", | ||||
|                             "copyIn": {}, | ||||
|                             "copyInCached": { | ||||
|                                 "h6/build/ex1": "h6/build/ex1", | ||||
|                                 "h6/build/ex1-asan": "h6/build/ex1-asan", | ||||
|                                 "h6/build/ex1-ubsan": "h6/build/ex1-ubsan", | ||||
|                                 "h6/build/ex1-msan": "h6/build/ex1-msan", | ||||
|                                 "h6/build/compile_commands.json": "h6/build/compile_commands.json" | ||||
|                             }, | ||||
|                             "copyInDir": ".", | ||||
|                             "copyOut": [ | ||||
|                                 "stdout", | ||||
|                                 "stderr" | ||||
|                             ], | ||||
|                             "copyOutCached": [], | ||||
|                             "copyOutMax": 0, | ||||
|                             "copyOutDir": "", | ||||
|                             "tty": false, | ||||
|                             "strictMemoryLimit": false, | ||||
|                             "dataSegmentLimit": false, | ||||
|                             "addressSpaceLimit": false | ||||
|                         }, | ||||
|                         "cases": [] | ||||
|                     } | ||||
|                 }, | ||||
|                 "parsers": [ | ||||
|                     { | ||||
|                         "name": "cppcheck", | ||||
|                         "with": { | ||||
|                             "matches": [ | ||||
|                                 { | ||||
|                                     "keywords": [ | ||||
|                                         "warning", | ||||
|                                         "portability", | ||||
|                                         "performance", | ||||
|                                         "style" | ||||
|                                     ], | ||||
|                                     "score": 5 | ||||
|                                 }, | ||||
|                                 { | ||||
|                                     "keywords": [ | ||||
|                                         "error" | ||||
|                                     ], | ||||
|                                     "score": 15 | ||||
|                                 } | ||||
|                             ] | ||||
|                         } | ||||
|                     }, | ||||
|                     { | ||||
|                         "name": "dummy", | ||||
|                         "with": { | ||||
|                             "score": 0, | ||||
|                             "comment": "", | ||||
|                             "forceQuitOnNotAccepted": true | ||||
|                         } | ||||
|                     }, | ||||
|                     { | ||||
|                         "name": "result-detail", | ||||
|                         "with": { | ||||
|                             "score": 0, | ||||
|                             "comment": "", | ||||
|                             "showFiles": [ | ||||
|                                 "stderr" | ||||
|                             ], | ||||
|                             "showExitStatus": true, | ||||
|                             "showRuntime": false, | ||||
|                             "showMemory": false | ||||
|                         } | ||||
|                     } | ||||
|                 ] | ||||
|             }, | ||||
|             { | ||||
|                 "name": "[cq] Cpplint", | ||||
|                 "executor": { | ||||
|                     "name": "sandbox", | ||||
|                     "with": { | ||||
|                         "default": { | ||||
|                             "args": [ | ||||
|                                 "cpplint", | ||||
|                                 "--linelength=120", | ||||
|                                 "--filter=-legal,-readability/casting,-whitespace,-runtime/printf,-runtime/threadsafe_fn,-runtime/int,-readability/todo,-build/include_subdir,-build/header_guard,-build/include_what_you_use", | ||||
|                                 "--recursive", | ||||
|                                 "--exclude=build", | ||||
|                                 "." | ||||
|                             ], | ||||
|                             "env": [ | ||||
|                                 "PATH=/usr/bin:/bin:/usr/local/bin" | ||||
|                             ], | ||||
|                             "stdin": { | ||||
|                                 "content": "", | ||||
|                                 "max": 419430400 | ||||
|                             }, | ||||
|                             "stdout": { | ||||
|                                 "name": "stdout", | ||||
|                                 "max": 65000000000000 | ||||
|                             }, | ||||
|                             "stderr": { | ||||
|                                 "name": "stderr", | ||||
|                                 "max": 800000000000000 | ||||
|                             }, | ||||
|                             "cpuLimit": 1000000000000000, | ||||
|                             "realCpuLimit": 0, | ||||
|                             "clockLimit": 2000000000000000, | ||||
|                             "memoryLimit": 838860800, | ||||
|                             "stackLimit": 0, | ||||
|                             "procLimit": 50, | ||||
|                             "cpuRateLimit": 0, | ||||
|                             "cpuSetLimit": "", | ||||
|                             "copyIn": {}, | ||||
|                             "copyInCached": { | ||||
|                                 "h6/build/ex1": "h6/build/ex1", | ||||
|                                 "h6/build/ex1-asan": "h6/build/ex1-asan", | ||||
|                                 "h6/build/ex1-ubsan": "h6/build/ex1-ubsan", | ||||
|                                 "h6/build/ex1-msan": "h6/build/ex1-msan", | ||||
|                                 "h6/build/compile_commands.json": "h6/build/compile_commands.json" | ||||
|                             }, | ||||
|                             "copyInDir": ".", | ||||
|                             "copyOut": [ | ||||
|                                 "stdout", | ||||
|                                 "stderr" | ||||
|                             ], | ||||
|                             "copyOutCached": [], | ||||
|                             "copyOutMax": 0, | ||||
|                             "copyOutDir": "", | ||||
|                             "tty": false, | ||||
|                             "strictMemoryLimit": false, | ||||
|                             "dataSegmentLimit": false, | ||||
|                             "addressSpaceLimit": false | ||||
|                         }, | ||||
|                         "cases": [] | ||||
|                     } | ||||
|                 }, | ||||
|                 "parsers": [ | ||||
|                     { | ||||
|                         "name": "cpplint", | ||||
|                         "with": { | ||||
|                             "score": 0, | ||||
|                             "comment": "", | ||||
|                             "forceQuitOnNotAccepted": true, | ||||
|                             "matches": [ | ||||
|                                 { | ||||
|                                     "keywords": [ | ||||
|                                         "build" | ||||
|                                     ], | ||||
|                                     "score": 10 | ||||
|                                 }, | ||||
|                                 { | ||||
|                                     "keywords": [ | ||||
|                                         "readability" | ||||
|                                     ], | ||||
|                                     "score": 20 | ||||
|                                 }, | ||||
|                                 { | ||||
|                                     "keywords": [ | ||||
|                                         "runtime" | ||||
|                                     ], | ||||
|                                     "score": 5 | ||||
|                                 } | ||||
|                             ] | ||||
|                         } | ||||
|                     }, | ||||
|                     { | ||||
|                         "name": "dummy", | ||||
|                         "with": { | ||||
|                             "score": 0, | ||||
|                             "comment": "", | ||||
|                             "forceQuitOnNotAccepted": true | ||||
|                         } | ||||
|                     }, | ||||
|                     { | ||||
|                         "name": "result-detail", | ||||
|                         "with": { | ||||
|                             "score": 0, | ||||
|                             "comment": "", | ||||
|                             "showFiles": [ | ||||
|                                 "stderr" | ||||
|                             ], | ||||
|                             "showExitStatus": true, | ||||
|                             "showRuntime": false, | ||||
|                             "showMemory": false | ||||
|                             "forceQuitOnNotAccepted": false | ||||
|                         } | ||||
|                     } | ||||
|                 ] | ||||
|  | @ -634,9 +202,9 @@ | |||
|         ] | ||||
|     }, | ||||
|     "teapot": { | ||||
|         "logPath": "/home/tt/.cache/joj3/tests/homework/h6/e1-joint-teapot-debug.log", | ||||
|         "scoreboardPath": "tests/homework-scoreboard.csv", | ||||
|         "failedTablePath": "tests/homework-failed-table.md", | ||||
|         "logPath": "/home/tt/.cache/joj3/exam/e2-joint-teapot-debug.log", | ||||
|         "scoreboardPath": "exam/e2-scoreboard.csv", | ||||
|         "failedTablePath": "exam/e2-failed-table.md", | ||||
|         "gradingRepoName": "engr151-joj", | ||||
|         "skipIssue": false, | ||||
|         "skipScoreboard": false, | ||||
|  |  | |||
|  | @ -1,79 +1,20 @@ | |||
| # general task configuration | ||||
| task.name = "hw 6 ex1" # task name | ||||
| task.type = "tests/homework/h6/e1" | ||||
| task.name = "e2" # task name | ||||
| task.type = "exam/e2" | ||||
| 
 | ||||
| release.deadline = 2024-11-19 23:59:59+08:00 | ||||
| release.deadline = 2024-12-30 23:59:59+08:00 | ||||
| release.stages = [ "compile" ] | ||||
| 
 | ||||
| [[stages]] | ||||
| name = "Compilation" | ||||
| command = "./tools/compile" # eg. script running cmake commands | ||||
| files.import = [ "tools/compile"]  | ||||
| files.export = [ "h6/build/ex1", "h6/build/ex1-asan", "h6/build/ex1-ubsan", "h6/build/ex1-msan", "h6/build/compile_commands.json" ] | ||||
| files.import = [ "tools/compile", "h6/build/ex3-main.c", "h6/build/ex4-main.c", "h6/build/ex5-main.c", "h6/build/ex7-main.c" ] | ||||
| files.export = [ "h6/build/ex2", "h6/build/ex2-asan", "h6/build/ex2-ubsan", "h6/build/ex2-msan", "h6/build/ex3", "h6/build/ex3-asan", "h6/build/ex3-ubsan", "h6/build/ex3-msan", "h6/build/ex4", "h6/build/ex4-asan", "h6/build/ex4-ubsan", "h6/build/ex4-msan", "h6/build/ex5", "h6/build/ex5-asan", "h6/build/ex5-ubsan", "h6/build/ex5-msan", "h6/build/ex6", "h6/build/ex6-asan", "h6/build/ex6-ubsan", "h6/build/ex6-msan", "h6/build/ex7", "h6/build/ex7-asan", "h6/build/ex7-ubsan", "h6/build/ex7-msan", "h6/build/ex3-main.c", "h6/build/ex4-main.c", "h6/build/ex5-main.c", "h6/build/ex7-main.c", "h6/build/compile_commands.json" ] | ||||
| 
 | ||||
| # compile parsers  | ||||
| parsers = [ "result-detail", "dummy", "result-status" ] | ||||
| # compile parsers ex | ||||
| parsers = [ "result-detail", "result-status" ] | ||||
| result-status.comment = "Congratulations! Your code compiled successfully." | ||||
| dummy.comment = "\n\n### Details\n" | ||||
| result-detail.exitstatus = true | ||||
| result-detail.stderr = true | ||||
| result-detail.time = false | ||||
| result-detail.mem = false | ||||
| 
 | ||||
| [[stages]] | ||||
| name = "[cq] Filelength" | ||||
| command = "./tools/filelength 400 300 *.c *.h" | ||||
| files.import = [ "tools/filelength" ] | ||||
| 
 | ||||
| parsers = [ "keyword", "dummy", "result-detail" ] | ||||
| keyword.keyword = [ "max", "recommended"]  | ||||
| keyword.weight = [ 20, 10 ]  | ||||
| dummy.comment = "\n\n### Details\n" | ||||
| result-detail.exitstatus = true | ||||
| result-detail.stdout = true | ||||
| result-detail.time = false | ||||
| result-detail.mem = false | ||||
| 
 | ||||
| [[stages]] | ||||
| name = "[cq] Clang-tidy" | ||||
| command = "run-clang-tidy-18 -header-filter=.* -quiet -load=/usr/local/lib/libcodequality.so -p h6/build" | ||||
| files.import = [ "projects/p2/.clang-tidy", "h6/build/compile_commands.json" ] | ||||
| limit.stdout = 65 | ||||
| 
 | ||||
| parsers = [ "clangtidy", "dummy", "result-detail" ] | ||||
| clangtidy.keyword = [ "codequality-unchecked-malloc-result", "codequality-no-global-variables", "codequality-no-header-guard", "codequality-no-fflush-stdin", "readability-function-size", "readability-duplicate-include", "readability-identifier-naming", "readability-redundant", "readability-misleading-indentation", "readability-misplaced-array-index", "cppcoreguidelines-init-variables", "bugprone-suspicious-string-compare", "google-global-names-in-headers", "clang-diagnostic", "clang-analyzer", "misc", "performance", "portability" ] | ||||
| clangtidy.weight = [ 5, 20, 20, 20, 10, 5, 5, 5, 15, 5, 5, 5, 5, 5, 5, 5, 5, 5] | ||||
| dummy.comment = "\n\n### Details\n" | ||||
| result-detail.exitstatus = true | ||||
| result-detail.stdout = true | ||||
| result-detail.time = false | ||||
| result-detail.mem = false | ||||
| 
 | ||||
| [[stages]] | ||||
| name = "[cq] Cppcheck" | ||||
| command = "cppcheck --template='{\"file\":\"{file}\",\"line\":{line}, \"column\":{column}, \"severity\":\"{severity}\", \"message\":\"{message}\", \"id\":\"{id}\"}' --force --enable=all --suppress=missingIncludeSystem  --quiet ./" | ||||
| limit.stderr = 65 | ||||
| 
 | ||||
| parsers = [ "cppcheck", "dummy", "result-detail" ] | ||||
| cppcheck.keyword = ["error", "warning", "portability", "performance", "style"] | ||||
| cppcheck.weight = [15, 5, 5, 5, 5] | ||||
| dummy.comment = "\n\n### Details\n" | ||||
| result-detail.exitstatus = true | ||||
| result-detail.stderr = true | ||||
| result-detail.time = false | ||||
| result-detail.mem = false | ||||
| 
 | ||||
| [[stages]] | ||||
| name = "[cq] Cpplint" | ||||
| command = "cpplint --linelength=120 --filter=-legal,-readability/casting,-whitespace,-runtime/printf,-runtime/threadsafe_fn,-runtime/int,-readability/todo,-build/include_subdir,-build/header_guard,-build/include_what_you_use --recursive --exclude=build ." | ||||
| limit.stdout = 65 | ||||
| 
 | ||||
| parsers = [ "cpplint", "dummy", "result-detail" ] | ||||
| cpplint.keyword = [ "runtime", "readability", "build" ] | ||||
| cpplint.weight = [ 5, 20, 10] | ||||
| dummy.comment = "\n\n### Details\n" | ||||
| result-detail.exitstatus = true | ||||
| result-detail.stderr = true | ||||
| result-detail.time = false | ||||
| result-detail.mem = false | ||||
| 
 | ||||
|  |  | |||
							
								
								
									
										4
									
								
								tests/immutable_file/.gitignore
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										4
									
								
								tests/immutable_file/.gitignore
									
									
									
									
										vendored
									
									
								
							|  | @ -10,14 +10,10 @@ | |||
| !.gitignore | ||||
| !.gitattributes | ||||
| !.gitea/ | ||||
| !.gitea/issue_template/ | ||||
| !.gitea/workflows/ | ||||
| !*.yaml | ||||
| !Makefile | ||||
| !CMakeLists.txt | ||||
| !h[0-8]/ | ||||
| !*.m | ||||
| !*.c | ||||
| !*.cpp | ||||
| !*.h | ||||
| !*.md | ||||
|  |  | |||
|  | @ -18,4 +18,4 @@ jobs: | |||
|           fetch-depth: 0 | ||||
|       - name: run joj3 | ||||
|         run: | | ||||
|           sudo -E -u tt joj3 -conf-root "/home/tt/.config/joj/tests/homework" -conf-name "conf-release.json" -tag "${{ github.ref_name }}"           | ||||
|           sudo -E -u tt joj3 -conf-root "/home/tt/.config/joj/exam" -conf-name "conf-release.json" -tag "${{ github.ref_name }}" | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue
	
	Block a user