feat(elf): support for elf
This commit is contained in:
		
							parent
							
								
									ae592a3825
								
							
						
					
					
						commit
						757de69ad8
					
				|  | @ -93,6 +93,7 @@ class Parser(str, Enum): | |||
|     DUMMY = "dummy" | ||||
|     FILE = "file" | ||||
|     DIFF = "diff" | ||||
|     ELF = "elf" | ||||
| 
 | ||||
| 
 | ||||
| class Stage(BaseModel): | ||||
|  | @ -111,6 +112,7 @@ class Stage(BaseModel): | |||
|     clangtidy: ParserKeyword = ParserKeyword() | ||||
|     cppcheck: ParserKeyword = ParserKeyword() | ||||
|     cpplint: ParserKeyword = ParserKeyword() | ||||
|     elf: ParserKeyword = ParserKeyword() | ||||
|     result_detail: ParserResultDetail = Field( | ||||
|         ParserResultDetail(), alias="result-detail" | ||||
|     ) | ||||
|  |  | |||
|  | @ -55,6 +55,7 @@ def get_parser_handler_map( | |||
|     task_path: Path, | ||||
| ) -> Dict[ParserEnum, Tuple[Callable[[Any, result.Parser], None], Any]]: | ||||
|     return { | ||||
|         ParserEnum.ELF: (fix_keyword, task_stage.elf), | ||||
|         ParserEnum.CLANG_TIDY: (fix_keyword, task_stage.clangtidy), | ||||
|         ParserEnum.KEYWORD: (fix_keyword, task_stage.keyword), | ||||
|         ParserEnum.CPPCHECK: (fix_keyword, task_stage.cppcheck), | ||||
|  |  | |||
							
								
								
									
										2
									
								
								tests/convert/elf/repo.toml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										2
									
								
								tests/convert/elf/repo.toml
									
									
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,2 @@ | |||
| force_skip_health_check_on_test = true | ||||
| force_skip_teapot_on_test = true | ||||
							
								
								
									
										122
									
								
								tests/convert/elf/task.json
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										122
									
								
								tests/convert/elf/task.json
									
									
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,122 @@ | |||
| { | ||||
|     "name": "hw7 ex2", | ||||
|     "logPath": "/home/tt/.cache/joj3/joj3.log", | ||||
|     "expireUnixTimestamp": 1735574399, | ||||
|     "effectiveUnixTimestamp": 1735487999, | ||||
|     "actorCsvPath": "/home/tt/.config/joj/students.csv", | ||||
|     "maxTotalScore": 100, | ||||
|     "stage": { | ||||
|         "sandboxExecServer": "172.17.0.1:5051", | ||||
|         "sandboxToken": "", | ||||
|         "outputPath": "/tmp/joj3_result.json", | ||||
|         "stages": [ | ||||
|             { | ||||
|                 "name": "[cq] elf", | ||||
|                 "group": "cq", | ||||
|                 "executor": { | ||||
|                     "name": "sandbox", | ||||
|                     "with": { | ||||
|                         "default": { | ||||
|                             "args": [ | ||||
|                                 "elf", | ||||
|                                 "./", | ||||
|                                 "--md" | ||||
|                             ], | ||||
|                             "env": [ | ||||
|                                 "PATH=/usr/bin:/bin:/usr/local/bin" | ||||
|                             ], | ||||
|                             "stdin": { | ||||
|                                 "content": "" | ||||
|                             }, | ||||
|                             "stdout": { | ||||
|                                 "name": "stdout", | ||||
|                                 "max": 68157440, | ||||
|                                 "pipe": true | ||||
|                             }, | ||||
|                             "stderr": { | ||||
|                                 "name": "stderr", | ||||
|                                 "max": 33554432, | ||||
|                                 "pipe": true | ||||
|                             }, | ||||
|                             "cpuLimit": 1000000000, | ||||
|                             "clockLimit": 2000000000, | ||||
|                             "memoryLimit": 268435456, | ||||
|                             "stackLimit": 0, | ||||
|                             "procLimit": 50, | ||||
|                             "cpuRateLimit": 0, | ||||
|                             "cpuSetLimit": "", | ||||
|                             "copyIn": { | ||||
|                                 "tests/homework/h7/.clang-tidy": { | ||||
|                                     "src": "/home/tt/.config/joj/tests/homework/h7/.clang-tidy" | ||||
|                                 }, | ||||
|                                 "h7/build/compile_commands.json": { | ||||
|                                     "src": "/home/tt/.config/joj/h7/build/compile_commands.json" | ||||
|                                 } | ||||
|                             }, | ||||
|                             "copyInCached": {}, | ||||
|                             "copyInDir": ".", | ||||
|                             "copyOut": [ | ||||
|                                 "stdout", | ||||
|                                 "stderr" | ||||
|                             ], | ||||
|                             "copyOutCached": [], | ||||
|                             "copyOutMax": 0, | ||||
|                             "copyOutDir": "", | ||||
|                             "tty": false, | ||||
|                             "strictMemoryLimit": false, | ||||
|                             "dataSegmentLimit": false, | ||||
|                             "addressSpaceLimit": false | ||||
|                         }, | ||||
|                         "cases": [] | ||||
|                     } | ||||
|                 }, | ||||
|                 "parsers": [ | ||||
|                     { | ||||
|                         "name": "elf", | ||||
|                         "with": { | ||||
|                             "matches": [ | ||||
|                                 { | ||||
|                                     "keywords": [ | ||||
|                                         "Parentheses" | ||||
|                                     ], | ||||
|                                     "score": 100 | ||||
|                                 }, | ||||
|                                 { | ||||
|                                     "keywords": [ | ||||
|                                         "Length" | ||||
|                                     ], | ||||
|                                     "score": 300 | ||||
|                                 }, | ||||
|                                 { | ||||
|                                     "keywords": [ | ||||
|                                         "Arity" | ||||
|                                     ], | ||||
|                                     "score": 50 | ||||
|                                 }, | ||||
|                                 { | ||||
|                                     "keywords": [ | ||||
|                                         "Repetitive" | ||||
|                                     ], | ||||
|                                     "score": 80 | ||||
|                                 } | ||||
|                             ] | ||||
|                         } | ||||
|                     }, | ||||
|                     { | ||||
|                         "name": "result-detail", | ||||
|                         "with": { | ||||
|                             "score": 0, | ||||
|                             "comment": "", | ||||
|                             "showFiles": [], | ||||
|                             "showExitStatus": true, | ||||
|                             "showRuntime": false, | ||||
|                             "showMemory": false | ||||
|                         } | ||||
|                     } | ||||
|                 ] | ||||
|             } | ||||
|         ], | ||||
|         "preStages": [], | ||||
|         "postStages": [] | ||||
|     } | ||||
| } | ||||
							
								
								
									
										17
									
								
								tests/convert/elf/task.toml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										17
									
								
								tests/convert/elf/task.toml
									
									
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,17 @@ | |||
| # general task configuration | ||||
| task.name = "hw7 ex2" # task name | ||||
| 
 | ||||
| release.end_time = 2024-12-30 23:59:59+08:00 | ||||
| release.begin_time = 2024-12-29 23:59:59+08:00 | ||||
| 
 | ||||
| [[stages]] | ||||
| name = "[cq] elf" | ||||
| command = "elf ./ --md" | ||||
| files.import = [ "tests/homework/h7/.clang-tidy", "h7/build/compile_commands.json" ] | ||||
| limit.stdout = "65m" | ||||
| 
 | ||||
| parsers = [ "elf", "result-detail" ] | ||||
| elf.keyword = ["Parentheses", "Length", "Arity", "Repetitive"] | ||||
| elf.weight = [100, 300, 50, 80] | ||||
| result-detail.time = false | ||||
| result-detail.mem = false | ||||
|  | @ -27,3 +27,7 @@ def test_keyword() -> None: | |||
| 
 | ||||
| def test_result_detail() -> None: | ||||
|     load_case("result-detail") | ||||
| 
 | ||||
| 
 | ||||
| def test_elf() -> None: | ||||
|     load_case("elf") | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue
	
	Block a user