From f47fb812873c61e5fd036495072ef00f1688260d Mon Sep 17 00:00:00 2001 From: Nuvole Date: Wed, 23 Oct 2024 18:53:41 +0800 Subject: [PATCH 01/17] feat: migrate repo & init classes --- .gitignore | 2 +- joj3_config_generator/convert.py | 45 +- joj3_config_generator/lib/__init__.py | 11 + joj3_config_generator/lib/repo.py | 123 ++++ joj3_config_generator/main.py | 1 + joj3_config_generator/models/result.py | 32 +- joj3_config_generator/models/task.py | 45 +- tests/basic/repo.toml | 2 +- tests/basic/task.json | 814 ++++++++++++++++++++++--- tests/basic/task.toml | 133 +++- tests/immutable_file/.gitattributes | 33 + tests/immutable_file/.gitignore | 23 + tests/immutable_file/push.yaml | 18 + tests/immutable_file/release.yaml | 20 + 14 files changed, 1168 insertions(+), 134 deletions(-) create mode 100644 joj3_config_generator/lib/__init__.py create mode 100644 joj3_config_generator/lib/repo.py create mode 100644 tests/immutable_file/.gitattributes create mode 100644 tests/immutable_file/.gitignore create mode 100644 tests/immutable_file/push.yaml create mode 100644 tests/immutable_file/release.yaml diff --git a/.gitignore b/.gitignore index 75c8b18..40c7a94 100644 --- a/.gitignore +++ b/.gitignore @@ -15,7 +15,7 @@ dist/ downloads/ eggs/ .eggs/ -lib/ +# lib/ lib64/ parts/ sdist/ diff --git a/joj3_config_generator/convert.py b/joj3_config_generator/convert.py index 719c445..a74fde1 100644 --- a/joj3_config_generator/convert.py +++ b/joj3_config_generator/convert.py @@ -1,3 +1,4 @@ +from joj3_config_generator.lib.repo import getHealthcheckConfig, getTeapotConfig from joj3_config_generator.models import ( Cmd, CmdFile, @@ -18,29 +19,59 @@ def convert(repo_conf: Repo, task_conf: Task) -> ResultConfig: # Create the base ResultConf object result_conf = ResultConfig( name=task_conf.task, - log_path=f"{task_conf.task.replace(' ', '_')}.log", + # TODO: specify the exact folder difference + log_path=f"{task_conf.task.replace(' ', '-')}.log", expire_unix_timestamp=( int(task_conf.release.deadline.timestamp()) if task_conf.release.deadline else -1 ), stage=StageConfig(stages=[], sandbox_token=repo_conf.sandbox_token), - teapot=TeapotConfig(), + teapot=getTeapotConfig(repo_conf, task_conf), ) + # Construct healthcheck stage + healthcheck_stage = getHealthcheckConfig(repo_conf, task_conf) + result_conf.stage.stages.append(healthcheck_stage) + cached = [] # Convert each stage in the task configuration for task_stage in task_conf.stages: + file_import = ( + task_stage.files.import_ + if hasattr(task_stage, "files") + and hasattr(task_stage.files, "import_") + and (task_stage.files is not None) + and (task_stage.files.import_ is not None) + else [] + ) + copy_in_files = [file for file in file_import if (file not in cached)] + file_export = ( + task_stage.files.export + if hasattr(task_stage, "files") + and hasattr(task_stage.files, "export") + and (task_stage.files is not None) + else [] + ) executor_with_config = ExecutorWithConfig( default=Cmd( args=task_stage.command.split(), - copy_in={file: CmdFile(src=file) for file in task_stage.files.import_}, - copy_out_cached=task_stage.files.export, + copy_in={ + file: CmdFile(src=f"/home/tt/.config/joj/{file}") + for file in copy_in_files + }, + copy_in_cached={file: file for file in copy_in_files}, + copy_out_cached=file_export if file_export is not None else [], ), cases=[], # You can add cases if needed ) + if file_export is not None: + for file in file_export: + if file not in cached: + cached.append(file) conf_stage = Stage( name=task_stage.name, - group=task_conf.task, + # TODO: we may have cq in future + group="joj" if "judge" in task_stage.name else None, executor=ExecutorConfig( name="sandbox", with_=executor_with_config, @@ -49,12 +80,12 @@ def convert(repo_conf: Repo, task_conf: Task) -> ResultConfig: ParserConfig(name=parser, with_={}) for parser in task_stage.parsers ], ) - if "result-detail" in task_stage.parsers: result_detail_parser = next( p for p in conf_stage.parsers if p.name == "result-detail" ) - result_detail_parser.with_.update(task_stage.result_detail) + if task_stage.result_detail is not None: + result_detail_parser.with_.update(task_stage.result_detail) result_conf.stage.stages.append(conf_stage) diff --git a/joj3_config_generator/lib/__init__.py b/joj3_config_generator/lib/__init__.py new file mode 100644 index 0000000..68802d4 --- /dev/null +++ b/joj3_config_generator/lib/__init__.py @@ -0,0 +1,11 @@ +from joj3_config_generator.models.repo import Repo as Repo +from joj3_config_generator.models.result import Cmd as Cmd +from joj3_config_generator.models.result import CmdFile as CmdFile +from joj3_config_generator.models.result import ExecutorConfig as ExecutorConfig +from joj3_config_generator.models.result import ExecutorWithConfig as ExecutorWithConfig +from joj3_config_generator.models.result import ParserConfig as ParserConfig +from joj3_config_generator.models.result import ResultConfig as ResultConfig +from joj3_config_generator.models.result import Stage as Stage +from joj3_config_generator.models.result import StageConfig as StageConfig +from joj3_config_generator.models.result import TeapotConfig as TeapotConfig +from joj3_config_generator.models.task import Task as Task diff --git a/joj3_config_generator/lib/repo.py b/joj3_config_generator/lib/repo.py new file mode 100644 index 0000000..e9a8d33 --- /dev/null +++ b/joj3_config_generator/lib/repo.py @@ -0,0 +1,123 @@ +import hashlib +import os +import tempfile + +from dotenv import load_dotenv + +from joj3_config_generator.models import ( + Cmd, + CmdFile, + ExecutorConfig, + ExecutorWithConfig, + ParserConfig, + Repo, + ResultConfig, + Stage, + StageConfig, + Task, + TeapotConfig, +) + + +def get_temp_directory() -> str: + return tempfile.mkdtemp(prefix="repo-checker-") + + +def getGradingRepoName() -> str: + path = os.path.expanduser("~/.config/teapot/teapot.env") + if os.path.exists(path): + load_dotenv(path) + repo_name = os.environ.get("GITEA_ORG_NAME") + if repo_name is not None: + return f"{repo_name.split('-')[0]}-joj" + return "ece482-joj" + + +def getTeapotConfig(repo_conf: Repo, task_conf: Task) -> TeapotConfig: + teapot = TeapotConfig( + # 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", + grading_repo_name=getGradingRepoName(), + ) + return teapot + + +def getHealthcheckCmd(repo_conf: Repo) -> Cmd: + repoSize = repo_conf.max_size + immutable = repo_conf.files.immutable + repo_size = f"-repoSize={str(repoSize)} " + required_files = repo_conf.files.required + + for i, meta in enumerate(required_files): + required_files[i] = f"-meta={meta} " + + immutable_files = f"-checkFileNameList=" + for i, name in enumerate(immutable): + if i == len(immutable) - 1: + immutable_files = immutable_files + name + " " + else: + immutable_files = immutable_files + name + "," + # FIXME: need to make solution and make things easier to edit with global scope + chore = f"/{get_temp_directory}/repo-health-checker -root=. " + args = "" + args = args + chore + args = args + repo_size + for meta in required_files: + args = args + meta + + args = args + get_hash(immutable) + + args = args + immutable_files + + cmd = Cmd( + args=args.split(), + # FIXME: easier to edit within global scope + copy_in={ + f"/{get_temp_directory()}/repo-health-checker": CmdFile( + src=f"/{get_temp_directory()}/repo-health-checker" + ) + }, + ) + return cmd + + +def getHealthcheckConfig(repo_conf: Repo, task_conf: Task) -> Stage: + healthcheck_stage = Stage( + name="healthcheck", + group="", + executor=ExecutorConfig( + name="sandbox", + with_=ExecutorWithConfig(default=getHealthcheckCmd(repo_conf), cases=[]), + ), + parsers=[ParserConfig(name="healthcheck", with_={"score": 0, "comment": ""})], + ) + return healthcheck_stage + + +def calc_sha256sum(file_path: str) -> str: + sha256_hash = hashlib.sha256() + with open(file_path, "rb") as f: + for byte_block in iter(lambda: f.read(65536 * 2), b""): + sha256_hash.update(byte_block) + return sha256_hash.hexdigest() + + +def get_hash(immutable_files: list[str]) -> str: # input should be a list + file_path = "../immutable_file/" # TODO: change this when things are on the server + immutable_hash = [] + for i, file in enumerate(immutable_files): + immutable_files[i] = file_path + file.rsplit("/", 1)[-1] + + for i, file in enumerate(immutable_files): + immutable_hash.append(calc_sha256sum(file)) + + hash_check = "-checkFileSumList=" + + for i, file in enumerate(immutable_hash): + if i == len(immutable_hash) - 1: + hash_check = hash_check + file + " " + else: + hash_check = hash_check + file + "," + return hash_check diff --git a/joj3_config_generator/main.py b/joj3_config_generator/main.py index a8ee683..cae2d3b 100644 --- a/joj3_config_generator/main.py +++ b/joj3_config_generator/main.py @@ -54,6 +54,7 @@ def convert(root: Path = Path(".")) -> None: task_toml = task_file.read() repo_obj = rtoml.loads(repo_toml) task_obj = rtoml.loads(task_toml) + print(task_obj) result_model = convert_conf(Repo(**repo_obj), Task(**task_obj)) result_dict = result_model.model_dump(by_alias=True) with open(result_json_path, "w") as result_file: diff --git a/joj3_config_generator/models/result.py b/joj3_config_generator/models/result.py index f1dd8e7..2df2176 100644 --- a/joj3_config_generator/models/result.py +++ b/joj3_config_generator/models/result.py @@ -9,7 +9,7 @@ class CmdFile(BaseModel): content: Optional[str] = None file_id: Optional[str] = Field(None, serialization_alias="fileId") name: Optional[str] = None - max: Optional[int] = None + max: Optional[int] = 4 * 1024 * 1024 symlink: Optional[str] = None stream_in: bool = Field(False, serialization_alias="streamIn") stream_out: bool = Field(False, serialization_alias="streamOut") @@ -18,16 +18,16 @@ class CmdFile(BaseModel): class Cmd(BaseModel): args: list[str] - env: list[str] = [] - stdin: Optional[CmdFile] = None - stdout: Optional[CmdFile] = None - stderr: Optional[CmdFile] = None - cpu_limit: int = Field(0, serialization_alias="cpuLimit") + env: list[str] = ["PATH=/usr/bin:/bin:/usr/local/bin"] + stdin: Optional[CmdFile] = CmdFile(content="") + stdout: Optional[CmdFile] = CmdFile(name="stdout", max=4 * 1024) + stderr: Optional[CmdFile] = CmdFile(name="stderr", max=4 * 1024) + cpu_limit: int = Field(4 * 1000000000, serialization_alias="cpuLimit") real_cpu_limit: int = Field(0, serialization_alias="realCpuLimit") - clock_limit: int = Field(0, serialization_alias="clockLimit") - memory_limit: int = Field(0, serialization_alias="memoryLimit") + clock_limit: int = Field(8 * 1000000000, serialization_alias="clockLimit") + memory_limit: int = Field(4 * 1024 * 1024, serialization_alias="memoryLimit") stack_limit: int = Field(0, serialization_alias="stackLimit") - proc_limit: int = Field(0, serialization_alias="procLimit") + proc_limit: int = Field(50, serialization_alias="procLimit") cpu_rate_limit: int = Field(0, serialization_alias="cpuRateLimit") cpu_set_limit: str = Field("", serialization_alias="cpuSetLimit") copy_in: dict[str, CmdFile] = Field({}, serialization_alias="copyIn") @@ -45,16 +45,18 @@ class Cmd(BaseModel): class OptionalCmd(BaseModel): args: Optional[list[str]] = None - env: Optional[list[str]] = None + env: Optional[list[str]] = ["PATH=/usr/bin:/bin:/usr/local/bin"] stdin: Optional[CmdFile] = None stdout: Optional[CmdFile] = None stderr: Optional[CmdFile] = None - cpu_limit: Optional[int] = Field(None, serialization_alias="cpuLimit") + cpu_limit: Optional[int] = Field(4 * 1000000000, serialization_alias="cpuLimit") real_cpu_limit: Optional[int] = Field(None, serialization_alias="realCpuLimit") - clock_limit: Optional[int] = Field(None, serialization_alias="clockLimit") - memory_limit: Optional[int] = Field(None, serialization_alias="memoryLimit") + clock_limit: Optional[int] = Field(8 * 1000000000, serialization_alias="clockLimit") + memory_limit: Optional[int] = Field( + 4 * 1024 * 1024, serialization_alias="memoryLimit" + ) stack_limit: Optional[int] = Field(None, serialization_alias="stackLimit") - proc_limit: Optional[int] = Field(None, serialization_alias="procLimit") + proc_limit: Optional[int] = Field(50, serialization_alias="procLimit") cpu_rate_limit: Optional[int] = Field(None, serialization_alias="cpuRateLimit") cpu_set_limit: Optional[str] = Field(None, serialization_alias="cpuSetLimit") copy_in: Optional[dict[str, CmdFile]] = Field(None, serialization_alias="copyIn") @@ -82,7 +84,7 @@ class OptionalCmd(BaseModel): class Stage(BaseModel): name: str - group: str + group: Optional[str] = None executor: "ExecutorConfig" parsers: list["ParserConfig"] diff --git a/joj3_config_generator/models/task.py b/joj3_config_generator/models/task.py index 802555b..3bf8dec 100644 --- a/joj3_config_generator/models/task.py +++ b/joj3_config_generator/models/task.py @@ -5,26 +5,49 @@ from pydantic import BaseModel, Field class ParserResultDetail(BaseModel): - time: bool = True # Display run time - mem: bool = True # Display memory usage - stdout: bool = False # Display stdout messages - stderr: bool = False # Display stderr messages + time: Optional[bool] = True # Display run time + mem: Optional[bool] = True # Display memory usage + stdout: Optional[bool] = False # Display stdout messages + stderr: Optional[bool] = False # Display stderr messages + exitstatus: Optional[bool] = False + + +class ParserDummy(BaseModel): + comment: Optional[str] = "" + + +class ParserKeyword(BaseModel): + keyword: Optional[list[str]] = None + weight: Optional[list[int]] = None class Files(BaseModel): - import_: list[str] = Field(alias="import") - export: list[str] + import_: Optional[list[str]] = Field([], alias="import") + export: Optional[list[str]] = [] + + +class Limit(BaseModel): + mem: Optional[int] = 4 + cpu: Optional[int] = 4 + stderr: Optional[int] = 4 + stdout: Optional[int] = 4 class Stage(BaseModel): name: str # Stage name command: str # Command to run - files: Files # Files to import and export - score: int # Score for the task + files: Optional[Files] = None + score: Optional[int] = 0 parsers: list[str] # list of parsers - result_detail: ParserResultDetail = ( - ParserResultDetail() - ) # for result-detail parser + limit: Optional[Limit] = None + dummy: Optional[ParserDummy] = ParserDummy() + keyword: Optional[ParserKeyword] = ParserKeyword() + clangtidy: Optional[ParserKeyword] = ParserKeyword() + cppcheck: Optional[ParserKeyword] = ParserKeyword() + cpplint: Optional[ParserKeyword] = ParserKeyword() + result_detail: Optional[ParserResultDetail] = Field( + ParserResultDetail(), alias="result-detail" + ) class Release(BaseModel): diff --git a/tests/basic/repo.toml b/tests/basic/repo.toml index f9012cc..c77b9f7 100644 --- a/tests/basic/repo.toml +++ b/tests/basic/repo.toml @@ -7,4 +7,4 @@ sandbox_token = "test" whitelist_patterns = ["*.py", "*.txt", "*.md"] whitelist_file = ".whitelist" required = ["main.py", "README.md"] -immutable = ["config.yaml", "setup.py"] +immutable = [".gitignore", ".gitattributes", "push.yaml", "release.yaml"] diff --git a/tests/basic/task.json b/tests/basic/task.json index 294d15c..ae81205 100644 --- a/tests/basic/task.json +++ b/tests/basic/task.json @@ -1,53 +1,79 @@ { - "name": "hw3 ex5", - "logPath": "hw3_ex5.log", - "expireUnixTimestamp": 1729267140, + "name": "Homework 1 exercise 2", + "logPath": "Homework-1-exercise-2.log", + "expireUnixTimestamp": 1728748740, "stage": { "sandboxExecServer": "172.17.0.1:5051", "sandboxToken": "test", "outputPath": "/tmp/joj3_result.json", "stages": [ { - "name": "judge_base", - "group": "hw3 ex5", + "name": "healthcheck", + "group": "", "executor": { "name": "sandbox", "with": { "default": { "args": [ - "./matlab-joj", - "./h3/ex5.m" + "/tmp/repo-health-checker", + "-root=.", + "-repoSize=50.5", + "-meta=main.py", + "-meta=README.md", + "-checkFileSumList=a5b63323a692d3d8b952442969649b4f823d58dae26429494f613df160710dfc,b1bbad25b830db0a77b15a033f9ca1b7ab44c1d2d05056412bd3e4421645f0bf,8d1229900c6fc6711b5cc141d1ab5ea7f5b7b7a4b921d9cfa3957408b43ae723,eb857bcd94857cedc4045cb2d6ba04cb5bbb3daf188abc95fb9478db823ef47e", + "-checkFileNameList=.gitignore,.gitattributes,push.yaml,release.yaml" ], - "env": [], - "stdin": null, - "stdout": null, - "stderr": null, - "cpuLimit": 0, + "env": [ + "PATH=/usr/bin:/bin:/usr/local/bin" + ], + "stdin": { + "src": null, + "content": "", + "fileId": null, + "name": null, + "max": 4194304, + "symlink": null, + "streamIn": false, + "streamOut": false, + "pipe": false + }, + "stdout": { + "src": null, + "content": null, + "fileId": null, + "name": "stdout", + "max": 4096, + "symlink": null, + "streamIn": false, + "streamOut": false, + "pipe": false + }, + "stderr": { + "src": null, + "content": null, + "fileId": null, + "name": "stderr", + "max": 4096, + "symlink": null, + "streamIn": false, + "streamOut": false, + "pipe": false + }, + "cpuLimit": 4000000000, "realCpuLimit": 0, - "clockLimit": 0, - "memoryLimit": 0, + "clockLimit": 8000000000, + "memoryLimit": 4194304, "stackLimit": 0, - "procLimit": 0, + "procLimit": 50, "cpuRateLimit": 0, "cpuSetLimit": "", "copyIn": { - "tools/matlab-joj": { - "src": "tools/matlab-joj", + "/tmp/repo-health-checker": { + "src": "/tmp/repo-health-checker", "content": null, "fileId": null, "name": null, - "max": null, - "symlink": null, - "streamIn": false, - "streamOut": false, - "pipe": false - }, - "tools/matlab_formatter.py": { - "src": "tools/matlab_formatter.py", - "content": null, - "fileId": null, - "name": null, - "max": null, + "max": 4194304, "symlink": null, "streamIn": false, "streamOut": false, @@ -57,9 +83,139 @@ "copyInCached": {}, "copyInDir": ".", "copyOut": [], + "copyOutCached": [], + "copyOutMax": 0, + "copyOutDir": "", + "tty": false, + "strictMemoryLimit": false, + "dataSegmentLimit": false, + "addressSpaceLimit": false + }, + "cases": [] + } + }, + "parsers": [ + { + "name": "healthcheck", + "with": { + "score": 0, + "comment": "" + } + } + ] + }, + { + "name": "Compilation", + "group": null, + "executor": { + "name": "sandbox", + "with": { + "default": { + "args": [ + "make.sh" + ], + "env": [ + "PATH=/usr/bin:/bin:/usr/local/bin" + ], + "stdin": { + "src": null, + "content": "", + "fileId": null, + "name": null, + "max": 4194304, + "symlink": null, + "streamIn": false, + "streamOut": false, + "pipe": false + }, + "stdout": { + "src": null, + "content": null, + "fileId": null, + "name": "stdout", + "max": 4096, + "symlink": null, + "streamIn": false, + "streamOut": false, + "pipe": false + }, + "stderr": { + "src": null, + "content": null, + "fileId": null, + "name": "stderr", + "max": 4096, + "symlink": null, + "streamIn": false, + "streamOut": false, + "pipe": false + }, + "cpuLimit": 4000000000, + "realCpuLimit": 0, + "clockLimit": 8000000000, + "memoryLimit": 4194304, + "stackLimit": 0, + "procLimit": 50, + "cpuRateLimit": 0, + "cpuSetLimit": "", + "copyIn": { + "tools/make.sh": { + "src": "/home/tt/.config/joj/tools/make.sh", + "content": null, + "fileId": null, + "name": null, + "max": 4194304, + "symlink": null, + "streamIn": false, + "streamOut": false, + "pipe": false + }, + "src/main.c": { + "src": "/home/tt/.config/joj/src/main.c", + "content": null, + "fileId": null, + "name": null, + "max": 4194304, + "symlink": null, + "streamIn": false, + "streamOut": false, + "pipe": false + }, + "src/task.h": { + "src": "/home/tt/.config/joj/src/task.h", + "content": null, + "fileId": null, + "name": null, + "max": 4194304, + "symlink": null, + "streamIn": false, + "streamOut": false, + "pipe": false + }, + "srcCMakelist.txt": { + "src": "/home/tt/.config/joj/srcCMakelist.txt", + "content": null, + "fileId": null, + "name": null, + "max": 4194304, + "symlink": null, + "streamIn": false, + "streamOut": false, + "pipe": false + } + }, + "copyInCached": { + "tools/make.sh": "tools/make.sh", + "src/main.c": "src/main.c", + "src/task.h": "src/task.h", + "srcCMakelist.txt": "srcCMakelist.txt" + }, + "copyInDir": ".", + "copyOut": [], "copyOutCached": [ - "output/ex5_results.txt", - "output/ex5_logs.txt" + "driver", + "p2", + "p2-msan" ], "copyOutMax": 0, "copyOutDir": "", @@ -73,7 +229,119 @@ }, "parsers": [ { - "name": "diff", + "name": "result-detail", + "with": { + "time": false, + "mem": false, + "stdout": false, + "stderr": true, + "exitstatus": true + } + }, + { + "name": "dummy", + "with": {} + }, + { + "name": "result-status", + "with": {} + } + ] + }, + { + "name": "File length check", + "group": null, + "executor": { + "name": "sandbox", + "with": { + "default": { + "args": [ + "./file-length", + "500", + "400", + "*.c", + "*.h" + ], + "env": [ + "PATH=/usr/bin:/bin:/usr/local/bin" + ], + "stdin": { + "src": null, + "content": "", + "fileId": null, + "name": null, + "max": 4194304, + "symlink": null, + "streamIn": false, + "streamOut": false, + "pipe": false + }, + "stdout": { + "src": null, + "content": null, + "fileId": null, + "name": "stdout", + "max": 4096, + "symlink": null, + "streamIn": false, + "streamOut": false, + "pipe": false + }, + "stderr": { + "src": null, + "content": null, + "fileId": null, + "name": "stderr", + "max": 4096, + "symlink": null, + "streamIn": false, + "streamOut": false, + "pipe": false + }, + "cpuLimit": 4000000000, + "realCpuLimit": 0, + "clockLimit": 8000000000, + "memoryLimit": 4194304, + "stackLimit": 0, + "procLimit": 50, + "cpuRateLimit": 0, + "cpuSetLimit": "", + "copyIn": { + "tools/file-length": { + "src": "/home/tt/.config/joj/tools/file-length", + "content": null, + "fileId": null, + "name": null, + "max": 4194304, + "symlink": null, + "streamIn": false, + "streamOut": false, + "pipe": false + } + }, + "copyInCached": { + "tools/file-length": "tools/file-length" + }, + "copyInDir": ".", + "copyOut": [], + "copyOutCached": [], + "copyOutMax": 0, + "copyOutDir": "", + "tty": false, + "strictMemoryLimit": false, + "dataSegmentLimit": false, + "addressSpaceLimit": false + }, + "cases": [] + } + }, + "parsers": [ + { + "name": "keyword", + "with": {} + }, + { + "name": "dummy", "with": {} }, { @@ -82,65 +350,361 @@ "time": false, "mem": false, "stdout": false, - "stderr": true + "stderr": true, + "exitstatus": false } } ] }, { - "name": "judge_base2", - "group": "hw3 ex5", + "name": "Clang-tidy checks", + "group": null, "executor": { "name": "sandbox", "with": { "default": { "args": [ - "./matlab-joj", - "./h3/ex5.m" + "run-clang-tidy-18", + "-header-filter=.*", + "-quiet", + "-load=/usr/local/lib/libcodequality.so", + "-p", + "build" ], - "env": [], - "stdin": null, - "stdout": null, - "stderr": null, - "cpuLimit": 0, + "env": [ + "PATH=/usr/bin:/bin:/usr/local/bin" + ], + "stdin": { + "src": null, + "content": "", + "fileId": null, + "name": null, + "max": 4194304, + "symlink": null, + "streamIn": false, + "streamOut": false, + "pipe": false + }, + "stdout": { + "src": null, + "content": null, + "fileId": null, + "name": "stdout", + "max": 4096, + "symlink": null, + "streamIn": false, + "streamOut": false, + "pipe": false + }, + "stderr": { + "src": null, + "content": null, + "fileId": null, + "name": "stderr", + "max": 4096, + "symlink": null, + "streamIn": false, + "streamOut": false, + "pipe": false + }, + "cpuLimit": 4000000000, "realCpuLimit": 0, - "clockLimit": 0, - "memoryLimit": 0, + "clockLimit": 8000000000, + "memoryLimit": 4194304, "stackLimit": 0, - "procLimit": 0, + "procLimit": 50, "cpuRateLimit": 0, "cpuSetLimit": "", - "copyIn": { - "tools/matlab-joj": { - "src": "tools/matlab-joj", - "content": null, - "fileId": null, - "name": null, - "max": null, - "symlink": null, - "streamIn": false, - "streamOut": false, - "pipe": false - }, - "tools/matlab_formatter.py": { - "src": "tools/matlab_formatter.py", - "content": null, - "fileId": null, - "name": null, - "max": null, - "symlink": null, - "streamIn": false, - "streamOut": false, - "pipe": false - } - }, + "copyIn": {}, "copyInCached": {}, "copyInDir": ".", "copyOut": [], - "copyOutCached": [ - "output/ex5_results2.txt", - "output/ex5_logs2.txt" + "copyOutCached": [], + "copyOutMax": 0, + "copyOutDir": "", + "tty": false, + "strictMemoryLimit": false, + "dataSegmentLimit": false, + "addressSpaceLimit": false + }, + "cases": [] + } + }, + "parsers": [ + { + "name": "clangtidy", + "with": {} + }, + { + "name": "dummy", + "with": {} + }, + { + "name": "result-detail", + "with": { + "time": false, + "mem": false, + "stdout": true, + "stderr": false, + "exitstatus": true + } + } + ] + }, + { + "name": "Cppcheck check", + "group": null, + "executor": { + "name": "sandbox", + "with": { + "default": { + "args": [ + "cppcheck", + "--template='{\"file\":\"{file}\",\"line\":{line},", + "\"column\":{column},", + "\"severity\":\"{severity}\",", + "\"message\":\"{message}\",", + "\"id\":\"{id}\"}'", + "--force", + "--enable=all", + "--quiet", + "./" ], + "env": [ + "PATH=/usr/bin:/bin:/usr/local/bin" + ], + "stdin": { + "src": null, + "content": "", + "fileId": null, + "name": null, + "max": 4194304, + "symlink": null, + "streamIn": false, + "streamOut": false, + "pipe": false + }, + "stdout": { + "src": null, + "content": null, + "fileId": null, + "name": "stdout", + "max": 4096, + "symlink": null, + "streamIn": false, + "streamOut": false, + "pipe": false + }, + "stderr": { + "src": null, + "content": null, + "fileId": null, + "name": "stderr", + "max": 4096, + "symlink": null, + "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": "cppcheck", + "with": {} + }, + { + "name": "dummy", + "with": {} + }, + { + "name": "result-detail", + "with": { + "time": false, + "mem": false, + "stdout": false, + "stderr": true, + "exitstatus": true + } + } + ] + }, + { + "name": "Cpplint check", + "group": null, + "executor": { + "name": "sandbox", + "with": { + "default": { + "args": [ + "cpplint", + "--linelength=120", + "--filter=-legal,-readability/casting,-whitespace,-runtime/printf,-runtime/threadsafe_fn,-readability/todo,-build/include_subdir,-build/header_guard", + "--recursive", + "--exclude=build", + "." + ], + "env": [ + "PATH=/usr/bin:/bin:/usr/local/bin" + ], + "stdin": { + "src": null, + "content": "", + "fileId": null, + "name": null, + "max": 4194304, + "symlink": null, + "streamIn": false, + "streamOut": false, + "pipe": false + }, + "stdout": { + "src": null, + "content": null, + "fileId": null, + "name": "stdout", + "max": 4096, + "symlink": null, + "streamIn": false, + "streamOut": false, + "pipe": false + }, + "stderr": { + "src": null, + "content": null, + "fileId": null, + "name": "stderr", + "max": 4096, + "symlink": null, + "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": "cpplint", + "with": {} + }, + { + "name": "dummy", + "with": {} + }, + { + "name": "result-detail", + "with": { + "time": false, + "mem": false, + "stdout": true, + "stderr": false, + "exitstatus": true + } + } + ] + }, + { + "name": "judge-base", + "group": "joj", + "executor": { + "name": "sandbox", + "with": { + "default": { + "args": [ + "./driver", + "./mumsh" + ], + "env": [ + "PATH=/usr/bin:/bin:/usr/local/bin" + ], + "stdin": { + "src": null, + "content": "", + "fileId": null, + "name": null, + "max": 4194304, + "symlink": null, + "streamIn": false, + "streamOut": false, + "pipe": false + }, + "stdout": { + "src": null, + "content": null, + "fileId": null, + "name": "stdout", + "max": 4096, + "symlink": null, + "streamIn": false, + "streamOut": false, + "pipe": false + }, + "stderr": { + "src": null, + "content": null, + "fileId": null, + "name": "stderr", + "max": 4096, + "symlink": null, + "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, @@ -156,13 +720,109 @@ "name": "diff", "with": {} }, + { + "name": "dummy", + "with": {} + }, { "name": "result-detail", "with": { "time": true, "mem": true, "stdout": false, - "stderr": false + "stderr": true, + "exitstatus": true + } + } + ] + }, + { + "name": "judge-msan", + "group": "joj", + "executor": { + "name": "sandbox", + "with": { + "default": { + "args": [ + "./driver", + "./mumsh-msan" + ], + "env": [ + "PATH=/usr/bin:/bin:/usr/local/bin" + ], + "stdin": { + "src": null, + "content": "", + "fileId": null, + "name": null, + "max": 4194304, + "symlink": null, + "streamIn": false, + "streamOut": false, + "pipe": false + }, + "stdout": { + "src": null, + "content": null, + "fileId": null, + "name": "stdout", + "max": 4096, + "symlink": null, + "streamIn": false, + "streamOut": false, + "pipe": false + }, + "stderr": { + "src": null, + "content": null, + "fileId": null, + "name": "stderr", + "max": 4096, + "symlink": null, + "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": "diff", + "with": {} + }, + { + "name": "dummy", + "with": {} + }, + { + "name": "result-detail", + "with": { + "time": true, + "mem": true, + "stdout": false, + "stderr": true, + "exitstatus": true } } ] @@ -170,10 +830,10 @@ ] }, "teapot": { - "logPath": "/home/tt/.cache/joint-teapot-debug.log", - "scoreboardPath": "scoreboard.csv", - "failedTablePath": "failed-table.md", - "gradingRepoName": "", + "logPath": "Homework-1-exercise-2-joint-teapot-debug.log", + "scoreboardPath": "Homework-1-exercise-2-scoreboard.csv", + "failedTablePath": "Homework-1-exercise-2-failed-table.md", + "gradingRepoName": "engr151-joj", "skipIssue": false, "skipScoreboard": false, "skipFailedTable": false diff --git a/tests/basic/task.toml b/tests/basic/task.toml index 0872079..ef299a4 100644 --- a/tests/basic/task.toml +++ b/tests/basic/task.toml @@ -1,30 +1,119 @@ -task = "hw3 ex5" +# general task configuration +task="Homework 1 exercise 2" # task name -[release] -deadline = "2024-10-18T23:59:00+08:00" +release.deadline = 2024-10-12 23:59:00+08:00 +release.stages = [ "compile" ] [[stages]] -name = "judge_base" -command = "./matlab-joj ./h3/ex5.m" -score = 100 -parsers = ["diff", "result-detail"] +name = "Compilation" +command = "make.sh" # eg. script running cmake commands +files.import = [ "tools/make.sh", "src/main.c", "src/task.h", "srcCMakelist.txt" ] +files.export = [ "driver", "p2", "p2-msan" ] +limit.cpu = 180 # p2 takes long to compile +limit.stderr = 128 -files.import = ["tools/matlab-joj", "tools/matlab_formatter.py"] -files.export = ["output/ex5_results.txt", "output/ex5_logs.txt"] - -result_detail.time = false -result_detail.mem = false -result_detail.stderr = true +# compile parsers +parsers = [ "result-detail", "dummy", "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 = "judge_base2" -command = "./matlab-joj ./h3/ex5.m" -score = 80 -parsers = ["diff", "result-detail"] +name = "File length check" +command = "./file-length 500 400 *.c *.h" # command to run +files.import = [ "tools/file-length" ] -files.import = ["tools/matlab-joj", "tools/matlab_formatter.py"] -files.export = ["output/ex5_results2.txt", "output/ex5_logs2.txt"] +parsers = [ "keyword", "dummy", "result-detail" ] +keyword.keyword = [ "max", "recommend"] # keywords caught by corresponding JOJ plugin +keyword.weight = [ 50, 20 ] # weight of each keyword +result-detail.exitstatus = false +result-detail.stderr = true +result-detail.time = false +result-detail.mem = false -result_detail.time = true -result_detail.mem = true -result_detail.stderr = false +[[stages]] +name = "Clang-tidy checks" +command = "run-clang-tidy-18 -header-filter=.* -quiet -load=/usr/local/lib/libcodequality.so -p build" +limit.stdout = 65 + +parsers = [ "clangtidy", "dummy", "result-detail" ] +clangtidy.keyword = [ "codequality-no-global-variables", "codequality-no-header-guard", "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" ] +clangtidy.weight = [10, 10, 50, 10, 5, 5, 10, 5, 5, 8, 5, 5, 5, 5, 8] +dummy.comment = "\n\n### Details\n" +result-detail.exitstatus = true +result-detail.stdout = true +result-detail.time = false +result-detail.mem = false + +[[stages]] +name = "Cppcheck check" +command = "cppcheck --template='{\"file\":\"{file}\",\"line\":{line}, \"column\":{column}, \"severity\":\"{severity}\", \"message\":\"{message}\", \"id\":\"{id}\"}' --force --enable=all --quiet ./" +limit.stderr = 65 + +parsers = [ "cppcheck", "dummy", "result-detail" ] +cppcheck.keyword = ["error", "warning", "portability", "performance", "style"] +cppcheck.weight = [20, 10, 15, 15, 10] +dummy.comment = "\n\n### Details\n" +result-detail.exitstatus = true +result-detail.stderr = true +result-detail.time = false +result-detail.mem = false + +[[stages]] +name = "Cpplint check" +command = "cpplint --linelength=120 --filter=-legal,-readability/casting,-whitespace,-runtime/printf,-runtime/threadsafe_fn,-readability/todo,-build/include_subdir,-build/header_guard --recursive --exclude=build ." +limit.stdout = 65 + +parsers = [ "cpplint", "dummy", "result-detail" ] +cpplint.keyword = [ "runtime", "readability", "build" ] +cpplint.weight = [ 10, 20, 15] +dummy.comment = "\n\n### Details\n" +result-detail.exitstatus = true +result-detail.stdout = true +result-detail.time = false +result-detail.mem = false + +[[stages]] +name = "judge-base" +command="./driver ./mumsh" +limit.cpu = 3 +limit.mem = 75 +score = 10 + +parsers = ["diff", "dummy", "result-detail"] +dummy.comment = "\n\n### Details\n" +result-detail.exitstatus = true +result-detail.stderr = true + +case4.score = 15 +case4.limit.cpu = 30 +case4.limit.mem = 10 +case4.limit.stdout = 8 + +case5.score = 25 + +case8.limit.stderr = 128 + +[[stages]] +name = "judge-msan" +command="./driver ./mumsh-msan" +limit.cpu = 10 # default cpu limit (in sec) for each test case +limit.mem = 500 # set default mem limit (in MB) for all OJ test cases +score = 10 +skip = ["case0", "case11"] + +parsers = ["diff", "dummy", "result-detail"] +dummy.comment = "\n\n### Details\n" +result-detail.exitstatus = true +result-detail.stderr = true + +case4.score = 15 +case4.limit.cpu = 30 +case4.limit.mem = 10 + +case5.diff.output.ignorespaces = false + +case6.diff.output.hide = true diff --git a/tests/immutable_file/.gitattributes b/tests/immutable_file/.gitattributes new file mode 100644 index 0000000..b910c4a --- /dev/null +++ b/tests/immutable_file/.gitattributes @@ -0,0 +1,33 @@ +*.avi filter=lfs diff=lfs merge=lfs -text +*.bz2 filter=lfs diff=lfs merge=lfs -text +*.djvu filter=lfs diff=lfs merge=lfs -text +*.doc filter=lfs diff=lfs merge=lfs -text +*.docx filter=lfs diff=lfs merge=lfs -text +*.epub filter=lfs diff=lfs merge=lfs -text +*.gz filter=lfs diff=lfs merge=lfs -text +*.ipynb filter=lfs diff=lfs merge=lfs -text +*.jpeg filter=lfs diff=lfs merge=lfs -text +*.JPEG filter=lfs diff=lfs merge=lfs -text +*.jpg filter=lfs diff=lfs merge=lfs -text +*.JPG filter=lfs diff=lfs merge=lfs -text +*.mkv filter=lfs diff=lfs merge=lfs -text +*.mp4 filter=lfs diff=lfs merge=lfs -text +*.ods filter=lfs diff=lfs merge=lfs -text +*.odt filter=lfs diff=lfs merge=lfs -text +*.otf filter=lfs diff=lfs merge=lfs -text +*.pdf filter=lfs diff=lfs merge=lfs -text +*.PDF filter=lfs diff=lfs merge=lfs -text +*.png filter=lfs diff=lfs merge=lfs -text +*.PNG filter=lfs diff=lfs merge=lfs -text +*.ppt filter=lfs diff=lfs merge=lfs -text +*.pptx filter=lfs diff=lfs merge=lfs -text +*.ps filter=lfs diff=lfs merge=lfs -text +*.rar filter=lfs diff=lfs merge=lfs -text +*.tar filter=lfs diff=lfs merge=lfs -text +*.tgz filter=lfs diff=lfs merge=lfs -text +*.ttf filter=lfs diff=lfs merge=lfs -text +*.webm filter=lfs diff=lfs merge=lfs -text +*.xls filter=lfs diff=lfs merge=lfs -text +*.xlsx filter=lfs diff=lfs merge=lfs -text +*.xz filter=lfs diff=lfs merge=lfs -text +*.zip filter=lfs diff=lfs merge=lfs -text diff --git a/tests/immutable_file/.gitignore b/tests/immutable_file/.gitignore new file mode 100644 index 0000000..754f776 --- /dev/null +++ b/tests/immutable_file/.gitignore @@ -0,0 +1,23 @@ +################################ +## White list based gitignore ## +################################ + +# forbidden +* +.* + +# allowed +!.gitignore +!.gitattributes +!.gitea/ +!.gitea/issue_template/ +!.gitea/workflows/ +!*.yaml +!Makefile +!CMakeLists.txt +!h[0-8]/ +!*.m +!*.c +!*.cpp +!*.h +!*.md diff --git a/tests/immutable_file/push.yaml b/tests/immutable_file/push.yaml new file mode 100644 index 0000000..2f890b6 --- /dev/null +++ b/tests/immutable_file/push.yaml @@ -0,0 +1,18 @@ +name: Run JOJ3 on Push +on: [push] +jobs: + run: + container: + image: focs.ji.sjtu.edu.cn:5000/gitea/runner-images:focs-ubuntu-latest-slim + volumes: + - /home/tt/.config:/home/tt/.config + - /home/tt/.cache:/home/tt/.cache + - /home/tt/.ssh:/home/tt/.ssh + steps: + - name: Check out repository code + uses: https://gitea.com/BoYanZh/checkout@focs + with: + fetch-depth: 0 + - name: run joj3 + run: | + sudo -E -u tt joj3 -conf-root /home/tt/.config/joj diff --git a/tests/immutable_file/release.yaml b/tests/immutable_file/release.yaml new file mode 100644 index 0000000..afd2838 --- /dev/null +++ b/tests/immutable_file/release.yaml @@ -0,0 +1,20 @@ +name: Run JOJ3 on Release +on: + release: + types: [published] +jobs: + run: + container: + image: focs.ji.sjtu.edu.cn:5000/gitea/runner-images:focs-ubuntu-latest-slim + volumes: + - /home/tt/.config:/home/tt/.config + - /home/tt/.cache:/home/tt/.cache + - /home/tt/.ssh:/home/tt/.ssh + steps: + - name: Check out repository code + uses: https://gitea.com/BoYanZh/checkout@focs + with: + fetch-depth: 0 + - name: run joj3 + run: | + sudo -E -u tt joj3 -conf-root /home/tt/.config/joj -msg "feat(h1-release): joj on ${{ github.ref }}" From c51606e14f3cea9ae431623048cc68565eb40ab2 Mon Sep 17 00:00:00 2001 From: Nuvole Date: Wed, 23 Oct 2024 22:37:52 +0800 Subject: [PATCH 02/17] feat: finish keyword related --- joj3_config_generator/convert.py | 17 +++ joj3_config_generator/lib/task.py | 20 +++ joj3_config_generator/main.py | 1 - joj3_config_generator/models/task.py | 5 +- tests/basic/task.json | 184 ++++++++++++++++++++++++--- tests/basic/task.toml | 2 +- 6 files changed, 210 insertions(+), 19 deletions(-) create mode 100644 joj3_config_generator/lib/task.py diff --git a/joj3_config_generator/convert.py b/joj3_config_generator/convert.py index a74fde1..b15681a 100644 --- a/joj3_config_generator/convert.py +++ b/joj3_config_generator/convert.py @@ -1,4 +1,5 @@ from joj3_config_generator.lib.repo import getHealthcheckConfig, getTeapotConfig +from joj3_config_generator.lib.task import fix_keyword from joj3_config_generator.models import ( Cmd, CmdFile, @@ -17,6 +18,7 @@ from joj3_config_generator.models import ( # FIXME: LLM generated convert function, only for demostration def convert(repo_conf: Repo, task_conf: Task) -> ResultConfig: # Create the base ResultConf object + # FIXME: wrap things in functions result_conf = ResultConfig( name=task_conf.task, # TODO: specify the exact folder difference @@ -80,6 +82,7 @@ def convert(repo_conf: Repo, task_conf: Task) -> ResultConfig: ParserConfig(name=parser, with_={}) for parser in task_stage.parsers ], ) + # TODO: fix all parser here if "result-detail" in task_stage.parsers: result_detail_parser = next( p for p in conf_stage.parsers if p.name == "result-detail" @@ -87,6 +90,20 @@ def convert(repo_conf: Repo, task_conf: Task) -> ResultConfig: if task_stage.result_detail is not None: result_detail_parser.with_.update(task_stage.result_detail) + if "dummy" in task_stage.parsers: + dummy_parser = next(p for p in conf_stage.parsers if p.name == "dummy") + if task_stage.dummy is not None: + dummy_parser.with_.update(task_stage.dummy) + + if "result-status" in task_stage.parsers: + result_status_parser = next( + p for p in conf_stage.parsers if p.name == "result-status" + ) + if task_stage.result_status is not None: + result_status_parser.with_.update(task_stage.result_status) + + conf_stage = fix_keyword(task_stage, conf_stage) + result_conf.stage.stages.append(conf_stage) return result_conf diff --git a/joj3_config_generator/lib/task.py b/joj3_config_generator/lib/task.py new file mode 100644 index 0000000..c8bffeb --- /dev/null +++ b/joj3_config_generator/lib/task.py @@ -0,0 +1,20 @@ +from joj3_config_generator.models.result import Stage as ResultStage +from joj3_config_generator.models.task import Stage as TaskStage + + +def fix_keyword(task_stage: TaskStage, conf_stage: ResultStage) -> ResultStage: + keyword_parser = ["clangtidy", "keyword", "cppcheck"] # TODO: may add cpplint + for parser in task_stage.parsers: + if parser in keyword_parser: + keyword_parser_ = next(p for p in conf_stage.parsers if p.name == parser) + keyword_weight = [] + if getattr(task_stage, parser, None) is not None: + for _, keyword in enumerate(getattr(task_stage, parser).keyword): + keyword_weight.append({"keyword": [keyword], "score": 0}) + for idx, weight in enumerate(getattr(task_stage, parser).weight): + keyword_weight[idx]["score"] = weight + + keyword_parser_.with_.update({"match": keyword_weight}) + else: + continue + return conf_stage diff --git a/joj3_config_generator/main.py b/joj3_config_generator/main.py index cae2d3b..a8ee683 100644 --- a/joj3_config_generator/main.py +++ b/joj3_config_generator/main.py @@ -54,7 +54,6 @@ def convert(root: Path = Path(".")) -> None: task_toml = task_file.read() repo_obj = rtoml.loads(repo_toml) task_obj = rtoml.loads(task_toml) - print(task_obj) result_model = convert_conf(Repo(**repo_obj), Task(**task_obj)) result_dict = result_model.model_dump(by_alias=True) with open(result_json_path, "w") as result_file: diff --git a/joj3_config_generator/models/task.py b/joj3_config_generator/models/task.py index 3bf8dec..8d9520b 100644 --- a/joj3_config_generator/models/task.py +++ b/joj3_config_generator/models/task.py @@ -17,8 +17,8 @@ class ParserDummy(BaseModel): class ParserKeyword(BaseModel): - keyword: Optional[list[str]] = None - weight: Optional[list[int]] = None + keyword: Optional[list[str]] = [] + weight: Optional[list[int]] = [] class Files(BaseModel): @@ -41,6 +41,7 @@ class Stage(BaseModel): parsers: list[str] # list of parsers limit: Optional[Limit] = None dummy: Optional[ParserDummy] = ParserDummy() + result_status: Optional[ParserDummy] = Field(ParserDummy(), alias="result-status") keyword: Optional[ParserKeyword] = ParserKeyword() clangtidy: Optional[ParserKeyword] = ParserKeyword() cppcheck: Optional[ParserKeyword] = ParserKeyword() diff --git a/tests/basic/task.json b/tests/basic/task.json index ae81205..dcf13ea 100644 --- a/tests/basic/task.json +++ b/tests/basic/task.json @@ -15,12 +15,15 @@ "with": { "default": { "args": [ - "/tmp/repo-health-checker", + "//repo-health-checker", "-root=.", "-repoSize=50.5", "-meta=main.py", "-meta=README.md", - "-checkFileSumList=a5b63323a692d3d8b952442969649b4f823d58dae26429494f613df160710dfc,b1bbad25b830db0a77b15a033f9ca1b7ab44c1d2d05056412bd3e4421645f0bf,8d1229900c6fc6711b5cc141d1ab5ea7f5b7b7a4b921d9cfa3957408b43ae723,eb857bcd94857cedc4045cb2d6ba04cb5bbb3daf188abc95fb9478db823ef47e", + "-checkFileSumList=a5b63323a692d3d8b952442969649b4f823d58dae26429494f613df160710dfc,b1bbad25b830db0a77b15a033f9ca1b7ab44c1d2d05056412bd3e4421645f0bf,1965adff52af61da8b9e089ff580d60f7e4c294a2930b9809c5cbdf76528de4d,c8bd62bf5297bac738b3845612fd595d677884093070904375463ab7953fce28", "-checkFileNameList=.gitignore,.gitattributes,push.yaml,release.yaml" ], "env": [ @@ -68,8 +71,8 @@ "cpuRateLimit": 0, "cpuSetLimit": "", "copyIn": { - "/tmp/repo-health-checker": { - "src": "/tmp/repo-health-checker", + "//tmp/repo-checker-90ztqsoq/repo-health-checker": { + "src": "//tmp/repo-checker-41mcx5_x/repo-health-checker", "content": null, "fileId": null, "name": null, @@ -240,11 +243,15 @@ }, { "name": "dummy", - "with": {} + "with": { + "comment": "\n\n### Details\n" + } }, { "name": "result-status", - "with": {} + "with": { + "comment": "Congratulations! Your code compiled successfully." + } } ] }, @@ -338,11 +345,28 @@ "parsers": [ { "name": "keyword", - "with": {} + "with": { + "match": [ + { + "keyword": [ + "max" + ], + "score": 50 + }, + { + "keyword": [ + "recommend" + ], + "score": 20 + } + ] + } }, { "name": "dummy", - "with": {} + "with": { + "comment": "" + } }, { "name": "result-detail", @@ -433,11 +457,100 @@ "parsers": [ { "name": "clangtidy", - "with": {} + "with": { + "match": [ + { + "keyword": [ + "codequality-no-global-variables" + ], + "score": 10 + }, + { + "keyword": [ + "codequality-no-header-guard" + ], + "score": 10 + }, + { + "keyword": [ + "readability-function-size" + ], + "score": 50 + }, + { + "keyword": [ + "readability-duplicate-include" + ], + "score": 10 + }, + { + "keyword": [ + "readability-identifier-naming" + ], + "score": 5 + }, + { + "keyword": [ + "readability-redundant" + ], + "score": 5 + }, + { + "keyword": [ + "readability-misleading-indentation" + ], + "score": 10 + }, + { + "keyword": [ + "readability-misplaced-array-index" + ], + "score": 5 + }, + { + "keyword": [ + "cppcoreguidelines-init-variables" + ], + "score": 5 + }, + { + "keyword": [ + "bugprone-suspicious-string-compare" + ], + "score": 8 + }, + { + "keyword": [ + "google-global-names-in-headers" + ], + "score": 5 + }, + { + "keyword": [ + "clang-diagnostic" + ], + "score": 5 + }, + { + "keyword": [ + "clang-analyzer" + ], + "score": 5 + }, + { + "keyword": [ + "misc performance" + ], + "score": 5 + } + ] + } }, { "name": "dummy", - "with": {} + "with": { + "comment": "\n\n### Details\n" + } }, { "name": "result-detail", @@ -532,11 +645,46 @@ "parsers": [ { "name": "cppcheck", - "with": {} + "with": { + "match": [ + { + "keyword": [ + "error" + ], + "score": 20 + }, + { + "keyword": [ + "warning" + ], + "score": 10 + }, + { + "keyword": [ + "portability" + ], + "score": 15 + }, + { + "keyword": [ + "performance" + ], + "score": 15 + }, + { + "keyword": [ + "style" + ], + "score": 10 + } + ] + } }, { "name": "dummy", - "with": {} + "with": { + "comment": "\n\n### Details\n" + } }, { "name": "result-detail", @@ -631,7 +779,9 @@ }, { "name": "dummy", - "with": {} + "with": { + "comment": "\n\n### Details\n" + } }, { "name": "result-detail", @@ -722,7 +872,9 @@ }, { "name": "dummy", - "with": {} + "with": { + "comment": "\n\n### Details\n" + } }, { "name": "result-detail", @@ -813,7 +965,9 @@ }, { "name": "dummy", - "with": {} + "with": { + "comment": "\n\n### Details\n" + } }, { "name": "result-detail", diff --git a/tests/basic/task.toml b/tests/basic/task.toml index ef299a4..48dfd07 100644 --- a/tests/basic/task.toml +++ b/tests/basic/task.toml @@ -41,7 +41,7 @@ limit.stdout = 65 parsers = [ "clangtidy", "dummy", "result-detail" ] clangtidy.keyword = [ "codequality-no-global-variables", "codequality-no-header-guard", "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" ] -clangtidy.weight = [10, 10, 50, 10, 5, 5, 10, 5, 5, 8, 5, 5, 5, 5, 8] +clangtidy.weight = [10, 10, 50, 10, 5, 5, 10, 5, 5, 8, 5, 5, 5, 5] dummy.comment = "\n\n### Details\n" result-detail.exitstatus = true result-detail.stdout = true From ef980cf905b7ed719219af175a40c1bb5b2f5939 Mon Sep 17 00:00:00 2001 From: Nuvole Date: Wed, 23 Oct 2024 22:45:25 +0800 Subject: [PATCH 03/17] feat: combine dummy & result-staus --- joj3_config_generator/convert.py | 15 ++------------- joj3_config_generator/lib/task.py | 12 ++++++++++++ 2 files changed, 14 insertions(+), 13 deletions(-) diff --git a/joj3_config_generator/convert.py b/joj3_config_generator/convert.py index b15681a..37318a6 100644 --- a/joj3_config_generator/convert.py +++ b/joj3_config_generator/convert.py @@ -1,5 +1,5 @@ from joj3_config_generator.lib.repo import getHealthcheckConfig, getTeapotConfig -from joj3_config_generator.lib.task import fix_keyword +from joj3_config_generator.lib.task import fix_comment, fix_keyword from joj3_config_generator.models import ( Cmd, CmdFile, @@ -90,18 +90,7 @@ def convert(repo_conf: Repo, task_conf: Task) -> ResultConfig: if task_stage.result_detail is not None: result_detail_parser.with_.update(task_stage.result_detail) - if "dummy" in task_stage.parsers: - dummy_parser = next(p for p in conf_stage.parsers if p.name == "dummy") - if task_stage.dummy is not None: - dummy_parser.with_.update(task_stage.dummy) - - if "result-status" in task_stage.parsers: - result_status_parser = next( - p for p in conf_stage.parsers if p.name == "result-status" - ) - if task_stage.result_status is not None: - result_status_parser.with_.update(task_stage.result_status) - + conf_stage = fix_comment(task_stage, conf_stage) conf_stage = fix_keyword(task_stage, conf_stage) result_conf.stage.stages.append(conf_stage) diff --git a/joj3_config_generator/lib/task.py b/joj3_config_generator/lib/task.py index c8bffeb..3b8208c 100644 --- a/joj3_config_generator/lib/task.py +++ b/joj3_config_generator/lib/task.py @@ -18,3 +18,15 @@ def fix_keyword(task_stage: TaskStage, conf_stage: ResultStage) -> ResultStage: else: continue return conf_stage + + +def fix_comment(task_stage: TaskStage, conf_stage: ResultStage) -> ResultStage: + comment_parser = ["dummy", "result-status"] + for parser in task_stage.parsers: + if parser in comment_parser: + comment_parser_ = next(p for p in conf_stage.parsers if p.name == parser) + if getattr(task_stage, parser, None) is not None: + comment_parser_.with_.update(getattr(task_stage, parser)) + else: + continue + return conf_stage From f158e1cab6bf9990a9032ef741a1c885dc341df5 Mon Sep 17 00:00:00 2001 From: Nuvole Date: Wed, 23 Oct 2024 22:55:31 +0800 Subject: [PATCH 04/17] fix: result-status --- joj3_config_generator/convert.py | 12 ++++++++++++ joj3_config_generator/lib/task.py | 6 ++++-- tests/basic/task.json | 6 +++--- 3 files changed, 19 insertions(+), 5 deletions(-) diff --git a/joj3_config_generator/convert.py b/joj3_config_generator/convert.py index 37318a6..bd469a0 100644 --- a/joj3_config_generator/convert.py +++ b/joj3_config_generator/convert.py @@ -90,6 +90,18 @@ def convert(repo_conf: Repo, task_conf: Task) -> ResultConfig: if task_stage.result_detail is not None: result_detail_parser.with_.update(task_stage.result_detail) + if "dummy" in task_stage.parsers: + dummy_parser = next(p for p in conf_stage.parsers if p.name == "dummy") + if task_stage.dummy is not None: + dummy_parser.with_.update(task_stage.dummy) + + if "result-status" in task_stage.parsers: + result_status_parser = next( + p for p in conf_stage.parsers if p.name == "result-status" + ) + if task_stage.result_status is not None: + result_status_parser.with_.update(task_stage.result_status) + conf_stage = fix_comment(task_stage, conf_stage) conf_stage = fix_keyword(task_stage, conf_stage) diff --git a/joj3_config_generator/lib/task.py b/joj3_config_generator/lib/task.py index 3b8208c..a5b0d36 100644 --- a/joj3_config_generator/lib/task.py +++ b/joj3_config_generator/lib/task.py @@ -25,8 +25,10 @@ def fix_comment(task_stage: TaskStage, conf_stage: ResultStage) -> ResultStage: for parser in task_stage.parsers: if parser in comment_parser: comment_parser_ = next(p for p in conf_stage.parsers if p.name == parser) - if getattr(task_stage, parser, None) is not None: - comment_parser_.with_.update(getattr(task_stage, parser)) + if getattr(task_stage, parser.replace("-", "_"), None) is not None: + comment_parser_.with_.update( + getattr(task_stage, parser.replace("-", "_")) + ) else: continue return conf_stage diff --git a/tests/basic/task.json b/tests/basic/task.json index dcf13ea..83c624a 100644 --- a/tests/basic/task.json +++ b/tests/basic/task.json @@ -18,7 +18,7 @@ "//repo-health-checker", + "0x7fbd328431a0>/repo-health-checker", "-root=.", "-repoSize=50.5", "-meta=main.py", @@ -71,8 +71,8 @@ "cpuRateLimit": 0, "cpuSetLimit": "", "copyIn": { - "//tmp/repo-checker-90ztqsoq/repo-health-checker": { - "src": "//tmp/repo-checker-41mcx5_x/repo-health-checker", + "//tmp/repo-checker-04l9les6/repo-health-checker": { + "src": "//tmp/repo-checker-_34sofm5/repo-health-checker", "content": null, "fileId": null, "name": null, From ab0786aeb1420b6f809d70bdc51758b23a733da7 Mon Sep 17 00:00:00 2001 From: Nuvole Date: Wed, 23 Oct 2024 22:55:55 +0800 Subject: [PATCH 05/17] chore: trim old code --- joj3_config_generator/convert.py | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/joj3_config_generator/convert.py b/joj3_config_generator/convert.py index bd469a0..37318a6 100644 --- a/joj3_config_generator/convert.py +++ b/joj3_config_generator/convert.py @@ -90,18 +90,6 @@ def convert(repo_conf: Repo, task_conf: Task) -> ResultConfig: if task_stage.result_detail is not None: result_detail_parser.with_.update(task_stage.result_detail) - if "dummy" in task_stage.parsers: - dummy_parser = next(p for p in conf_stage.parsers if p.name == "dummy") - if task_stage.dummy is not None: - dummy_parser.with_.update(task_stage.dummy) - - if "result-status" in task_stage.parsers: - result_status_parser = next( - p for p in conf_stage.parsers if p.name == "result-status" - ) - if task_stage.result_status is not None: - result_status_parser.with_.update(task_stage.result_status) - conf_stage = fix_comment(task_stage, conf_stage) conf_stage = fix_keyword(task_stage, conf_stage) From 9652ef9b78af143e678d396257a08742774ba48b Mon Sep 17 00:00:00 2001 From: Nuvole Date: Wed, 23 Oct 2024 22:56:50 +0800 Subject: [PATCH 06/17] chore: trim old code --- joj3_config_generator/lib/task.py | 6 +++++- tests/basic/task.json | 19 +++++++++++++++---- 2 files changed, 20 insertions(+), 5 deletions(-) diff --git a/joj3_config_generator/lib/task.py b/joj3_config_generator/lib/task.py index a5b0d36..deb3c27 100644 --- a/joj3_config_generator/lib/task.py +++ b/joj3_config_generator/lib/task.py @@ -21,7 +21,11 @@ def fix_keyword(task_stage: TaskStage, conf_stage: ResultStage) -> ResultStage: def fix_comment(task_stage: TaskStage, conf_stage: ResultStage) -> ResultStage: - comment_parser = ["dummy", "result-status"] + comment_parser = [ + "dummy", + "result-status", + "cpplint", + ] # FIXME: determine where cpplint should be for parser in task_stage.parsers: if parser in comment_parser: comment_parser_ = next(p for p in conf_stage.parsers if p.name == parser) diff --git a/tests/basic/task.json b/tests/basic/task.json index 83c624a..a42375b 100644 --- a/tests/basic/task.json +++ b/tests/basic/task.json @@ -18,7 +18,7 @@ "//repo-health-checker", + "0x7ff2358271a0>/repo-health-checker", "-root=.", "-repoSize=50.5", "-meta=main.py", @@ -71,8 +71,8 @@ "cpuRateLimit": 0, "cpuSetLimit": "", "copyIn": { - "//tmp/repo-checker-04l9les6/repo-health-checker": { - "src": "//tmp/repo-checker-_34sofm5/repo-health-checker", + "//tmp/repo-checker-3qi07atp/repo-health-checker": { + "src": "//tmp/repo-checker-ebujap5a/repo-health-checker", "content": null, "fileId": null, "name": null, @@ -775,7 +775,18 @@ "parsers": [ { "name": "cpplint", - "with": {} + "with": { + "keyword": [ + "runtime", + "readability", + "build" + ], + "weight": [ + 10, + 20, + 15 + ] + } }, { "name": "dummy", From 779fcaa63cc0581df691be409e3971a700132cb7 Mon Sep 17 00:00:00 2001 From: Nuvole Date: Wed, 23 Oct 2024 23:30:41 +0800 Subject: [PATCH 07/17] fix: result_detail parser --- joj3_config_generator/convert.py | 12 +--- joj3_config_generator/lib/task.py | 31 ++++++++++ joj3_config_generator/models/task.py | 4 +- tests/basic/task.json | 87 +++++++++++++++++++++------- 4 files changed, 104 insertions(+), 30 deletions(-) diff --git a/joj3_config_generator/convert.py b/joj3_config_generator/convert.py index 37318a6..271cc86 100644 --- a/joj3_config_generator/convert.py +++ b/joj3_config_generator/convert.py @@ -1,5 +1,5 @@ from joj3_config_generator.lib.repo import getHealthcheckConfig, getTeapotConfig -from joj3_config_generator.lib.task import fix_comment, fix_keyword +from joj3_config_generator.lib.task import fix_comment, fix_keyword, fix_result_detail from joj3_config_generator.models import ( Cmd, CmdFile, @@ -82,16 +82,10 @@ def convert(repo_conf: Repo, task_conf: Task) -> ResultConfig: ParserConfig(name=parser, with_={}) for parser in task_stage.parsers ], ) - # TODO: fix all parser here - if "result-detail" in task_stage.parsers: - result_detail_parser = next( - p for p in conf_stage.parsers if p.name == "result-detail" - ) - if task_stage.result_detail is not None: - result_detail_parser.with_.update(task_stage.result_detail) - + conf_stage = fix_result_detail(task_stage, conf_stage) conf_stage = fix_comment(task_stage, conf_stage) conf_stage = fix_keyword(task_stage, conf_stage) + # TODO: fix diff parser here result_conf.stage.stages.append(conf_stage) diff --git a/joj3_config_generator/lib/task.py b/joj3_config_generator/lib/task.py index deb3c27..900749b 100644 --- a/joj3_config_generator/lib/task.py +++ b/joj3_config_generator/lib/task.py @@ -20,6 +20,37 @@ def fix_keyword(task_stage: TaskStage, conf_stage: ResultStage) -> ResultStage: return conf_stage +def fix_result_detail(task_stage: TaskStage, conf_stage: ResultStage) -> ResultStage: + if "result-detail" in task_stage.parsers: + result_detail_parser = next( + p for p in conf_stage.parsers if p.name == "result-detail" + ) + if task_stage.result_detail is not None: + show_files = [] + if ( + task_stage.result_detail.stdout + and task_stage.result_detail.stdout is not None + ): + show_files.append("stdout") + if ( + task_stage.result_detail.stderr + and task_stage.result_detail.stderr is not None + ): + show_files.append("stderr") + result_detail_parser.with_.update( + { + "score": 0, + "comment": "", + "showFiles": show_files, + "showExitStatus": task_stage.result_detail.exitstatus, + "showRuntime": task_stage.result_detail.time, + "showMemory": task_stage.result_detail.mem, + } + ) + + return conf_stage + + def fix_comment(task_stage: TaskStage, conf_stage: ResultStage) -> ResultStage: comment_parser = [ "dummy", diff --git a/joj3_config_generator/models/task.py b/joj3_config_generator/models/task.py index 8d9520b..8bcd8c9 100644 --- a/joj3_config_generator/models/task.py +++ b/joj3_config_generator/models/task.py @@ -45,7 +45,9 @@ class Stage(BaseModel): keyword: Optional[ParserKeyword] = ParserKeyword() clangtidy: Optional[ParserKeyword] = ParserKeyword() cppcheck: Optional[ParserKeyword] = ParserKeyword() - cpplint: Optional[ParserKeyword] = ParserKeyword() + # FIXME: determine cpplint type + # cpplint: Optional[ParserKeyword] = ParserKeyword() + cpplint: Optional[ParserDummy] = ParserDummy() result_detail: Optional[ParserResultDetail] = Field( ParserResultDetail(), alias="result-detail" ) diff --git a/tests/basic/task.json b/tests/basic/task.json index a42375b..f6f5ea7 100644 --- a/tests/basic/task.json +++ b/tests/basic/task.json @@ -18,7 +18,7 @@ "//repo-health-checker", + "0x7fd3bed4f1a0>/repo-health-checker", "-root=.", "-repoSize=50.5", "-meta=main.py", @@ -71,8 +71,8 @@ "cpuRateLimit": 0, "cpuSetLimit": "", "copyIn": { - "//tmp/repo-checker-3qi07atp/repo-health-checker": { - "src": "//tmp/repo-checker-ebujap5a/repo-health-checker", + "//tmp/repo-checker-9z61g608/repo-health-checker": { + "src": "//tmp/repo-checker-19d98f6u/repo-health-checker", "content": null, "fileId": null, "name": null, @@ -238,7 +238,15 @@ "mem": false, "stdout": false, "stderr": true, - "exitstatus": true + "exitstatus": true, + "score": 0, + "comment": "", + "showFiles": [ + "stderr" + ], + "showExitStatus": true, + "showRuntime": false, + "showMemory": false } }, { @@ -375,7 +383,15 @@ "mem": false, "stdout": false, "stderr": true, - "exitstatus": false + "exitstatus": false, + "score": 0, + "comment": "", + "showFiles": [ + "stderr" + ], + "showExitStatus": false, + "showRuntime": false, + "showMemory": false } } ] @@ -559,7 +575,15 @@ "mem": false, "stdout": true, "stderr": false, - "exitstatus": true + "exitstatus": true, + "score": 0, + "comment": "", + "showFiles": [ + "stdout" + ], + "showExitStatus": true, + "showRuntime": false, + "showMemory": false } } ] @@ -693,7 +717,15 @@ "mem": false, "stdout": false, "stderr": true, - "exitstatus": true + "exitstatus": true, + "score": 0, + "comment": "", + "showFiles": [ + "stderr" + ], + "showExitStatus": true, + "showRuntime": false, + "showMemory": false } } ] @@ -776,16 +808,7 @@ { "name": "cpplint", "with": { - "keyword": [ - "runtime", - "readability", - "build" - ], - "weight": [ - 10, - 20, - 15 - ] + "comment": "" } }, { @@ -801,7 +824,15 @@ "mem": false, "stdout": true, "stderr": false, - "exitstatus": true + "exitstatus": true, + "score": 0, + "comment": "", + "showFiles": [ + "stdout" + ], + "showExitStatus": true, + "showRuntime": false, + "showMemory": false } } ] @@ -894,7 +925,15 @@ "mem": true, "stdout": false, "stderr": true, - "exitstatus": true + "exitstatus": true, + "score": 0, + "comment": "", + "showFiles": [ + "stderr" + ], + "showExitStatus": true, + "showRuntime": true, + "showMemory": true } } ] @@ -987,7 +1026,15 @@ "mem": true, "stdout": false, "stderr": true, - "exitstatus": true + "exitstatus": true, + "score": 0, + "comment": "", + "showFiles": [ + "stderr" + ], + "showExitStatus": true, + "showRuntime": true, + "showMemory": true } } ] From 79c9233c9a7f1605d3904f934434166fedf48ba1 Mon Sep 17 00:00:00 2001 From: Nuvole Date: Sat, 26 Oct 2024 13:49:07 +0800 Subject: [PATCH 08/17] feat: cases data reading for diff --- joj3_config_generator/convert.py | 31 ++++++++++++---- joj3_config_generator/lib/task.py | 55 +++++++++++++++++----------- joj3_config_generator/main.py | 2 + joj3_config_generator/models/task.py | 35 +++++++++++++++--- tests/basic/task.json | 51 ++++---------------------- tests/basic/task.toml | 2 +- 6 files changed, 98 insertions(+), 78 deletions(-) diff --git a/joj3_config_generator/convert.py b/joj3_config_generator/convert.py index 271cc86..557f093 100644 --- a/joj3_config_generator/convert.py +++ b/joj3_config_generator/convert.py @@ -1,5 +1,10 @@ from joj3_config_generator.lib.repo import getHealthcheckConfig, getTeapotConfig -from joj3_config_generator.lib.task import fix_comment, fix_keyword, fix_result_detail +from joj3_config_generator.lib.task import ( + fix_comment, + fix_diff, + fix_keyword, + fix_result_detail, +) from joj3_config_generator.models import ( Cmd, CmdFile, @@ -17,6 +22,7 @@ from joj3_config_generator.models import ( # FIXME: LLM generated convert function, only for demostration def convert(repo_conf: Repo, task_conf: Task) -> ResultConfig: + print(task_conf) # Create the base ResultConf object # FIXME: wrap things in functions result_conf = ResultConfig( @@ -54,9 +60,12 @@ def convert(repo_conf: Repo, task_conf: Task) -> ResultConfig: and (task_stage.files is not None) else [] ) + # TODO: the global limit field executor_with_config = ExecutorWithConfig( default=Cmd( - args=task_stage.command.split(), + args=( + task_stage.command.split() if task_stage.command is not None else [] + ), copy_in={ file: CmdFile(src=f"/home/tt/.config/joj/{file}") for file in copy_in_files @@ -71,22 +80,28 @@ def convert(repo_conf: Repo, task_conf: Task) -> ResultConfig: if file not in cached: cached.append(file) conf_stage = Stage( - name=task_stage.name, + name=task_stage.name if task_stage.name is not None else "", # TODO: we may have cq in future - group="joj" if "judge" in task_stage.name else None, + group=( + "joj" + if (task_stage.name is not None) and ("judge" in task_stage.name) + else None + ), executor=ExecutorConfig( name="sandbox", with_=executor_with_config, ), - parsers=[ - ParserConfig(name=parser, with_={}) for parser in task_stage.parsers - ], + parsers=( + [ParserConfig(name=parser, with_={}) for parser in task_stage.parsers] + if task_stage.parsers is not None + else [] + ), ) conf_stage = fix_result_detail(task_stage, conf_stage) conf_stage = fix_comment(task_stage, conf_stage) conf_stage = fix_keyword(task_stage, conf_stage) # TODO: fix diff parser here - + conf_stage = fix_diff(task_stage, conf_stage) result_conf.stage.stages.append(conf_stage) return result_conf diff --git a/joj3_config_generator/lib/task.py b/joj3_config_generator/lib/task.py index 900749b..d8d2f78 100644 --- a/joj3_config_generator/lib/task.py +++ b/joj3_config_generator/lib/task.py @@ -1,27 +1,32 @@ +import rtoml + from joj3_config_generator.models.result import Stage as ResultStage from joj3_config_generator.models.task import Stage as TaskStage def fix_keyword(task_stage: TaskStage, conf_stage: ResultStage) -> ResultStage: keyword_parser = ["clangtidy", "keyword", "cppcheck"] # TODO: may add cpplint - for parser in task_stage.parsers: - if parser in keyword_parser: - keyword_parser_ = next(p for p in conf_stage.parsers if p.name == parser) - keyword_weight = [] - if getattr(task_stage, parser, None) is not None: - for _, keyword in enumerate(getattr(task_stage, parser).keyword): - keyword_weight.append({"keyword": [keyword], "score": 0}) - for idx, weight in enumerate(getattr(task_stage, parser).weight): - keyword_weight[idx]["score"] = weight + if task_stage.parsers is not None: + for parser in task_stage.parsers: + if parser in keyword_parser: + keyword_parser_ = next( + p for p in conf_stage.parsers if p.name == parser + ) + keyword_weight = [] + if getattr(task_stage, parser, None) is not None: + for _, keyword in enumerate(getattr(task_stage, parser).keyword): + keyword_weight.append({"keyword": [keyword], "score": 0}) + for idx, weight in enumerate(getattr(task_stage, parser).weight): + keyword_weight[idx]["score"] = weight - keyword_parser_.with_.update({"match": keyword_weight}) - else: - continue + keyword_parser_.with_.update({"match": keyword_weight}) + else: + continue return conf_stage def fix_result_detail(task_stage: TaskStage, conf_stage: ResultStage) -> ResultStage: - if "result-detail" in task_stage.parsers: + if (task_stage.parsers is not None) and ("result-detail" in task_stage.parsers): result_detail_parser = next( p for p in conf_stage.parsers if p.name == "result-detail" ) @@ -57,13 +62,21 @@ def fix_comment(task_stage: TaskStage, conf_stage: ResultStage) -> ResultStage: "result-status", "cpplint", ] # FIXME: determine where cpplint should be - for parser in task_stage.parsers: - if parser in comment_parser: - comment_parser_ = next(p for p in conf_stage.parsers if p.name == parser) - if getattr(task_stage, parser.replace("-", "_"), None) is not None: - comment_parser_.with_.update( - getattr(task_stage, parser.replace("-", "_")) + if task_stage.parsers is not None: + for parser in task_stage.parsers: + if parser in comment_parser: + comment_parser_ = next( + p for p in conf_stage.parsers if p.name == parser ) - else: - continue + if getattr(task_stage, parser.replace("-", "_"), None) is not None: + comment_parser_.with_.update( + getattr(task_stage, parser.replace("-", "_")) + ) + else: + continue + return conf_stage + + +def fix_diff(task_stage: TaskStage, conf_stage: ResultStage) -> ResultStage: + return conf_stage diff --git a/joj3_config_generator/main.py b/joj3_config_generator/main.py index a8ee683..9ded0c6 100644 --- a/joj3_config_generator/main.py +++ b/joj3_config_generator/main.py @@ -7,6 +7,8 @@ import rtoml import typer from joj3_config_generator.convert import convert as convert_conf + +# from joj3_config_generator.lib.task import get_processed_task_obj from joj3_config_generator.models import Repo, Task from joj3_config_generator.utils.logger import logger diff --git a/joj3_config_generator/models/task.py b/joj3_config_generator/models/task.py index 8bcd8c9..a819900 100644 --- a/joj3_config_generator/models/task.py +++ b/joj3_config_generator/models/task.py @@ -1,7 +1,7 @@ from datetime import datetime -from typing import Optional +from typing import Any, Dict, Optional, Type -from pydantic import BaseModel, Field +from pydantic import BaseModel, Field, root_validator class ParserResultDetail(BaseModel): @@ -21,6 +21,17 @@ class ParserKeyword(BaseModel): weight: Optional[list[int]] = [] +class Outputs(BaseModel): + score: Optional[int] = 0 + ignorespaces: Optional[bool] = False + hide: Optional[bool] = False + forcequit: Optional[bool] = True + + +class ParserDiff(BaseModel): + output: Optional[Outputs] = Outputs() + + class Files(BaseModel): import_: Optional[list[str]] = Field([], alias="import") export: Optional[list[str]] = [] @@ -34,11 +45,11 @@ class Limit(BaseModel): class Stage(BaseModel): - name: str # Stage name - command: str # Command to run + name: Optional[str] = None # Stage name + command: Optional[str] = None # Command to run files: Optional[Files] = None score: Optional[int] = 0 - parsers: list[str] # list of parsers + parsers: Optional[list[str]] = [] # list of parsers limit: Optional[Limit] = None dummy: Optional[ParserDummy] = ParserDummy() result_status: Optional[ParserDummy] = Field(ParserDummy(), alias="result-status") @@ -51,6 +62,20 @@ class Stage(BaseModel): result_detail: Optional[ParserResultDetail] = Field( ParserResultDetail(), alias="result-detail" ) + skip: Optional[list[str]] = [] + diff: Optional[ParserDiff] = ParserDiff() + cases: Optional[Dict[str, "Stage"]] = {} + + class Config: + extra = "allow" + + @root_validator(pre=True) + def gather_cases(cls: Type["Stage"], values: Dict[str, Any]) -> Dict[str, Any]: + cases = {k: v for k, v in values.items() if k.startswith("case")} + for key in cases: + values.pop(key) + values["cases"] = {k: Stage(**v) for k, v in cases.items()} + return values class Release(BaseModel): diff --git a/tests/basic/task.json b/tests/basic/task.json index f6f5ea7..d80e014 100644 --- a/tests/basic/task.json +++ b/tests/basic/task.json @@ -1,6 +1,6 @@ { - "name": "Homework 1 exercise 2", - "logPath": "Homework-1-exercise-2.log", + "name": "h4 ex1", + "logPath": "h4-ex1.log", "expireUnixTimestamp": 1728748740, "stage": { "sandboxExecServer": "172.17.0.1:5051", @@ -18,7 +18,7 @@ "//repo-health-checker", + "0x7f932c5e31a0>/repo-health-checker", "-root=.", "-repoSize=50.5", "-meta=main.py", @@ -71,8 +71,8 @@ "cpuRateLimit": 0, "cpuSetLimit": "", "copyIn": { - "//tmp/repo-checker-9z61g608/repo-health-checker": { - "src": "//tmp/repo-checker-19d98f6u/repo-health-checker", + "//tmp/repo-checker-tw0902sa/repo-health-checker": { + "src": "//tmp/repo-checker-4sy3g0ro/repo-health-checker", "content": null, "fileId": null, "name": null, @@ -234,11 +234,6 @@ { "name": "result-detail", "with": { - "time": false, - "mem": false, - "stdout": false, - "stderr": true, - "exitstatus": true, "score": 0, "comment": "", "showFiles": [ @@ -379,11 +374,6 @@ { "name": "result-detail", "with": { - "time": false, - "mem": false, - "stdout": false, - "stderr": true, - "exitstatus": false, "score": 0, "comment": "", "showFiles": [ @@ -571,11 +561,6 @@ { "name": "result-detail", "with": { - "time": false, - "mem": false, - "stdout": true, - "stderr": false, - "exitstatus": true, "score": 0, "comment": "", "showFiles": [ @@ -713,11 +698,6 @@ { "name": "result-detail", "with": { - "time": false, - "mem": false, - "stdout": false, - "stderr": true, - "exitstatus": true, "score": 0, "comment": "", "showFiles": [ @@ -820,11 +800,6 @@ { "name": "result-detail", "with": { - "time": false, - "mem": false, - "stdout": true, - "stderr": false, - "exitstatus": true, "score": 0, "comment": "", "showFiles": [ @@ -921,11 +896,6 @@ { "name": "result-detail", "with": { - "time": true, - "mem": true, - "stdout": false, - "stderr": true, - "exitstatus": true, "score": 0, "comment": "", "showFiles": [ @@ -1022,11 +992,6 @@ { "name": "result-detail", "with": { - "time": true, - "mem": true, - "stdout": false, - "stderr": true, - "exitstatus": true, "score": 0, "comment": "", "showFiles": [ @@ -1042,9 +1007,9 @@ ] }, "teapot": { - "logPath": "Homework-1-exercise-2-joint-teapot-debug.log", - "scoreboardPath": "Homework-1-exercise-2-scoreboard.csv", - "failedTablePath": "Homework-1-exercise-2-failed-table.md", + "logPath": "h4-ex1-joint-teapot-debug.log", + "scoreboardPath": "h4-ex1-scoreboard.csv", + "failedTablePath": "h4-ex1-failed-table.md", "gradingRepoName": "engr151-joj", "skipIssue": false, "skipScoreboard": false, diff --git a/tests/basic/task.toml b/tests/basic/task.toml index 48dfd07..ec4cdfc 100644 --- a/tests/basic/task.toml +++ b/tests/basic/task.toml @@ -1,5 +1,5 @@ # general task configuration -task="Homework 1 exercise 2" # task name +task="h4 ex1" # task name release.deadline = 2024-10-12 23:59:00+08:00 release.stages = [ "compile" ] From f86f820884a75b905a6f0247cb053e85124e676e Mon Sep 17 00:00:00 2001 From: Nuvole Date: Sat, 26 Oct 2024 15:00:46 +0800 Subject: [PATCH 09/17] ffeat: diff finish --- joj3_config_generator/convert.py | 3 - joj3_config_generator/lib/task.py | 69 ++++++ joj3_config_generator/models/task.py | 2 +- tests/basic/task.json | 324 ++++++++++++++++++++++++++- 4 files changed, 387 insertions(+), 11 deletions(-) diff --git a/joj3_config_generator/convert.py b/joj3_config_generator/convert.py index 557f093..c0cfbf7 100644 --- a/joj3_config_generator/convert.py +++ b/joj3_config_generator/convert.py @@ -20,9 +20,7 @@ from joj3_config_generator.models import ( ) -# FIXME: LLM generated convert function, only for demostration def convert(repo_conf: Repo, task_conf: Task) -> ResultConfig: - print(task_conf) # Create the base ResultConf object # FIXME: wrap things in functions result_conf = ResultConfig( @@ -100,7 +98,6 @@ def convert(repo_conf: Repo, task_conf: Task) -> ResultConfig: conf_stage = fix_result_detail(task_stage, conf_stage) conf_stage = fix_comment(task_stage, conf_stage) conf_stage = fix_keyword(task_stage, conf_stage) - # TODO: fix diff parser here conf_stage = fix_diff(task_stage, conf_stage) result_conf.stage.stages.append(conf_stage) diff --git a/joj3_config_generator/lib/task.py b/joj3_config_generator/lib/task.py index d8d2f78..35aa92b 100644 --- a/joj3_config_generator/lib/task.py +++ b/joj3_config_generator/lib/task.py @@ -1,5 +1,6 @@ import rtoml +from joj3_config_generator.models.result import CmdFile, OptionalCmd from joj3_config_generator.models.result import Stage as ResultStage from joj3_config_generator.models.task import Stage as TaskStage @@ -78,5 +79,73 @@ def fix_comment(task_stage: TaskStage, conf_stage: ResultStage) -> ResultStage: def fix_diff(task_stage: TaskStage, conf_stage: ResultStage) -> ResultStage: + if task_stage.parsers is not None and "diff" in task_stage.parsers: + diff_parser = next((p for p in conf_stage.parsers if p.name == "diff"), None) + skip = task_stage.skip or [] + cases = task_stage.cases or {} + finalized_cases = [case for case in cases if case not in skip] + + stage_cases = [] + parser_cases = [] + + for case in finalized_cases: + case_stage = task_stage.cases.get(case) if task_stage.cases else None + if not case_stage: + continue + + # Ensure case_stage.limit is defined before accessing .cpu and .mem + cpu_limit = ( + case_stage.limit.cpu * 1_000_000_000 + if case_stage.limit and case_stage.limit.cpu is not None + else 0 + ) + clock_limit = ( + 2 * case_stage.limit.cpu * 1_000_000_000 + if case_stage.limit and case_stage.limit.cpu is not None + else 0 + ) + memory_limit = ( + case_stage.limit.mem * 1_024 * 1_024 + if case_stage.limit and case_stage.limit.mem is not None + else 0 + ) + + stage_cases.append( + OptionalCmd( + stdin=CmdFile( + src=f"/home/tt/.config/joj/{conf_stage.name}/{case}.in" + ), + cpu_limit=cpu_limit, + clock_limit=clock_limit, + memory_limit=memory_limit, + proc_limit=50, + ) + ) + + # Ensure case_stage.diff and case_stage.diff.output are defined + diff_output = ( + case_stage.diff.output + if case_stage.diff and case_stage.diff.output + else None + ) + if diff_output: + parser_cases.append( + { + "outputs": [ + { + "score": diff_output.score, + "fileName": "stdout", + "answerPath": f"/home/tt/.config/joj/{conf_stage.name}/{case}.out", + "forceQuitOnDiff": diff_output.forcequit, + "alwaysHide": diff_output.hide, + "compareSpace": not diff_output.ignorespaces, + } + ] + } + ) + + if diff_parser and task_stage.diff is not None: + diff_parser.with_.update({"name": "diff", "cases": parser_cases}) + conf_stage.executor.with_.cases = stage_cases return conf_stage diff --git a/joj3_config_generator/models/task.py b/joj3_config_generator/models/task.py index a819900..9d49747 100644 --- a/joj3_config_generator/models/task.py +++ b/joj3_config_generator/models/task.py @@ -50,7 +50,7 @@ class Stage(BaseModel): files: Optional[Files] = None score: Optional[int] = 0 parsers: Optional[list[str]] = [] # list of parsers - limit: Optional[Limit] = None + limit: Optional[Limit] = Limit() dummy: Optional[ParserDummy] = ParserDummy() result_status: Optional[ParserDummy] = Field(ParserDummy(), alias="result-status") keyword: Optional[ParserKeyword] = ParserKeyword() diff --git a/tests/basic/task.json b/tests/basic/task.json index d80e014..793bc48 100644 --- a/tests/basic/task.json +++ b/tests/basic/task.json @@ -18,7 +18,7 @@ "//repo-health-checker", + "0x7f67094f3240>/repo-health-checker", "-root=.", "-repoSize=50.5", "-meta=main.py", @@ -71,8 +71,8 @@ "cpuRateLimit": 0, "cpuSetLimit": "", "copyIn": { - "//tmp/repo-checker-tw0902sa/repo-health-checker": { - "src": "//tmp/repo-checker-4sy3g0ro/repo-health-checker", + "//tmp/repo-checker-9gy9931v/repo-health-checker": { + "src": "//tmp/repo-checker-kjnt9uw0/repo-health-checker", "content": null, "fileId": null, "name": null, @@ -879,13 +879,168 @@ "dataSegmentLimit": false, "addressSpaceLimit": false }, - "cases": [] + "cases": [ + { + "args": null, + "env": [ + "PATH=/usr/bin:/bin:/usr/local/bin" + ], + "stdin": { + "src": "/home/tt/.config/joj/judge-base/case4.in", + "content": null, + "fileId": null, + "name": null, + "max": 4194304, + "symlink": null, + "streamIn": false, + "streamOut": false, + "pipe": false + }, + "stdout": null, + "stderr": null, + "cpuLimit": 30000000000, + "realCpuLimit": null, + "clockLimit": 60000000000, + "memoryLimit": 10485760, + "stackLimit": null, + "procLimit": 50, + "cpuRateLimit": null, + "cpuSetLimit": null, + "copyIn": null, + "copyInCached": null, + "copyInDir": null, + "copyOut": null, + "copyOutCached": null, + "copyOutMax": null, + "copyOutDir": null, + "tty": null, + "strictMemoryLimit": null, + "dataSegmentLimit": null, + "addressSpaceLimit": null + }, + { + "args": null, + "env": [ + "PATH=/usr/bin:/bin:/usr/local/bin" + ], + "stdin": { + "src": "/home/tt/.config/joj/judge-base/case5.in", + "content": null, + "fileId": null, + "name": null, + "max": 4194304, + "symlink": null, + "streamIn": false, + "streamOut": false, + "pipe": false + }, + "stdout": null, + "stderr": null, + "cpuLimit": 4000000000, + "realCpuLimit": null, + "clockLimit": 8000000000, + "memoryLimit": 4194304, + "stackLimit": null, + "procLimit": 50, + "cpuRateLimit": null, + "cpuSetLimit": null, + "copyIn": null, + "copyInCached": null, + "copyInDir": null, + "copyOut": null, + "copyOutCached": null, + "copyOutMax": null, + "copyOutDir": null, + "tty": null, + "strictMemoryLimit": null, + "dataSegmentLimit": null, + "addressSpaceLimit": null + }, + { + "args": null, + "env": [ + "PATH=/usr/bin:/bin:/usr/local/bin" + ], + "stdin": { + "src": "/home/tt/.config/joj/judge-base/case8.in", + "content": null, + "fileId": null, + "name": null, + "max": 4194304, + "symlink": null, + "streamIn": false, + "streamOut": false, + "pipe": false + }, + "stdout": null, + "stderr": null, + "cpuLimit": 4000000000, + "realCpuLimit": null, + "clockLimit": 8000000000, + "memoryLimit": 4194304, + "stackLimit": null, + "procLimit": 50, + "cpuRateLimit": null, + "cpuSetLimit": null, + "copyIn": null, + "copyInCached": null, + "copyInDir": null, + "copyOut": null, + "copyOutCached": null, + "copyOutMax": null, + "copyOutDir": null, + "tty": null, + "strictMemoryLimit": null, + "dataSegmentLimit": null, + "addressSpaceLimit": null + } + ] } }, "parsers": [ { "name": "diff", - "with": {} + "with": { + "name": "diff", + "cases": [ + { + "outputs": [ + { + "score": 0, + "fileName": "stdout", + "answerPath": "/home/tt/.config/joj/judge-base/case4.out", + "forceQuitOnDiff": true, + "alwaysHide": false, + "compareSpace": true + } + ] + }, + { + "outputs": [ + { + "score": 0, + "fileName": "stdout", + "answerPath": "/home/tt/.config/joj/judge-base/case5.out", + "forceQuitOnDiff": true, + "alwaysHide": false, + "compareSpace": true + } + ] + }, + { + "outputs": [ + { + "score": 0, + "fileName": "stdout", + "answerPath": "/home/tt/.config/joj/judge-base/case8.out", + "forceQuitOnDiff": true, + "alwaysHide": false, + "compareSpace": true + } + ] + } + ] + } }, { "name": "dummy", @@ -975,13 +1130,168 @@ "dataSegmentLimit": false, "addressSpaceLimit": false }, - "cases": [] + "cases": [ + { + "args": null, + "env": [ + "PATH=/usr/bin:/bin:/usr/local/bin" + ], + "stdin": { + "src": "/home/tt/.config/joj/judge-msan/case4.in", + "content": null, + "fileId": null, + "name": null, + "max": 4194304, + "symlink": null, + "streamIn": false, + "streamOut": false, + "pipe": false + }, + "stdout": null, + "stderr": null, + "cpuLimit": 30000000000, + "realCpuLimit": null, + "clockLimit": 60000000000, + "memoryLimit": 10485760, + "stackLimit": null, + "procLimit": 50, + "cpuRateLimit": null, + "cpuSetLimit": null, + "copyIn": null, + "copyInCached": null, + "copyInDir": null, + "copyOut": null, + "copyOutCached": null, + "copyOutMax": null, + "copyOutDir": null, + "tty": null, + "strictMemoryLimit": null, + "dataSegmentLimit": null, + "addressSpaceLimit": null + }, + { + "args": null, + "env": [ + "PATH=/usr/bin:/bin:/usr/local/bin" + ], + "stdin": { + "src": "/home/tt/.config/joj/judge-msan/case5.in", + "content": null, + "fileId": null, + "name": null, + "max": 4194304, + "symlink": null, + "streamIn": false, + "streamOut": false, + "pipe": false + }, + "stdout": null, + "stderr": null, + "cpuLimit": 4000000000, + "realCpuLimit": null, + "clockLimit": 8000000000, + "memoryLimit": 4194304, + "stackLimit": null, + "procLimit": 50, + "cpuRateLimit": null, + "cpuSetLimit": null, + "copyIn": null, + "copyInCached": null, + "copyInDir": null, + "copyOut": null, + "copyOutCached": null, + "copyOutMax": null, + "copyOutDir": null, + "tty": null, + "strictMemoryLimit": null, + "dataSegmentLimit": null, + "addressSpaceLimit": null + }, + { + "args": null, + "env": [ + "PATH=/usr/bin:/bin:/usr/local/bin" + ], + "stdin": { + "src": "/home/tt/.config/joj/judge-msan/case6.in", + "content": null, + "fileId": null, + "name": null, + "max": 4194304, + "symlink": null, + "streamIn": false, + "streamOut": false, + "pipe": false + }, + "stdout": null, + "stderr": null, + "cpuLimit": 4000000000, + "realCpuLimit": null, + "clockLimit": 8000000000, + "memoryLimit": 4194304, + "stackLimit": null, + "procLimit": 50, + "cpuRateLimit": null, + "cpuSetLimit": null, + "copyIn": null, + "copyInCached": null, + "copyInDir": null, + "copyOut": null, + "copyOutCached": null, + "copyOutMax": null, + "copyOutDir": null, + "tty": null, + "strictMemoryLimit": null, + "dataSegmentLimit": null, + "addressSpaceLimit": null + } + ] } }, "parsers": [ { "name": "diff", - "with": {} + "with": { + "name": "diff", + "cases": [ + { + "outputs": [ + { + "score": 0, + "fileName": "stdout", + "answerPath": "/home/tt/.config/joj/judge-msan/case4.out", + "forceQuitOnDiff": true, + "alwaysHide": false, + "compareSpace": true + } + ] + }, + { + "outputs": [ + { + "score": 0, + "fileName": "stdout", + "answerPath": "/home/tt/.config/joj/judge-msan/case5.out", + "forceQuitOnDiff": true, + "alwaysHide": false, + "compareSpace": true + } + ] + }, + { + "outputs": [ + { + "score": 0, + "fileName": "stdout", + "answerPath": "/home/tt/.config/joj/judge-msan/case6.out", + "forceQuitOnDiff": true, + "alwaysHide": true, + "compareSpace": true + } + ] + } + ] + } }, { "name": "dummy", From 919a2dfb9c7755c1a770113f97f54fa223185af4 Mon Sep 17 00:00:00 2001 From: Nuvole Date: Sat, 26 Oct 2024 15:28:29 +0800 Subject: [PATCH 10/17] chore: more compact code --- joj3_config_generator/convert.py | 60 ++--------------- joj3_config_generator/lib/task.py | 104 +++++++++++++++++++++++++++++- tests/basic/task.json | 50 +++++++------- 3 files changed, 133 insertions(+), 81 deletions(-) diff --git a/joj3_config_generator/convert.py b/joj3_config_generator/convert.py index c0cfbf7..554c625 100644 --- a/joj3_config_generator/convert.py +++ b/joj3_config_generator/convert.py @@ -4,6 +4,8 @@ from joj3_config_generator.lib.task import ( fix_diff, fix_keyword, fix_result_detail, + get_conf_stage, + get_executorWithConfig, ) from joj3_config_generator.models import ( Cmd, @@ -22,7 +24,6 @@ from joj3_config_generator.models import ( def convert(repo_conf: Repo, task_conf: Task) -> ResultConfig: # Create the base ResultConf object - # FIXME: wrap things in functions result_conf = ResultConfig( name=task_conf.task, # TODO: specify the exact folder difference @@ -39,62 +40,11 @@ def convert(repo_conf: Repo, task_conf: Task) -> ResultConfig: # Construct healthcheck stage healthcheck_stage = getHealthcheckConfig(repo_conf, task_conf) result_conf.stage.stages.append(healthcheck_stage) - cached = [] + cached: list[str] = [] # Convert each stage in the task configuration for task_stage in task_conf.stages: - file_import = ( - task_stage.files.import_ - if hasattr(task_stage, "files") - and hasattr(task_stage.files, "import_") - and (task_stage.files is not None) - and (task_stage.files.import_ is not None) - else [] - ) - copy_in_files = [file for file in file_import if (file not in cached)] - file_export = ( - task_stage.files.export - if hasattr(task_stage, "files") - and hasattr(task_stage.files, "export") - and (task_stage.files is not None) - else [] - ) - # TODO: the global limit field - executor_with_config = ExecutorWithConfig( - default=Cmd( - args=( - task_stage.command.split() if task_stage.command is not None else [] - ), - copy_in={ - file: CmdFile(src=f"/home/tt/.config/joj/{file}") - for file in copy_in_files - }, - copy_in_cached={file: file for file in copy_in_files}, - copy_out_cached=file_export if file_export is not None else [], - ), - cases=[], # You can add cases if needed - ) - if file_export is not None: - for file in file_export: - if file not in cached: - cached.append(file) - conf_stage = Stage( - name=task_stage.name if task_stage.name is not None else "", - # TODO: we may have cq in future - group=( - "joj" - if (task_stage.name is not None) and ("judge" in task_stage.name) - else None - ), - executor=ExecutorConfig( - name="sandbox", - with_=executor_with_config, - ), - parsers=( - [ParserConfig(name=parser, with_={}) for parser in task_stage.parsers] - if task_stage.parsers is not None - else [] - ), - ) + executor_with_config, cached = get_executorWithConfig(task_stage, cached) + conf_stage = get_conf_stage(task_stage, executor_with_config) conf_stage = fix_result_detail(task_stage, conf_stage) conf_stage = fix_comment(task_stage, conf_stage) conf_stage = fix_keyword(task_stage, conf_stage) diff --git a/joj3_config_generator/lib/task.py b/joj3_config_generator/lib/task.py index 35aa92b..6ff56d7 100644 --- a/joj3_config_generator/lib/task.py +++ b/joj3_config_generator/lib/task.py @@ -1,10 +1,112 @@ +from typing import Tuple + import rtoml -from joj3_config_generator.models.result import CmdFile, OptionalCmd +from joj3_config_generator.models import ( + ExecutorConfig, + ExecutorWithConfig, + ParserConfig, +) +from joj3_config_generator.models.result import Cmd, CmdFile, OptionalCmd from joj3_config_generator.models.result import Stage as ResultStage from joj3_config_generator.models.task import Stage as TaskStage +def get_conf_stage( + task_stage: TaskStage, executor_with_config: ExecutorWithConfig +) -> ResultStage: + conf_stage = ResultStage( + name=task_stage.name if task_stage.name is not None else "", + # TODO: we may have cq in future + group=( + "joj" + if (task_stage.name is not None) and ("judge" in task_stage.name) + else None + ), + executor=ExecutorConfig( + name="sandbox", + with_=executor_with_config, + ), + parsers=( + [ParserConfig(name=parser, with_={}) for parser in task_stage.parsers] + if task_stage.parsers is not None + else [] + ), + ) + return conf_stage + + +def get_executorWithConfig( + task_stage: TaskStage, cached: list[str] +) -> Tuple[ExecutorWithConfig, list[str]]: + file_import = ( + task_stage.files.import_ + if hasattr(task_stage, "files") + and hasattr(task_stage.files, "import_") + and (task_stage.files is not None) + and (task_stage.files.import_ is not None) + else [] + ) + copy_in_files = [file for file in file_import if (file not in cached)] + file_export = ( + task_stage.files.export + if hasattr(task_stage, "files") + and hasattr(task_stage.files, "export") + and (task_stage.files is not None) + else [] + ) + executor_with_config = ExecutorWithConfig( + default=Cmd( + args=(task_stage.command.split() if task_stage.command is not None else []), + copy_in={ + file: CmdFile(src=f"/home/tt/.config/joj/{file}") + for file in copy_in_files + }, + copy_in_cached={file: file for file in copy_in_files}, + copy_out_cached=file_export if file_export is not None else [], + cpu_limit=( + task_stage.limit.cpu * 1_000_000_000 + if task_stage.limit is not None and task_stage.limit.cpu is not None + else 4 * 1_000_000_000 + ), + clock_limit=( + 2 * task_stage.limit.cpu * 1_000_000_000 + if task_stage.limit is not None and task_stage.limit.cpu is not None + else 8 * 1_000_000_000 + ), + memory_limit=( + task_stage.limit.mem * 1_024 * 1_024 + if task_stage.limit is not None and task_stage.limit.mem is not None + else 4 * 1_024 * 1_024 + ), + stderr=CmdFile( + name="stderr", + max=( + task_stage.limit.stderr * 1_000_000_000 + if task_stage.limit is not None + and task_stage.limit.stderr is not None + else 4 * 1_024 * 1_024 + ), + ), + stdout=CmdFile( + name="stdout", + max=( + task_stage.limit.stdout * 1_000_000_000 + if task_stage.limit is not None + and task_stage.limit.stdout is not None + else 4 * 1_024 * 1_024 + ), + ), + ), + cases=[], # You can add cases if needed + ) + if file_export is not None: + for file in file_export: + if file not in cached: + cached.append(file) + return (executor_with_config, cached) + + def fix_keyword(task_stage: TaskStage, conf_stage: ResultStage) -> ResultStage: keyword_parser = ["clangtidy", "keyword", "cppcheck"] # TODO: may add cpplint if task_stage.parsers is not None: diff --git a/tests/basic/task.json b/tests/basic/task.json index 793bc48..0cc5ccf 100644 --- a/tests/basic/task.json +++ b/tests/basic/task.json @@ -18,7 +18,7 @@ "//repo-health-checker", + "0x7fc2485231a0>/repo-health-checker", "-root=.", "-repoSize=50.5", "-meta=main.py", @@ -71,8 +71,8 @@ "cpuRateLimit": 0, "cpuSetLimit": "", "copyIn": { - "//tmp/repo-checker-9gy9931v/repo-health-checker": { - "src": "//tmp/repo-checker-kjnt9uw0/repo-health-checker", + "//tmp/repo-checker-5xkj4dm4/repo-health-checker": { + "src": "//tmp/repo-checker-k3fmck15/repo-health-checker", "content": null, "fileId": null, "name": null, @@ -136,7 +136,7 @@ "content": null, "fileId": null, "name": "stdout", - "max": 4096, + "max": 4000000000, "symlink": null, "streamIn": false, "streamOut": false, @@ -147,15 +147,15 @@ "content": null, "fileId": null, "name": "stderr", - "max": 4096, + "max": 128000000000, "symlink": null, "streamIn": false, "streamOut": false, "pipe": false }, - "cpuLimit": 4000000000, + "cpuLimit": 180000000000, "realCpuLimit": 0, - "clockLimit": 8000000000, + "clockLimit": 360000000000, "memoryLimit": 4194304, "stackLimit": 0, "procLimit": 50, @@ -291,7 +291,7 @@ "content": null, "fileId": null, "name": "stdout", - "max": 4096, + "max": 4000000000, "symlink": null, "streamIn": false, "streamOut": false, @@ -302,7 +302,7 @@ "content": null, "fileId": null, "name": "stderr", - "max": 4096, + "max": 4000000000, "symlink": null, "streamIn": false, "streamOut": false, @@ -420,7 +420,7 @@ "content": null, "fileId": null, "name": "stdout", - "max": 4096, + "max": 65000000000, "symlink": null, "streamIn": false, "streamOut": false, @@ -431,7 +431,7 @@ "content": null, "fileId": null, "name": "stderr", - "max": 4096, + "max": 4000000000, "symlink": null, "streamIn": false, "streamOut": false, @@ -611,7 +611,7 @@ "content": null, "fileId": null, "name": "stdout", - "max": 4096, + "max": 4000000000, "symlink": null, "streamIn": false, "streamOut": false, @@ -622,7 +622,7 @@ "content": null, "fileId": null, "name": "stderr", - "max": 4096, + "max": 65000000000, "symlink": null, "streamIn": false, "streamOut": false, @@ -744,7 +744,7 @@ "content": null, "fileId": null, "name": "stdout", - "max": 4096, + "max": 65000000000, "symlink": null, "streamIn": false, "streamOut": false, @@ -755,7 +755,7 @@ "content": null, "fileId": null, "name": "stderr", - "max": 4096, + "max": 4000000000, "symlink": null, "streamIn": false, "streamOut": false, @@ -842,7 +842,7 @@ "content": null, "fileId": null, "name": "stdout", - "max": 4096, + "max": 4000000000, "symlink": null, "streamIn": false, "streamOut": false, @@ -853,16 +853,16 @@ "content": null, "fileId": null, "name": "stderr", - "max": 4096, + "max": 4000000000, "symlink": null, "streamIn": false, "streamOut": false, "pipe": false }, - "cpuLimit": 4000000000, + "cpuLimit": 3000000000, "realCpuLimit": 0, - "clockLimit": 8000000000, - "memoryLimit": 4194304, + "clockLimit": 6000000000, + "memoryLimit": 78643200, "stackLimit": 0, "procLimit": 50, "cpuRateLimit": 0, @@ -1093,7 +1093,7 @@ "content": null, "fileId": null, "name": "stdout", - "max": 4096, + "max": 4000000000, "symlink": null, "streamIn": false, "streamOut": false, @@ -1104,16 +1104,16 @@ "content": null, "fileId": null, "name": "stderr", - "max": 4096, + "max": 4000000000, "symlink": null, "streamIn": false, "streamOut": false, "pipe": false }, - "cpuLimit": 4000000000, + "cpuLimit": 10000000000, "realCpuLimit": 0, - "clockLimit": 8000000000, - "memoryLimit": 4194304, + "clockLimit": 20000000000, + "memoryLimit": 524288000, "stackLimit": 0, "procLimit": 50, "cpuRateLimit": 0, From 4e344fdc6faa45a6314f981ae48eca1711c0f4b9 Mon Sep 17 00:00:00 2001 From: Nuvole Date: Sat, 26 Oct 2024 15:43:43 +0800 Subject: [PATCH 11/17] fix: gradingreponame schema --- joj3_config_generator/lib/repo.py | 11 +++-------- tests/basic/task.json | 8 ++++---- 2 files changed, 7 insertions(+), 12 deletions(-) diff --git a/joj3_config_generator/lib/repo.py b/joj3_config_generator/lib/repo.py index e9a8d33..1c39a0c 100644 --- a/joj3_config_generator/lib/repo.py +++ b/joj3_config_generator/lib/repo.py @@ -1,5 +1,5 @@ import hashlib -import os +import socket import tempfile from dotenv import load_dotenv @@ -24,13 +24,8 @@ def get_temp_directory() -> str: def getGradingRepoName() -> str: - path = os.path.expanduser("~/.config/teapot/teapot.env") - if os.path.exists(path): - load_dotenv(path) - repo_name = os.environ.get("GITEA_ORG_NAME") - if repo_name is not None: - return f"{repo_name.split('-')[0]}-joj" - return "ece482-joj" + host_name = socket.gethostname() + return f"{host_name.split('-')[0]}-joj" def getTeapotConfig(repo_conf: Repo, task_conf: Task) -> TeapotConfig: diff --git a/tests/basic/task.json b/tests/basic/task.json index 0cc5ccf..4ffc375 100644 --- a/tests/basic/task.json +++ b/tests/basic/task.json @@ -18,7 +18,7 @@ "//repo-health-checker", + "0x7fc3921ab1a0>/repo-health-checker", "-root=.", "-repoSize=50.5", "-meta=main.py", @@ -71,8 +71,8 @@ "cpuRateLimit": 0, "cpuSetLimit": "", "copyIn": { - "//tmp/repo-checker-5xkj4dm4/repo-health-checker": { - "src": "//tmp/repo-checker-k3fmck15/repo-health-checker", + "//tmp/repo-checker-u3awlhwg/repo-health-checker": { + "src": "//tmp/repo-checker-mc0n0t1l/repo-health-checker", "content": null, "fileId": null, "name": null, @@ -1320,7 +1320,7 @@ "logPath": "h4-ex1-joint-teapot-debug.log", "scoreboardPath": "h4-ex1-scoreboard.csv", "failedTablePath": "h4-ex1-failed-table.md", - "gradingRepoName": "engr151-joj", + "gradingRepoName": "Nuvole-joj", "skipIssue": false, "skipScoreboard": false, "skipFailedTable": false From f1e6a948c49aeb172bbf8e350a10905464f5028a Mon Sep 17 00:00:00 2001 From: Nuvole Date: Sat, 26 Oct 2024 15:46:30 +0800 Subject: [PATCH 12/17] fix: remove dotenv --- joj3_config_generator/lib/repo.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/joj3_config_generator/lib/repo.py b/joj3_config_generator/lib/repo.py index 1c39a0c..cb679c4 100644 --- a/joj3_config_generator/lib/repo.py +++ b/joj3_config_generator/lib/repo.py @@ -2,8 +2,6 @@ import hashlib import socket import tempfile -from dotenv import load_dotenv - from joj3_config_generator.models import ( Cmd, CmdFile, From bd2702e856972d5ce85dca6d92968374671c18be Mon Sep 17 00:00:00 2001 From: Nuvole Date: Sat, 26 Oct 2024 15:53:42 +0800 Subject: [PATCH 13/17] fix: immutable_file --- tests/immutable_file/.gitattributes | 33 ----------------------------- tests/immutable_file/.gitignore | 23 -------------------- tests/immutable_file/push.yaml | 18 ---------------- tests/immutable_file/release.yaml | 20 ----------------- 4 files changed, 94 deletions(-) delete mode 100644 tests/immutable_file/.gitattributes delete mode 100644 tests/immutable_file/.gitignore delete mode 100644 tests/immutable_file/push.yaml delete mode 100644 tests/immutable_file/release.yaml diff --git a/tests/immutable_file/.gitattributes b/tests/immutable_file/.gitattributes deleted file mode 100644 index b910c4a..0000000 --- a/tests/immutable_file/.gitattributes +++ /dev/null @@ -1,33 +0,0 @@ -*.avi filter=lfs diff=lfs merge=lfs -text -*.bz2 filter=lfs diff=lfs merge=lfs -text -*.djvu filter=lfs diff=lfs merge=lfs -text -*.doc filter=lfs diff=lfs merge=lfs -text -*.docx filter=lfs diff=lfs merge=lfs -text -*.epub filter=lfs diff=lfs merge=lfs -text -*.gz filter=lfs diff=lfs merge=lfs -text -*.ipynb filter=lfs diff=lfs merge=lfs -text -*.jpeg filter=lfs diff=lfs merge=lfs -text -*.JPEG filter=lfs diff=lfs merge=lfs -text -*.jpg filter=lfs diff=lfs merge=lfs -text -*.JPG filter=lfs diff=lfs merge=lfs -text -*.mkv filter=lfs diff=lfs merge=lfs -text -*.mp4 filter=lfs diff=lfs merge=lfs -text -*.ods filter=lfs diff=lfs merge=lfs -text -*.odt filter=lfs diff=lfs merge=lfs -text -*.otf filter=lfs diff=lfs merge=lfs -text -*.pdf filter=lfs diff=lfs merge=lfs -text -*.PDF filter=lfs diff=lfs merge=lfs -text -*.png filter=lfs diff=lfs merge=lfs -text -*.PNG filter=lfs diff=lfs merge=lfs -text -*.ppt filter=lfs diff=lfs merge=lfs -text -*.pptx filter=lfs diff=lfs merge=lfs -text -*.ps filter=lfs diff=lfs merge=lfs -text -*.rar filter=lfs diff=lfs merge=lfs -text -*.tar filter=lfs diff=lfs merge=lfs -text -*.tgz filter=lfs diff=lfs merge=lfs -text -*.ttf filter=lfs diff=lfs merge=lfs -text -*.webm filter=lfs diff=lfs merge=lfs -text -*.xls filter=lfs diff=lfs merge=lfs -text -*.xlsx filter=lfs diff=lfs merge=lfs -text -*.xz filter=lfs diff=lfs merge=lfs -text -*.zip filter=lfs diff=lfs merge=lfs -text diff --git a/tests/immutable_file/.gitignore b/tests/immutable_file/.gitignore deleted file mode 100644 index 754f776..0000000 --- a/tests/immutable_file/.gitignore +++ /dev/null @@ -1,23 +0,0 @@ -################################ -## White list based gitignore ## -################################ - -# forbidden -* -.* - -# allowed -!.gitignore -!.gitattributes -!.gitea/ -!.gitea/issue_template/ -!.gitea/workflows/ -!*.yaml -!Makefile -!CMakeLists.txt -!h[0-8]/ -!*.m -!*.c -!*.cpp -!*.h -!*.md diff --git a/tests/immutable_file/push.yaml b/tests/immutable_file/push.yaml deleted file mode 100644 index 2f890b6..0000000 --- a/tests/immutable_file/push.yaml +++ /dev/null @@ -1,18 +0,0 @@ -name: Run JOJ3 on Push -on: [push] -jobs: - run: - container: - image: focs.ji.sjtu.edu.cn:5000/gitea/runner-images:focs-ubuntu-latest-slim - volumes: - - /home/tt/.config:/home/tt/.config - - /home/tt/.cache:/home/tt/.cache - - /home/tt/.ssh:/home/tt/.ssh - steps: - - name: Check out repository code - uses: https://gitea.com/BoYanZh/checkout@focs - with: - fetch-depth: 0 - - name: run joj3 - run: | - sudo -E -u tt joj3 -conf-root /home/tt/.config/joj diff --git a/tests/immutable_file/release.yaml b/tests/immutable_file/release.yaml deleted file mode 100644 index afd2838..0000000 --- a/tests/immutable_file/release.yaml +++ /dev/null @@ -1,20 +0,0 @@ -name: Run JOJ3 on Release -on: - release: - types: [published] -jobs: - run: - container: - image: focs.ji.sjtu.edu.cn:5000/gitea/runner-images:focs-ubuntu-latest-slim - volumes: - - /home/tt/.config:/home/tt/.config - - /home/tt/.cache:/home/tt/.cache - - /home/tt/.ssh:/home/tt/.ssh - steps: - - name: Check out repository code - uses: https://gitea.com/BoYanZh/checkout@focs - with: - fetch-depth: 0 - - name: run joj3 - run: | - sudo -E -u tt joj3 -conf-root /home/tt/.config/joj -msg "feat(h1-release): joj on ${{ github.ref }}" From d73f7da2e2d965a1a0c3df43a0f3b8a1f64a770d Mon Sep 17 00:00:00 2001 From: Nuvole Date: Sat, 26 Oct 2024 15:56:11 +0800 Subject: [PATCH 14/17] fix: immutable repo tom --- tests/basic/repo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/basic/repo.toml b/tests/basic/repo.toml index c77b9f7..28b5c05 100644 --- a/tests/basic/repo.toml +++ b/tests/basic/repo.toml @@ -7,4 +7,4 @@ sandbox_token = "test" whitelist_patterns = ["*.py", "*.txt", "*.md"] whitelist_file = ".whitelist" required = ["main.py", "README.md"] -immutable = [".gitignore", ".gitattributes", "push.yaml", "release.yaml"] +immutable = [] From 3bd92c5177e4769418eedea11350e1320404c6f5 Mon Sep 17 00:00:00 2001 From: Nuvole Date: Sat, 26 Oct 2024 15:59:25 +0800 Subject: [PATCH 15/17] feat: rebuild json --- tests/basic/task.json | 1328 ----------------------------------------- 1 file changed, 1328 deletions(-) delete mode 100644 tests/basic/task.json diff --git a/tests/basic/task.json b/tests/basic/task.json deleted file mode 100644 index 4ffc375..0000000 --- a/tests/basic/task.json +++ /dev/null @@ -1,1328 +0,0 @@ -{ - "name": "h4 ex1", - "logPath": "h4-ex1.log", - "expireUnixTimestamp": 1728748740, - "stage": { - "sandboxExecServer": "172.17.0.1:5051", - "sandboxToken": "test", - "outputPath": "/tmp/joj3_result.json", - "stages": [ - { - "name": "healthcheck", - "group": "", - "executor": { - "name": "sandbox", - "with": { - "default": { - "args": [ - "//repo-health-checker", - "-root=.", - "-repoSize=50.5", - "-meta=main.py", - "-meta=README.md", - "-checkFileSumList=a5b63323a692d3d8b952442969649b4f823d58dae26429494f613df160710dfc,b1bbad25b830db0a77b15a033f9ca1b7ab44c1d2d05056412bd3e4421645f0bf,1965adff52af61da8b9e089ff580d60f7e4c294a2930b9809c5cbdf76528de4d,c8bd62bf5297bac738b3845612fd595d677884093070904375463ab7953fce28", - "-checkFileNameList=.gitignore,.gitattributes,push.yaml,release.yaml" - ], - "env": [ - "PATH=/usr/bin:/bin:/usr/local/bin" - ], - "stdin": { - "src": null, - "content": "", - "fileId": null, - "name": null, - "max": 4194304, - "symlink": null, - "streamIn": false, - "streamOut": false, - "pipe": false - }, - "stdout": { - "src": null, - "content": null, - "fileId": null, - "name": "stdout", - "max": 4096, - "symlink": null, - "streamIn": false, - "streamOut": false, - "pipe": false - }, - "stderr": { - "src": null, - "content": null, - "fileId": null, - "name": "stderr", - "max": 4096, - "symlink": null, - "streamIn": false, - "streamOut": false, - "pipe": false - }, - "cpuLimit": 4000000000, - "realCpuLimit": 0, - "clockLimit": 8000000000, - "memoryLimit": 4194304, - "stackLimit": 0, - "procLimit": 50, - "cpuRateLimit": 0, - "cpuSetLimit": "", - "copyIn": { - "//tmp/repo-checker-u3awlhwg/repo-health-checker": { - "src": "//tmp/repo-checker-mc0n0t1l/repo-health-checker", - "content": null, - "fileId": null, - "name": null, - "max": 4194304, - "symlink": null, - "streamIn": false, - "streamOut": false, - "pipe": false - } - }, - "copyInCached": {}, - "copyInDir": ".", - "copyOut": [], - "copyOutCached": [], - "copyOutMax": 0, - "copyOutDir": "", - "tty": false, - "strictMemoryLimit": false, - "dataSegmentLimit": false, - "addressSpaceLimit": false - }, - "cases": [] - } - }, - "parsers": [ - { - "name": "healthcheck", - "with": { - "score": 0, - "comment": "" - } - } - ] - }, - { - "name": "Compilation", - "group": null, - "executor": { - "name": "sandbox", - "with": { - "default": { - "args": [ - "make.sh" - ], - "env": [ - "PATH=/usr/bin:/bin:/usr/local/bin" - ], - "stdin": { - "src": null, - "content": "", - "fileId": null, - "name": null, - "max": 4194304, - "symlink": null, - "streamIn": false, - "streamOut": false, - "pipe": false - }, - "stdout": { - "src": null, - "content": null, - "fileId": null, - "name": "stdout", - "max": 4000000000, - "symlink": null, - "streamIn": false, - "streamOut": false, - "pipe": false - }, - "stderr": { - "src": null, - "content": null, - "fileId": null, - "name": "stderr", - "max": 128000000000, - "symlink": null, - "streamIn": false, - "streamOut": false, - "pipe": false - }, - "cpuLimit": 180000000000, - "realCpuLimit": 0, - "clockLimit": 360000000000, - "memoryLimit": 4194304, - "stackLimit": 0, - "procLimit": 50, - "cpuRateLimit": 0, - "cpuSetLimit": "", - "copyIn": { - "tools/make.sh": { - "src": "/home/tt/.config/joj/tools/make.sh", - "content": null, - "fileId": null, - "name": null, - "max": 4194304, - "symlink": null, - "streamIn": false, - "streamOut": false, - "pipe": false - }, - "src/main.c": { - "src": "/home/tt/.config/joj/src/main.c", - "content": null, - "fileId": null, - "name": null, - "max": 4194304, - "symlink": null, - "streamIn": false, - "streamOut": false, - "pipe": false - }, - "src/task.h": { - "src": "/home/tt/.config/joj/src/task.h", - "content": null, - "fileId": null, - "name": null, - "max": 4194304, - "symlink": null, - "streamIn": false, - "streamOut": false, - "pipe": false - }, - "srcCMakelist.txt": { - "src": "/home/tt/.config/joj/srcCMakelist.txt", - "content": null, - "fileId": null, - "name": null, - "max": 4194304, - "symlink": null, - "streamIn": false, - "streamOut": false, - "pipe": false - } - }, - "copyInCached": { - "tools/make.sh": "tools/make.sh", - "src/main.c": "src/main.c", - "src/task.h": "src/task.h", - "srcCMakelist.txt": "srcCMakelist.txt" - }, - "copyInDir": ".", - "copyOut": [], - "copyOutCached": [ - "driver", - "p2", - "p2-msan" - ], - "copyOutMax": 0, - "copyOutDir": "", - "tty": false, - "strictMemoryLimit": false, - "dataSegmentLimit": false, - "addressSpaceLimit": false - }, - "cases": [] - } - }, - "parsers": [ - { - "name": "result-detail", - "with": { - "score": 0, - "comment": "", - "showFiles": [ - "stderr" - ], - "showExitStatus": true, - "showRuntime": false, - "showMemory": false - } - }, - { - "name": "dummy", - "with": { - "comment": "\n\n### Details\n" - } - }, - { - "name": "result-status", - "with": { - "comment": "Congratulations! Your code compiled successfully." - } - } - ] - }, - { - "name": "File length check", - "group": null, - "executor": { - "name": "sandbox", - "with": { - "default": { - "args": [ - "./file-length", - "500", - "400", - "*.c", - "*.h" - ], - "env": [ - "PATH=/usr/bin:/bin:/usr/local/bin" - ], - "stdin": { - "src": null, - "content": "", - "fileId": null, - "name": null, - "max": 4194304, - "symlink": null, - "streamIn": false, - "streamOut": false, - "pipe": false - }, - "stdout": { - "src": null, - "content": null, - "fileId": null, - "name": "stdout", - "max": 4000000000, - "symlink": null, - "streamIn": false, - "streamOut": false, - "pipe": false - }, - "stderr": { - "src": null, - "content": null, - "fileId": null, - "name": "stderr", - "max": 4000000000, - "symlink": null, - "streamIn": false, - "streamOut": false, - "pipe": false - }, - "cpuLimit": 4000000000, - "realCpuLimit": 0, - "clockLimit": 8000000000, - "memoryLimit": 4194304, - "stackLimit": 0, - "procLimit": 50, - "cpuRateLimit": 0, - "cpuSetLimit": "", - "copyIn": { - "tools/file-length": { - "src": "/home/tt/.config/joj/tools/file-length", - "content": null, - "fileId": null, - "name": null, - "max": 4194304, - "symlink": null, - "streamIn": false, - "streamOut": false, - "pipe": false - } - }, - "copyInCached": { - "tools/file-length": "tools/file-length" - }, - "copyInDir": ".", - "copyOut": [], - "copyOutCached": [], - "copyOutMax": 0, - "copyOutDir": "", - "tty": false, - "strictMemoryLimit": false, - "dataSegmentLimit": false, - "addressSpaceLimit": false - }, - "cases": [] - } - }, - "parsers": [ - { - "name": "keyword", - "with": { - "match": [ - { - "keyword": [ - "max" - ], - "score": 50 - }, - { - "keyword": [ - "recommend" - ], - "score": 20 - } - ] - } - }, - { - "name": "dummy", - "with": { - "comment": "" - } - }, - { - "name": "result-detail", - "with": { - "score": 0, - "comment": "", - "showFiles": [ - "stderr" - ], - "showExitStatus": false, - "showRuntime": false, - "showMemory": false - } - } - ] - }, - { - "name": "Clang-tidy checks", - "group": null, - "executor": { - "name": "sandbox", - "with": { - "default": { - "args": [ - "run-clang-tidy-18", - "-header-filter=.*", - "-quiet", - "-load=/usr/local/lib/libcodequality.so", - "-p", - "build" - ], - "env": [ - "PATH=/usr/bin:/bin:/usr/local/bin" - ], - "stdin": { - "src": null, - "content": "", - "fileId": null, - "name": null, - "max": 4194304, - "symlink": null, - "streamIn": false, - "streamOut": false, - "pipe": false - }, - "stdout": { - "src": null, - "content": null, - "fileId": null, - "name": "stdout", - "max": 65000000000, - "symlink": null, - "streamIn": false, - "streamOut": false, - "pipe": false - }, - "stderr": { - "src": null, - "content": null, - "fileId": null, - "name": "stderr", - "max": 4000000000, - "symlink": null, - "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": "clangtidy", - "with": { - "match": [ - { - "keyword": [ - "codequality-no-global-variables" - ], - "score": 10 - }, - { - "keyword": [ - "codequality-no-header-guard" - ], - "score": 10 - }, - { - "keyword": [ - "readability-function-size" - ], - "score": 50 - }, - { - "keyword": [ - "readability-duplicate-include" - ], - "score": 10 - }, - { - "keyword": [ - "readability-identifier-naming" - ], - "score": 5 - }, - { - "keyword": [ - "readability-redundant" - ], - "score": 5 - }, - { - "keyword": [ - "readability-misleading-indentation" - ], - "score": 10 - }, - { - "keyword": [ - "readability-misplaced-array-index" - ], - "score": 5 - }, - { - "keyword": [ - "cppcoreguidelines-init-variables" - ], - "score": 5 - }, - { - "keyword": [ - "bugprone-suspicious-string-compare" - ], - "score": 8 - }, - { - "keyword": [ - "google-global-names-in-headers" - ], - "score": 5 - }, - { - "keyword": [ - "clang-diagnostic" - ], - "score": 5 - }, - { - "keyword": [ - "clang-analyzer" - ], - "score": 5 - }, - { - "keyword": [ - "misc performance" - ], - "score": 5 - } - ] - } - }, - { - "name": "dummy", - "with": { - "comment": "\n\n### Details\n" - } - }, - { - "name": "result-detail", - "with": { - "score": 0, - "comment": "", - "showFiles": [ - "stdout" - ], - "showExitStatus": true, - "showRuntime": false, - "showMemory": false - } - } - ] - }, - { - "name": "Cppcheck check", - "group": null, - "executor": { - "name": "sandbox", - "with": { - "default": { - "args": [ - "cppcheck", - "--template='{\"file\":\"{file}\",\"line\":{line},", - "\"column\":{column},", - "\"severity\":\"{severity}\",", - "\"message\":\"{message}\",", - "\"id\":\"{id}\"}'", - "--force", - "--enable=all", - "--quiet", - "./" - ], - "env": [ - "PATH=/usr/bin:/bin:/usr/local/bin" - ], - "stdin": { - "src": null, - "content": "", - "fileId": null, - "name": null, - "max": 4194304, - "symlink": null, - "streamIn": false, - "streamOut": false, - "pipe": false - }, - "stdout": { - "src": null, - "content": null, - "fileId": null, - "name": "stdout", - "max": 4000000000, - "symlink": null, - "streamIn": false, - "streamOut": false, - "pipe": false - }, - "stderr": { - "src": null, - "content": null, - "fileId": null, - "name": "stderr", - "max": 65000000000, - "symlink": null, - "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": "cppcheck", - "with": { - "match": [ - { - "keyword": [ - "error" - ], - "score": 20 - }, - { - "keyword": [ - "warning" - ], - "score": 10 - }, - { - "keyword": [ - "portability" - ], - "score": 15 - }, - { - "keyword": [ - "performance" - ], - "score": 15 - }, - { - "keyword": [ - "style" - ], - "score": 10 - } - ] - } - }, - { - "name": "dummy", - "with": { - "comment": "\n\n### Details\n" - } - }, - { - "name": "result-detail", - "with": { - "score": 0, - "comment": "", - "showFiles": [ - "stderr" - ], - "showExitStatus": true, - "showRuntime": false, - "showMemory": false - } - } - ] - }, - { - "name": "Cpplint check", - "group": null, - "executor": { - "name": "sandbox", - "with": { - "default": { - "args": [ - "cpplint", - "--linelength=120", - "--filter=-legal,-readability/casting,-whitespace,-runtime/printf,-runtime/threadsafe_fn,-readability/todo,-build/include_subdir,-build/header_guard", - "--recursive", - "--exclude=build", - "." - ], - "env": [ - "PATH=/usr/bin:/bin:/usr/local/bin" - ], - "stdin": { - "src": null, - "content": "", - "fileId": null, - "name": null, - "max": 4194304, - "symlink": null, - "streamIn": false, - "streamOut": false, - "pipe": false - }, - "stdout": { - "src": null, - "content": null, - "fileId": null, - "name": "stdout", - "max": 65000000000, - "symlink": null, - "streamIn": false, - "streamOut": false, - "pipe": false - }, - "stderr": { - "src": null, - "content": null, - "fileId": null, - "name": "stderr", - "max": 4000000000, - "symlink": null, - "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": "cpplint", - "with": { - "comment": "" - } - }, - { - "name": "dummy", - "with": { - "comment": "\n\n### Details\n" - } - }, - { - "name": "result-detail", - "with": { - "score": 0, - "comment": "", - "showFiles": [ - "stdout" - ], - "showExitStatus": true, - "showRuntime": false, - "showMemory": false - } - } - ] - }, - { - "name": "judge-base", - "group": "joj", - "executor": { - "name": "sandbox", - "with": { - "default": { - "args": [ - "./driver", - "./mumsh" - ], - "env": [ - "PATH=/usr/bin:/bin:/usr/local/bin" - ], - "stdin": { - "src": null, - "content": "", - "fileId": null, - "name": null, - "max": 4194304, - "symlink": null, - "streamIn": false, - "streamOut": false, - "pipe": false - }, - "stdout": { - "src": null, - "content": null, - "fileId": null, - "name": "stdout", - "max": 4000000000, - "symlink": null, - "streamIn": false, - "streamOut": false, - "pipe": false - }, - "stderr": { - "src": null, - "content": null, - "fileId": null, - "name": "stderr", - "max": 4000000000, - "symlink": null, - "streamIn": false, - "streamOut": false, - "pipe": false - }, - "cpuLimit": 3000000000, - "realCpuLimit": 0, - "clockLimit": 6000000000, - "memoryLimit": 78643200, - "stackLimit": 0, - "procLimit": 50, - "cpuRateLimit": 0, - "cpuSetLimit": "", - "copyIn": {}, - "copyInCached": {}, - "copyInDir": ".", - "copyOut": [], - "copyOutCached": [], - "copyOutMax": 0, - "copyOutDir": "", - "tty": false, - "strictMemoryLimit": false, - "dataSegmentLimit": false, - "addressSpaceLimit": false - }, - "cases": [ - { - "args": null, - "env": [ - "PATH=/usr/bin:/bin:/usr/local/bin" - ], - "stdin": { - "src": "/home/tt/.config/joj/judge-base/case4.in", - "content": null, - "fileId": null, - "name": null, - "max": 4194304, - "symlink": null, - "streamIn": false, - "streamOut": false, - "pipe": false - }, - "stdout": null, - "stderr": null, - "cpuLimit": 30000000000, - "realCpuLimit": null, - "clockLimit": 60000000000, - "memoryLimit": 10485760, - "stackLimit": null, - "procLimit": 50, - "cpuRateLimit": null, - "cpuSetLimit": null, - "copyIn": null, - "copyInCached": null, - "copyInDir": null, - "copyOut": null, - "copyOutCached": null, - "copyOutMax": null, - "copyOutDir": null, - "tty": null, - "strictMemoryLimit": null, - "dataSegmentLimit": null, - "addressSpaceLimit": null - }, - { - "args": null, - "env": [ - "PATH=/usr/bin:/bin:/usr/local/bin" - ], - "stdin": { - "src": "/home/tt/.config/joj/judge-base/case5.in", - "content": null, - "fileId": null, - "name": null, - "max": 4194304, - "symlink": null, - "streamIn": false, - "streamOut": false, - "pipe": false - }, - "stdout": null, - "stderr": null, - "cpuLimit": 4000000000, - "realCpuLimit": null, - "clockLimit": 8000000000, - "memoryLimit": 4194304, - "stackLimit": null, - "procLimit": 50, - "cpuRateLimit": null, - "cpuSetLimit": null, - "copyIn": null, - "copyInCached": null, - "copyInDir": null, - "copyOut": null, - "copyOutCached": null, - "copyOutMax": null, - "copyOutDir": null, - "tty": null, - "strictMemoryLimit": null, - "dataSegmentLimit": null, - "addressSpaceLimit": null - }, - { - "args": null, - "env": [ - "PATH=/usr/bin:/bin:/usr/local/bin" - ], - "stdin": { - "src": "/home/tt/.config/joj/judge-base/case8.in", - "content": null, - "fileId": null, - "name": null, - "max": 4194304, - "symlink": null, - "streamIn": false, - "streamOut": false, - "pipe": false - }, - "stdout": null, - "stderr": null, - "cpuLimit": 4000000000, - "realCpuLimit": null, - "clockLimit": 8000000000, - "memoryLimit": 4194304, - "stackLimit": null, - "procLimit": 50, - "cpuRateLimit": null, - "cpuSetLimit": null, - "copyIn": null, - "copyInCached": null, - "copyInDir": null, - "copyOut": null, - "copyOutCached": null, - "copyOutMax": null, - "copyOutDir": null, - "tty": null, - "strictMemoryLimit": null, - "dataSegmentLimit": null, - "addressSpaceLimit": null - } - ] - } - }, - "parsers": [ - { - "name": "diff", - "with": { - "name": "diff", - "cases": [ - { - "outputs": [ - { - "score": 0, - "fileName": "stdout", - "answerPath": "/home/tt/.config/joj/judge-base/case4.out", - "forceQuitOnDiff": true, - "alwaysHide": false, - "compareSpace": true - } - ] - }, - { - "outputs": [ - { - "score": 0, - "fileName": "stdout", - "answerPath": "/home/tt/.config/joj/judge-base/case5.out", - "forceQuitOnDiff": true, - "alwaysHide": false, - "compareSpace": true - } - ] - }, - { - "outputs": [ - { - "score": 0, - "fileName": "stdout", - "answerPath": "/home/tt/.config/joj/judge-base/case8.out", - "forceQuitOnDiff": true, - "alwaysHide": false, - "compareSpace": true - } - ] - } - ] - } - }, - { - "name": "dummy", - "with": { - "comment": "\n\n### Details\n" - } - }, - { - "name": "result-detail", - "with": { - "score": 0, - "comment": "", - "showFiles": [ - "stderr" - ], - "showExitStatus": true, - "showRuntime": true, - "showMemory": true - } - } - ] - }, - { - "name": "judge-msan", - "group": "joj", - "executor": { - "name": "sandbox", - "with": { - "default": { - "args": [ - "./driver", - "./mumsh-msan" - ], - "env": [ - "PATH=/usr/bin:/bin:/usr/local/bin" - ], - "stdin": { - "src": null, - "content": "", - "fileId": null, - "name": null, - "max": 4194304, - "symlink": null, - "streamIn": false, - "streamOut": false, - "pipe": false - }, - "stdout": { - "src": null, - "content": null, - "fileId": null, - "name": "stdout", - "max": 4000000000, - "symlink": null, - "streamIn": false, - "streamOut": false, - "pipe": false - }, - "stderr": { - "src": null, - "content": null, - "fileId": null, - "name": "stderr", - "max": 4000000000, - "symlink": null, - "streamIn": false, - "streamOut": false, - "pipe": false - }, - "cpuLimit": 10000000000, - "realCpuLimit": 0, - "clockLimit": 20000000000, - "memoryLimit": 524288000, - "stackLimit": 0, - "procLimit": 50, - "cpuRateLimit": 0, - "cpuSetLimit": "", - "copyIn": {}, - "copyInCached": {}, - "copyInDir": ".", - "copyOut": [], - "copyOutCached": [], - "copyOutMax": 0, - "copyOutDir": "", - "tty": false, - "strictMemoryLimit": false, - "dataSegmentLimit": false, - "addressSpaceLimit": false - }, - "cases": [ - { - "args": null, - "env": [ - "PATH=/usr/bin:/bin:/usr/local/bin" - ], - "stdin": { - "src": "/home/tt/.config/joj/judge-msan/case4.in", - "content": null, - "fileId": null, - "name": null, - "max": 4194304, - "symlink": null, - "streamIn": false, - "streamOut": false, - "pipe": false - }, - "stdout": null, - "stderr": null, - "cpuLimit": 30000000000, - "realCpuLimit": null, - "clockLimit": 60000000000, - "memoryLimit": 10485760, - "stackLimit": null, - "procLimit": 50, - "cpuRateLimit": null, - "cpuSetLimit": null, - "copyIn": null, - "copyInCached": null, - "copyInDir": null, - "copyOut": null, - "copyOutCached": null, - "copyOutMax": null, - "copyOutDir": null, - "tty": null, - "strictMemoryLimit": null, - "dataSegmentLimit": null, - "addressSpaceLimit": null - }, - { - "args": null, - "env": [ - "PATH=/usr/bin:/bin:/usr/local/bin" - ], - "stdin": { - "src": "/home/tt/.config/joj/judge-msan/case5.in", - "content": null, - "fileId": null, - "name": null, - "max": 4194304, - "symlink": null, - "streamIn": false, - "streamOut": false, - "pipe": false - }, - "stdout": null, - "stderr": null, - "cpuLimit": 4000000000, - "realCpuLimit": null, - "clockLimit": 8000000000, - "memoryLimit": 4194304, - "stackLimit": null, - "procLimit": 50, - "cpuRateLimit": null, - "cpuSetLimit": null, - "copyIn": null, - "copyInCached": null, - "copyInDir": null, - "copyOut": null, - "copyOutCached": null, - "copyOutMax": null, - "copyOutDir": null, - "tty": null, - "strictMemoryLimit": null, - "dataSegmentLimit": null, - "addressSpaceLimit": null - }, - { - "args": null, - "env": [ - "PATH=/usr/bin:/bin:/usr/local/bin" - ], - "stdin": { - "src": "/home/tt/.config/joj/judge-msan/case6.in", - "content": null, - "fileId": null, - "name": null, - "max": 4194304, - "symlink": null, - "streamIn": false, - "streamOut": false, - "pipe": false - }, - "stdout": null, - "stderr": null, - "cpuLimit": 4000000000, - "realCpuLimit": null, - "clockLimit": 8000000000, - "memoryLimit": 4194304, - "stackLimit": null, - "procLimit": 50, - "cpuRateLimit": null, - "cpuSetLimit": null, - "copyIn": null, - "copyInCached": null, - "copyInDir": null, - "copyOut": null, - "copyOutCached": null, - "copyOutMax": null, - "copyOutDir": null, - "tty": null, - "strictMemoryLimit": null, - "dataSegmentLimit": null, - "addressSpaceLimit": null - } - ] - } - }, - "parsers": [ - { - "name": "diff", - "with": { - "name": "diff", - "cases": [ - { - "outputs": [ - { - "score": 0, - "fileName": "stdout", - "answerPath": "/home/tt/.config/joj/judge-msan/case4.out", - "forceQuitOnDiff": true, - "alwaysHide": false, - "compareSpace": true - } - ] - }, - { - "outputs": [ - { - "score": 0, - "fileName": "stdout", - "answerPath": "/home/tt/.config/joj/judge-msan/case5.out", - "forceQuitOnDiff": true, - "alwaysHide": false, - "compareSpace": true - } - ] - }, - { - "outputs": [ - { - "score": 0, - "fileName": "stdout", - "answerPath": "/home/tt/.config/joj/judge-msan/case6.out", - "forceQuitOnDiff": true, - "alwaysHide": true, - "compareSpace": true - } - ] - } - ] - } - }, - { - "name": "dummy", - "with": { - "comment": "\n\n### Details\n" - } - }, - { - "name": "result-detail", - "with": { - "score": 0, - "comment": "", - "showFiles": [ - "stderr" - ], - "showExitStatus": true, - "showRuntime": true, - "showMemory": true - } - } - ] - } - ] - }, - "teapot": { - "logPath": "h4-ex1-joint-teapot-debug.log", - "scoreboardPath": "h4-ex1-scoreboard.csv", - "failedTablePath": "h4-ex1-failed-table.md", - "gradingRepoName": "Nuvole-joj", - "skipIssue": false, - "skipScoreboard": false, - "skipFailedTable": false - } -} From 1b08f6fc53c3021581681b8398f63344a3937b3c Mon Sep 17 00:00:00 2001 From: Nuvole Date: Sat, 26 Oct 2024 16:01:38 +0800 Subject: [PATCH 16/17] feat: sync --- tests/basic/task.json | 1328 +++++++++++++++++++++++++++ tests/immutable_file/.gitattributes | 33 + tests/immutable_file/.gitignore | 23 + tests/immutable_file/push.yaml | 18 + tests/immutable_file/release.yaml | 20 + 5 files changed, 1422 insertions(+) create mode 100644 tests/basic/task.json create mode 100644 tests/immutable_file/.gitattributes create mode 100644 tests/immutable_file/.gitignore create mode 100644 tests/immutable_file/push.yaml create mode 100644 tests/immutable_file/release.yaml diff --git a/tests/basic/task.json b/tests/basic/task.json new file mode 100644 index 0000000..4ffc375 --- /dev/null +++ b/tests/basic/task.json @@ -0,0 +1,1328 @@ +{ + "name": "h4 ex1", + "logPath": "h4-ex1.log", + "expireUnixTimestamp": 1728748740, + "stage": { + "sandboxExecServer": "172.17.0.1:5051", + "sandboxToken": "test", + "outputPath": "/tmp/joj3_result.json", + "stages": [ + { + "name": "healthcheck", + "group": "", + "executor": { + "name": "sandbox", + "with": { + "default": { + "args": [ + "//repo-health-checker", + "-root=.", + "-repoSize=50.5", + "-meta=main.py", + "-meta=README.md", + "-checkFileSumList=a5b63323a692d3d8b952442969649b4f823d58dae26429494f613df160710dfc,b1bbad25b830db0a77b15a033f9ca1b7ab44c1d2d05056412bd3e4421645f0bf,1965adff52af61da8b9e089ff580d60f7e4c294a2930b9809c5cbdf76528de4d,c8bd62bf5297bac738b3845612fd595d677884093070904375463ab7953fce28", + "-checkFileNameList=.gitignore,.gitattributes,push.yaml,release.yaml" + ], + "env": [ + "PATH=/usr/bin:/bin:/usr/local/bin" + ], + "stdin": { + "src": null, + "content": "", + "fileId": null, + "name": null, + "max": 4194304, + "symlink": null, + "streamIn": false, + "streamOut": false, + "pipe": false + }, + "stdout": { + "src": null, + "content": null, + "fileId": null, + "name": "stdout", + "max": 4096, + "symlink": null, + "streamIn": false, + "streamOut": false, + "pipe": false + }, + "stderr": { + "src": null, + "content": null, + "fileId": null, + "name": "stderr", + "max": 4096, + "symlink": null, + "streamIn": false, + "streamOut": false, + "pipe": false + }, + "cpuLimit": 4000000000, + "realCpuLimit": 0, + "clockLimit": 8000000000, + "memoryLimit": 4194304, + "stackLimit": 0, + "procLimit": 50, + "cpuRateLimit": 0, + "cpuSetLimit": "", + "copyIn": { + "//tmp/repo-checker-u3awlhwg/repo-health-checker": { + "src": "//tmp/repo-checker-mc0n0t1l/repo-health-checker", + "content": null, + "fileId": null, + "name": null, + "max": 4194304, + "symlink": null, + "streamIn": false, + "streamOut": false, + "pipe": false + } + }, + "copyInCached": {}, + "copyInDir": ".", + "copyOut": [], + "copyOutCached": [], + "copyOutMax": 0, + "copyOutDir": "", + "tty": false, + "strictMemoryLimit": false, + "dataSegmentLimit": false, + "addressSpaceLimit": false + }, + "cases": [] + } + }, + "parsers": [ + { + "name": "healthcheck", + "with": { + "score": 0, + "comment": "" + } + } + ] + }, + { + "name": "Compilation", + "group": null, + "executor": { + "name": "sandbox", + "with": { + "default": { + "args": [ + "make.sh" + ], + "env": [ + "PATH=/usr/bin:/bin:/usr/local/bin" + ], + "stdin": { + "src": null, + "content": "", + "fileId": null, + "name": null, + "max": 4194304, + "symlink": null, + "streamIn": false, + "streamOut": false, + "pipe": false + }, + "stdout": { + "src": null, + "content": null, + "fileId": null, + "name": "stdout", + "max": 4000000000, + "symlink": null, + "streamIn": false, + "streamOut": false, + "pipe": false + }, + "stderr": { + "src": null, + "content": null, + "fileId": null, + "name": "stderr", + "max": 128000000000, + "symlink": null, + "streamIn": false, + "streamOut": false, + "pipe": false + }, + "cpuLimit": 180000000000, + "realCpuLimit": 0, + "clockLimit": 360000000000, + "memoryLimit": 4194304, + "stackLimit": 0, + "procLimit": 50, + "cpuRateLimit": 0, + "cpuSetLimit": "", + "copyIn": { + "tools/make.sh": { + "src": "/home/tt/.config/joj/tools/make.sh", + "content": null, + "fileId": null, + "name": null, + "max": 4194304, + "symlink": null, + "streamIn": false, + "streamOut": false, + "pipe": false + }, + "src/main.c": { + "src": "/home/tt/.config/joj/src/main.c", + "content": null, + "fileId": null, + "name": null, + "max": 4194304, + "symlink": null, + "streamIn": false, + "streamOut": false, + "pipe": false + }, + "src/task.h": { + "src": "/home/tt/.config/joj/src/task.h", + "content": null, + "fileId": null, + "name": null, + "max": 4194304, + "symlink": null, + "streamIn": false, + "streamOut": false, + "pipe": false + }, + "srcCMakelist.txt": { + "src": "/home/tt/.config/joj/srcCMakelist.txt", + "content": null, + "fileId": null, + "name": null, + "max": 4194304, + "symlink": null, + "streamIn": false, + "streamOut": false, + "pipe": false + } + }, + "copyInCached": { + "tools/make.sh": "tools/make.sh", + "src/main.c": "src/main.c", + "src/task.h": "src/task.h", + "srcCMakelist.txt": "srcCMakelist.txt" + }, + "copyInDir": ".", + "copyOut": [], + "copyOutCached": [ + "driver", + "p2", + "p2-msan" + ], + "copyOutMax": 0, + "copyOutDir": "", + "tty": false, + "strictMemoryLimit": false, + "dataSegmentLimit": false, + "addressSpaceLimit": false + }, + "cases": [] + } + }, + "parsers": [ + { + "name": "result-detail", + "with": { + "score": 0, + "comment": "", + "showFiles": [ + "stderr" + ], + "showExitStatus": true, + "showRuntime": false, + "showMemory": false + } + }, + { + "name": "dummy", + "with": { + "comment": "\n\n### Details\n" + } + }, + { + "name": "result-status", + "with": { + "comment": "Congratulations! Your code compiled successfully." + } + } + ] + }, + { + "name": "File length check", + "group": null, + "executor": { + "name": "sandbox", + "with": { + "default": { + "args": [ + "./file-length", + "500", + "400", + "*.c", + "*.h" + ], + "env": [ + "PATH=/usr/bin:/bin:/usr/local/bin" + ], + "stdin": { + "src": null, + "content": "", + "fileId": null, + "name": null, + "max": 4194304, + "symlink": null, + "streamIn": false, + "streamOut": false, + "pipe": false + }, + "stdout": { + "src": null, + "content": null, + "fileId": null, + "name": "stdout", + "max": 4000000000, + "symlink": null, + "streamIn": false, + "streamOut": false, + "pipe": false + }, + "stderr": { + "src": null, + "content": null, + "fileId": null, + "name": "stderr", + "max": 4000000000, + "symlink": null, + "streamIn": false, + "streamOut": false, + "pipe": false + }, + "cpuLimit": 4000000000, + "realCpuLimit": 0, + "clockLimit": 8000000000, + "memoryLimit": 4194304, + "stackLimit": 0, + "procLimit": 50, + "cpuRateLimit": 0, + "cpuSetLimit": "", + "copyIn": { + "tools/file-length": { + "src": "/home/tt/.config/joj/tools/file-length", + "content": null, + "fileId": null, + "name": null, + "max": 4194304, + "symlink": null, + "streamIn": false, + "streamOut": false, + "pipe": false + } + }, + "copyInCached": { + "tools/file-length": "tools/file-length" + }, + "copyInDir": ".", + "copyOut": [], + "copyOutCached": [], + "copyOutMax": 0, + "copyOutDir": "", + "tty": false, + "strictMemoryLimit": false, + "dataSegmentLimit": false, + "addressSpaceLimit": false + }, + "cases": [] + } + }, + "parsers": [ + { + "name": "keyword", + "with": { + "match": [ + { + "keyword": [ + "max" + ], + "score": 50 + }, + { + "keyword": [ + "recommend" + ], + "score": 20 + } + ] + } + }, + { + "name": "dummy", + "with": { + "comment": "" + } + }, + { + "name": "result-detail", + "with": { + "score": 0, + "comment": "", + "showFiles": [ + "stderr" + ], + "showExitStatus": false, + "showRuntime": false, + "showMemory": false + } + } + ] + }, + { + "name": "Clang-tidy checks", + "group": null, + "executor": { + "name": "sandbox", + "with": { + "default": { + "args": [ + "run-clang-tidy-18", + "-header-filter=.*", + "-quiet", + "-load=/usr/local/lib/libcodequality.so", + "-p", + "build" + ], + "env": [ + "PATH=/usr/bin:/bin:/usr/local/bin" + ], + "stdin": { + "src": null, + "content": "", + "fileId": null, + "name": null, + "max": 4194304, + "symlink": null, + "streamIn": false, + "streamOut": false, + "pipe": false + }, + "stdout": { + "src": null, + "content": null, + "fileId": null, + "name": "stdout", + "max": 65000000000, + "symlink": null, + "streamIn": false, + "streamOut": false, + "pipe": false + }, + "stderr": { + "src": null, + "content": null, + "fileId": null, + "name": "stderr", + "max": 4000000000, + "symlink": null, + "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": "clangtidy", + "with": { + "match": [ + { + "keyword": [ + "codequality-no-global-variables" + ], + "score": 10 + }, + { + "keyword": [ + "codequality-no-header-guard" + ], + "score": 10 + }, + { + "keyword": [ + "readability-function-size" + ], + "score": 50 + }, + { + "keyword": [ + "readability-duplicate-include" + ], + "score": 10 + }, + { + "keyword": [ + "readability-identifier-naming" + ], + "score": 5 + }, + { + "keyword": [ + "readability-redundant" + ], + "score": 5 + }, + { + "keyword": [ + "readability-misleading-indentation" + ], + "score": 10 + }, + { + "keyword": [ + "readability-misplaced-array-index" + ], + "score": 5 + }, + { + "keyword": [ + "cppcoreguidelines-init-variables" + ], + "score": 5 + }, + { + "keyword": [ + "bugprone-suspicious-string-compare" + ], + "score": 8 + }, + { + "keyword": [ + "google-global-names-in-headers" + ], + "score": 5 + }, + { + "keyword": [ + "clang-diagnostic" + ], + "score": 5 + }, + { + "keyword": [ + "clang-analyzer" + ], + "score": 5 + }, + { + "keyword": [ + "misc performance" + ], + "score": 5 + } + ] + } + }, + { + "name": "dummy", + "with": { + "comment": "\n\n### Details\n" + } + }, + { + "name": "result-detail", + "with": { + "score": 0, + "comment": "", + "showFiles": [ + "stdout" + ], + "showExitStatus": true, + "showRuntime": false, + "showMemory": false + } + } + ] + }, + { + "name": "Cppcheck check", + "group": null, + "executor": { + "name": "sandbox", + "with": { + "default": { + "args": [ + "cppcheck", + "--template='{\"file\":\"{file}\",\"line\":{line},", + "\"column\":{column},", + "\"severity\":\"{severity}\",", + "\"message\":\"{message}\",", + "\"id\":\"{id}\"}'", + "--force", + "--enable=all", + "--quiet", + "./" + ], + "env": [ + "PATH=/usr/bin:/bin:/usr/local/bin" + ], + "stdin": { + "src": null, + "content": "", + "fileId": null, + "name": null, + "max": 4194304, + "symlink": null, + "streamIn": false, + "streamOut": false, + "pipe": false + }, + "stdout": { + "src": null, + "content": null, + "fileId": null, + "name": "stdout", + "max": 4000000000, + "symlink": null, + "streamIn": false, + "streamOut": false, + "pipe": false + }, + "stderr": { + "src": null, + "content": null, + "fileId": null, + "name": "stderr", + "max": 65000000000, + "symlink": null, + "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": "cppcheck", + "with": { + "match": [ + { + "keyword": [ + "error" + ], + "score": 20 + }, + { + "keyword": [ + "warning" + ], + "score": 10 + }, + { + "keyword": [ + "portability" + ], + "score": 15 + }, + { + "keyword": [ + "performance" + ], + "score": 15 + }, + { + "keyword": [ + "style" + ], + "score": 10 + } + ] + } + }, + { + "name": "dummy", + "with": { + "comment": "\n\n### Details\n" + } + }, + { + "name": "result-detail", + "with": { + "score": 0, + "comment": "", + "showFiles": [ + "stderr" + ], + "showExitStatus": true, + "showRuntime": false, + "showMemory": false + } + } + ] + }, + { + "name": "Cpplint check", + "group": null, + "executor": { + "name": "sandbox", + "with": { + "default": { + "args": [ + "cpplint", + "--linelength=120", + "--filter=-legal,-readability/casting,-whitespace,-runtime/printf,-runtime/threadsafe_fn,-readability/todo,-build/include_subdir,-build/header_guard", + "--recursive", + "--exclude=build", + "." + ], + "env": [ + "PATH=/usr/bin:/bin:/usr/local/bin" + ], + "stdin": { + "src": null, + "content": "", + "fileId": null, + "name": null, + "max": 4194304, + "symlink": null, + "streamIn": false, + "streamOut": false, + "pipe": false + }, + "stdout": { + "src": null, + "content": null, + "fileId": null, + "name": "stdout", + "max": 65000000000, + "symlink": null, + "streamIn": false, + "streamOut": false, + "pipe": false + }, + "stderr": { + "src": null, + "content": null, + "fileId": null, + "name": "stderr", + "max": 4000000000, + "symlink": null, + "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": "cpplint", + "with": { + "comment": "" + } + }, + { + "name": "dummy", + "with": { + "comment": "\n\n### Details\n" + } + }, + { + "name": "result-detail", + "with": { + "score": 0, + "comment": "", + "showFiles": [ + "stdout" + ], + "showExitStatus": true, + "showRuntime": false, + "showMemory": false + } + } + ] + }, + { + "name": "judge-base", + "group": "joj", + "executor": { + "name": "sandbox", + "with": { + "default": { + "args": [ + "./driver", + "./mumsh" + ], + "env": [ + "PATH=/usr/bin:/bin:/usr/local/bin" + ], + "stdin": { + "src": null, + "content": "", + "fileId": null, + "name": null, + "max": 4194304, + "symlink": null, + "streamIn": false, + "streamOut": false, + "pipe": false + }, + "stdout": { + "src": null, + "content": null, + "fileId": null, + "name": "stdout", + "max": 4000000000, + "symlink": null, + "streamIn": false, + "streamOut": false, + "pipe": false + }, + "stderr": { + "src": null, + "content": null, + "fileId": null, + "name": "stderr", + "max": 4000000000, + "symlink": null, + "streamIn": false, + "streamOut": false, + "pipe": false + }, + "cpuLimit": 3000000000, + "realCpuLimit": 0, + "clockLimit": 6000000000, + "memoryLimit": 78643200, + "stackLimit": 0, + "procLimit": 50, + "cpuRateLimit": 0, + "cpuSetLimit": "", + "copyIn": {}, + "copyInCached": {}, + "copyInDir": ".", + "copyOut": [], + "copyOutCached": [], + "copyOutMax": 0, + "copyOutDir": "", + "tty": false, + "strictMemoryLimit": false, + "dataSegmentLimit": false, + "addressSpaceLimit": false + }, + "cases": [ + { + "args": null, + "env": [ + "PATH=/usr/bin:/bin:/usr/local/bin" + ], + "stdin": { + "src": "/home/tt/.config/joj/judge-base/case4.in", + "content": null, + "fileId": null, + "name": null, + "max": 4194304, + "symlink": null, + "streamIn": false, + "streamOut": false, + "pipe": false + }, + "stdout": null, + "stderr": null, + "cpuLimit": 30000000000, + "realCpuLimit": null, + "clockLimit": 60000000000, + "memoryLimit": 10485760, + "stackLimit": null, + "procLimit": 50, + "cpuRateLimit": null, + "cpuSetLimit": null, + "copyIn": null, + "copyInCached": null, + "copyInDir": null, + "copyOut": null, + "copyOutCached": null, + "copyOutMax": null, + "copyOutDir": null, + "tty": null, + "strictMemoryLimit": null, + "dataSegmentLimit": null, + "addressSpaceLimit": null + }, + { + "args": null, + "env": [ + "PATH=/usr/bin:/bin:/usr/local/bin" + ], + "stdin": { + "src": "/home/tt/.config/joj/judge-base/case5.in", + "content": null, + "fileId": null, + "name": null, + "max": 4194304, + "symlink": null, + "streamIn": false, + "streamOut": false, + "pipe": false + }, + "stdout": null, + "stderr": null, + "cpuLimit": 4000000000, + "realCpuLimit": null, + "clockLimit": 8000000000, + "memoryLimit": 4194304, + "stackLimit": null, + "procLimit": 50, + "cpuRateLimit": null, + "cpuSetLimit": null, + "copyIn": null, + "copyInCached": null, + "copyInDir": null, + "copyOut": null, + "copyOutCached": null, + "copyOutMax": null, + "copyOutDir": null, + "tty": null, + "strictMemoryLimit": null, + "dataSegmentLimit": null, + "addressSpaceLimit": null + }, + { + "args": null, + "env": [ + "PATH=/usr/bin:/bin:/usr/local/bin" + ], + "stdin": { + "src": "/home/tt/.config/joj/judge-base/case8.in", + "content": null, + "fileId": null, + "name": null, + "max": 4194304, + "symlink": null, + "streamIn": false, + "streamOut": false, + "pipe": false + }, + "stdout": null, + "stderr": null, + "cpuLimit": 4000000000, + "realCpuLimit": null, + "clockLimit": 8000000000, + "memoryLimit": 4194304, + "stackLimit": null, + "procLimit": 50, + "cpuRateLimit": null, + "cpuSetLimit": null, + "copyIn": null, + "copyInCached": null, + "copyInDir": null, + "copyOut": null, + "copyOutCached": null, + "copyOutMax": null, + "copyOutDir": null, + "tty": null, + "strictMemoryLimit": null, + "dataSegmentLimit": null, + "addressSpaceLimit": null + } + ] + } + }, + "parsers": [ + { + "name": "diff", + "with": { + "name": "diff", + "cases": [ + { + "outputs": [ + { + "score": 0, + "fileName": "stdout", + "answerPath": "/home/tt/.config/joj/judge-base/case4.out", + "forceQuitOnDiff": true, + "alwaysHide": false, + "compareSpace": true + } + ] + }, + { + "outputs": [ + { + "score": 0, + "fileName": "stdout", + "answerPath": "/home/tt/.config/joj/judge-base/case5.out", + "forceQuitOnDiff": true, + "alwaysHide": false, + "compareSpace": true + } + ] + }, + { + "outputs": [ + { + "score": 0, + "fileName": "stdout", + "answerPath": "/home/tt/.config/joj/judge-base/case8.out", + "forceQuitOnDiff": true, + "alwaysHide": false, + "compareSpace": true + } + ] + } + ] + } + }, + { + "name": "dummy", + "with": { + "comment": "\n\n### Details\n" + } + }, + { + "name": "result-detail", + "with": { + "score": 0, + "comment": "", + "showFiles": [ + "stderr" + ], + "showExitStatus": true, + "showRuntime": true, + "showMemory": true + } + } + ] + }, + { + "name": "judge-msan", + "group": "joj", + "executor": { + "name": "sandbox", + "with": { + "default": { + "args": [ + "./driver", + "./mumsh-msan" + ], + "env": [ + "PATH=/usr/bin:/bin:/usr/local/bin" + ], + "stdin": { + "src": null, + "content": "", + "fileId": null, + "name": null, + "max": 4194304, + "symlink": null, + "streamIn": false, + "streamOut": false, + "pipe": false + }, + "stdout": { + "src": null, + "content": null, + "fileId": null, + "name": "stdout", + "max": 4000000000, + "symlink": null, + "streamIn": false, + "streamOut": false, + "pipe": false + }, + "stderr": { + "src": null, + "content": null, + "fileId": null, + "name": "stderr", + "max": 4000000000, + "symlink": null, + "streamIn": false, + "streamOut": false, + "pipe": false + }, + "cpuLimit": 10000000000, + "realCpuLimit": 0, + "clockLimit": 20000000000, + "memoryLimit": 524288000, + "stackLimit": 0, + "procLimit": 50, + "cpuRateLimit": 0, + "cpuSetLimit": "", + "copyIn": {}, + "copyInCached": {}, + "copyInDir": ".", + "copyOut": [], + "copyOutCached": [], + "copyOutMax": 0, + "copyOutDir": "", + "tty": false, + "strictMemoryLimit": false, + "dataSegmentLimit": false, + "addressSpaceLimit": false + }, + "cases": [ + { + "args": null, + "env": [ + "PATH=/usr/bin:/bin:/usr/local/bin" + ], + "stdin": { + "src": "/home/tt/.config/joj/judge-msan/case4.in", + "content": null, + "fileId": null, + "name": null, + "max": 4194304, + "symlink": null, + "streamIn": false, + "streamOut": false, + "pipe": false + }, + "stdout": null, + "stderr": null, + "cpuLimit": 30000000000, + "realCpuLimit": null, + "clockLimit": 60000000000, + "memoryLimit": 10485760, + "stackLimit": null, + "procLimit": 50, + "cpuRateLimit": null, + "cpuSetLimit": null, + "copyIn": null, + "copyInCached": null, + "copyInDir": null, + "copyOut": null, + "copyOutCached": null, + "copyOutMax": null, + "copyOutDir": null, + "tty": null, + "strictMemoryLimit": null, + "dataSegmentLimit": null, + "addressSpaceLimit": null + }, + { + "args": null, + "env": [ + "PATH=/usr/bin:/bin:/usr/local/bin" + ], + "stdin": { + "src": "/home/tt/.config/joj/judge-msan/case5.in", + "content": null, + "fileId": null, + "name": null, + "max": 4194304, + "symlink": null, + "streamIn": false, + "streamOut": false, + "pipe": false + }, + "stdout": null, + "stderr": null, + "cpuLimit": 4000000000, + "realCpuLimit": null, + "clockLimit": 8000000000, + "memoryLimit": 4194304, + "stackLimit": null, + "procLimit": 50, + "cpuRateLimit": null, + "cpuSetLimit": null, + "copyIn": null, + "copyInCached": null, + "copyInDir": null, + "copyOut": null, + "copyOutCached": null, + "copyOutMax": null, + "copyOutDir": null, + "tty": null, + "strictMemoryLimit": null, + "dataSegmentLimit": null, + "addressSpaceLimit": null + }, + { + "args": null, + "env": [ + "PATH=/usr/bin:/bin:/usr/local/bin" + ], + "stdin": { + "src": "/home/tt/.config/joj/judge-msan/case6.in", + "content": null, + "fileId": null, + "name": null, + "max": 4194304, + "symlink": null, + "streamIn": false, + "streamOut": false, + "pipe": false + }, + "stdout": null, + "stderr": null, + "cpuLimit": 4000000000, + "realCpuLimit": null, + "clockLimit": 8000000000, + "memoryLimit": 4194304, + "stackLimit": null, + "procLimit": 50, + "cpuRateLimit": null, + "cpuSetLimit": null, + "copyIn": null, + "copyInCached": null, + "copyInDir": null, + "copyOut": null, + "copyOutCached": null, + "copyOutMax": null, + "copyOutDir": null, + "tty": null, + "strictMemoryLimit": null, + "dataSegmentLimit": null, + "addressSpaceLimit": null + } + ] + } + }, + "parsers": [ + { + "name": "diff", + "with": { + "name": "diff", + "cases": [ + { + "outputs": [ + { + "score": 0, + "fileName": "stdout", + "answerPath": "/home/tt/.config/joj/judge-msan/case4.out", + "forceQuitOnDiff": true, + "alwaysHide": false, + "compareSpace": true + } + ] + }, + { + "outputs": [ + { + "score": 0, + "fileName": "stdout", + "answerPath": "/home/tt/.config/joj/judge-msan/case5.out", + "forceQuitOnDiff": true, + "alwaysHide": false, + "compareSpace": true + } + ] + }, + { + "outputs": [ + { + "score": 0, + "fileName": "stdout", + "answerPath": "/home/tt/.config/joj/judge-msan/case6.out", + "forceQuitOnDiff": true, + "alwaysHide": true, + "compareSpace": true + } + ] + } + ] + } + }, + { + "name": "dummy", + "with": { + "comment": "\n\n### Details\n" + } + }, + { + "name": "result-detail", + "with": { + "score": 0, + "comment": "", + "showFiles": [ + "stderr" + ], + "showExitStatus": true, + "showRuntime": true, + "showMemory": true + } + } + ] + } + ] + }, + "teapot": { + "logPath": "h4-ex1-joint-teapot-debug.log", + "scoreboardPath": "h4-ex1-scoreboard.csv", + "failedTablePath": "h4-ex1-failed-table.md", + "gradingRepoName": "Nuvole-joj", + "skipIssue": false, + "skipScoreboard": false, + "skipFailedTable": false + } +} diff --git a/tests/immutable_file/.gitattributes b/tests/immutable_file/.gitattributes new file mode 100644 index 0000000..b910c4a --- /dev/null +++ b/tests/immutable_file/.gitattributes @@ -0,0 +1,33 @@ +*.avi filter=lfs diff=lfs merge=lfs -text +*.bz2 filter=lfs diff=lfs merge=lfs -text +*.djvu filter=lfs diff=lfs merge=lfs -text +*.doc filter=lfs diff=lfs merge=lfs -text +*.docx filter=lfs diff=lfs merge=lfs -text +*.epub filter=lfs diff=lfs merge=lfs -text +*.gz filter=lfs diff=lfs merge=lfs -text +*.ipynb filter=lfs diff=lfs merge=lfs -text +*.jpeg filter=lfs diff=lfs merge=lfs -text +*.JPEG filter=lfs diff=lfs merge=lfs -text +*.jpg filter=lfs diff=lfs merge=lfs -text +*.JPG filter=lfs diff=lfs merge=lfs -text +*.mkv filter=lfs diff=lfs merge=lfs -text +*.mp4 filter=lfs diff=lfs merge=lfs -text +*.ods filter=lfs diff=lfs merge=lfs -text +*.odt filter=lfs diff=lfs merge=lfs -text +*.otf filter=lfs diff=lfs merge=lfs -text +*.pdf filter=lfs diff=lfs merge=lfs -text +*.PDF filter=lfs diff=lfs merge=lfs -text +*.png filter=lfs diff=lfs merge=lfs -text +*.PNG filter=lfs diff=lfs merge=lfs -text +*.ppt filter=lfs diff=lfs merge=lfs -text +*.pptx filter=lfs diff=lfs merge=lfs -text +*.ps filter=lfs diff=lfs merge=lfs -text +*.rar filter=lfs diff=lfs merge=lfs -text +*.tar filter=lfs diff=lfs merge=lfs -text +*.tgz filter=lfs diff=lfs merge=lfs -text +*.ttf filter=lfs diff=lfs merge=lfs -text +*.webm filter=lfs diff=lfs merge=lfs -text +*.xls filter=lfs diff=lfs merge=lfs -text +*.xlsx filter=lfs diff=lfs merge=lfs -text +*.xz filter=lfs diff=lfs merge=lfs -text +*.zip filter=lfs diff=lfs merge=lfs -text diff --git a/tests/immutable_file/.gitignore b/tests/immutable_file/.gitignore new file mode 100644 index 0000000..754f776 --- /dev/null +++ b/tests/immutable_file/.gitignore @@ -0,0 +1,23 @@ +################################ +## White list based gitignore ## +################################ + +# forbidden +* +.* + +# allowed +!.gitignore +!.gitattributes +!.gitea/ +!.gitea/issue_template/ +!.gitea/workflows/ +!*.yaml +!Makefile +!CMakeLists.txt +!h[0-8]/ +!*.m +!*.c +!*.cpp +!*.h +!*.md diff --git a/tests/immutable_file/push.yaml b/tests/immutable_file/push.yaml new file mode 100644 index 0000000..2f890b6 --- /dev/null +++ b/tests/immutable_file/push.yaml @@ -0,0 +1,18 @@ +name: Run JOJ3 on Push +on: [push] +jobs: + run: + container: + image: focs.ji.sjtu.edu.cn:5000/gitea/runner-images:focs-ubuntu-latest-slim + volumes: + - /home/tt/.config:/home/tt/.config + - /home/tt/.cache:/home/tt/.cache + - /home/tt/.ssh:/home/tt/.ssh + steps: + - name: Check out repository code + uses: https://gitea.com/BoYanZh/checkout@focs + with: + fetch-depth: 0 + - name: run joj3 + run: | + sudo -E -u tt joj3 -conf-root /home/tt/.config/joj diff --git a/tests/immutable_file/release.yaml b/tests/immutable_file/release.yaml new file mode 100644 index 0000000..afd2838 --- /dev/null +++ b/tests/immutable_file/release.yaml @@ -0,0 +1,20 @@ +name: Run JOJ3 on Release +on: + release: + types: [published] +jobs: + run: + container: + image: focs.ji.sjtu.edu.cn:5000/gitea/runner-images:focs-ubuntu-latest-slim + volumes: + - /home/tt/.config:/home/tt/.config + - /home/tt/.cache:/home/tt/.cache + - /home/tt/.ssh:/home/tt/.ssh + steps: + - name: Check out repository code + uses: https://gitea.com/BoYanZh/checkout@focs + with: + fetch-depth: 0 + - name: run joj3 + run: | + sudo -E -u tt joj3 -conf-root /home/tt/.config/joj -msg "feat(h1-release): joj on ${{ github.ref }}" From cf034ba737fb49128834eb01020d92a5a31fcd13 Mon Sep 17 00:00:00 2001 From: Nuvole Date: Sun, 27 Oct 2024 11:13:56 +0800 Subject: [PATCH 17/17] feat: sync --- tests/basic/task.json | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/tests/basic/task.json b/tests/basic/task.json index 4ffc375..c15b691 100644 --- a/tests/basic/task.json +++ b/tests/basic/task.json @@ -18,13 +18,12 @@ "//repo-health-checker", + "0x7f64f5d532e0>/repo-health-checker", "-root=.", "-repoSize=50.5", "-meta=main.py", "-meta=README.md", - "-checkFileSumList=a5b63323a692d3d8b952442969649b4f823d58dae26429494f613df160710dfc,b1bbad25b830db0a77b15a033f9ca1b7ab44c1d2d05056412bd3e4421645f0bf,1965adff52af61da8b9e089ff580d60f7e4c294a2930b9809c5cbdf76528de4d,c8bd62bf5297bac738b3845612fd595d677884093070904375463ab7953fce28", - "-checkFileNameList=.gitignore,.gitattributes,push.yaml,release.yaml" + "-checkFileSumList=-checkFileNameList=" ], "env": [ "PATH=/usr/bin:/bin:/usr/local/bin" @@ -71,8 +70,8 @@ "cpuRateLimit": 0, "cpuSetLimit": "", "copyIn": { - "//tmp/repo-checker-u3awlhwg/repo-health-checker": { - "src": "//tmp/repo-checker-mc0n0t1l/repo-health-checker", + "//tmp/repo-checker-lf3ranpy/repo-health-checker": { + "src": "//tmp/repo-checker-gd58j2qv/repo-health-checker", "content": null, "fileId": null, "name": null,