docs: full toml sample
This commit is contained in:
		
							parent
							
								
									b3581a4071
								
							
						
					
					
						commit
						306785ddb3
					
				
							
								
								
									
										337
									
								
								tests/convert/full/task.json
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										337
									
								
								tests/convert/full/task.json
									
									
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,337 @@ | ||||||
|  | { | ||||||
|  |     "name": "hw7 ex3", | ||||||
|  |     "logPath": "/home/tt/.cache/joj3/hw7/joj3.log", | ||||||
|  |     "expireUnixTimestamp": 0, | ||||||
|  |     "effectiveUnixTimestamp": 0, | ||||||
|  |     "actorCsvPath": "/home/tt/.config/joj/students.csv", | ||||||
|  |     "maxTotalScore": 100, | ||||||
|  |     "stage": { | ||||||
|  |         "sandboxExecServer": "172.17.0.1:5051", | ||||||
|  |         "sandboxToken": "", | ||||||
|  |         "outputPath": "/tmp/joj3_result.json", | ||||||
|  |         "stages": [ | ||||||
|  |             { | ||||||
|  |                 "name": "Health Check", | ||||||
|  |                 "group": "", | ||||||
|  |                 "executor": { | ||||||
|  |                     "name": "local", | ||||||
|  |                     "with": { | ||||||
|  |                         "default": { | ||||||
|  |                             "args": [], | ||||||
|  |                             "env": [ | ||||||
|  |                                 "PATH=/usr/bin:/bin:/usr/local/bin" | ||||||
|  |                             ], | ||||||
|  |                             "stdin": { | ||||||
|  |                                 "content": "" | ||||||
|  |                             }, | ||||||
|  |                             "stdout": { | ||||||
|  |                                 "name": "stdout", | ||||||
|  |                                 "max": 33554432, | ||||||
|  |                                 "pipe": true | ||||||
|  |                             }, | ||||||
|  |                             "stderr": { | ||||||
|  |                                 "name": "stderr", | ||||||
|  |                                 "max": 33554432, | ||||||
|  |                                 "pipe": true | ||||||
|  |                             }, | ||||||
|  |                             "cpuLimit": 10000000000, | ||||||
|  |                             "clockLimit": 20000000000, | ||||||
|  |                             "memoryLimit": 268435456, | ||||||
|  |                             "stackLimit": 0, | ||||||
|  |                             "procLimit": 50, | ||||||
|  |                             "cpuRateLimit": 0, | ||||||
|  |                             "cpuSetLimit": "", | ||||||
|  |                             "copyIn": {}, | ||||||
|  |                             "copyInCached": {}, | ||||||
|  |                             "copyInDir": ".", | ||||||
|  |                             "copyOut": [ | ||||||
|  |                                 "stdout", | ||||||
|  |                                 "stderr" | ||||||
|  |                             ], | ||||||
|  |                             "copyOutCached": [], | ||||||
|  |                             "copyOutMax": 0, | ||||||
|  |                             "copyOutDir": "", | ||||||
|  |                             "tty": false, | ||||||
|  |                             "strictMemoryLimit": false, | ||||||
|  |                             "dataSegmentLimit": false, | ||||||
|  |                             "addressSpaceLimit": false | ||||||
|  |                         }, | ||||||
|  |                         "cases": [ | ||||||
|  |                             { | ||||||
|  |                                 "args": [ | ||||||
|  |                                     "/usr/local/bin/repo-health-checker", | ||||||
|  |                                     "-root=.", | ||||||
|  |                                     "-repoSize=10.0", | ||||||
|  |                                     "-meta=README.md", | ||||||
|  |                                     "-meta=Changelog.md", | ||||||
|  |                                     "-checkFileSumList=", | ||||||
|  |                                     "-checkFileNameList=" | ||||||
|  |                                 ] | ||||||
|  |                             }, | ||||||
|  |                             { | ||||||
|  |                                 "args": [ | ||||||
|  |                                     "/usr/local/bin/joint-teapot", | ||||||
|  |                                     "joj3-check-env", | ||||||
|  |                                     "/home/tt/.config/teapot/teapot.env", | ||||||
|  |                                     "--grading-repo-name", | ||||||
|  |                                     "JOJ3-config-generator", | ||||||
|  |                                     "--scoreboard-filename", | ||||||
|  |                                     "scoreboard-hw7.csv", | ||||||
|  |                                     "--group-config", | ||||||
|  |                                     "joj=1000:24,run=100:1", | ||||||
|  |                                     "--begin-time", | ||||||
|  |                                     "2024-12-29T23:59:59", | ||||||
|  |                                     "--end-time", | ||||||
|  |                                     "2024-12-30T23:59:59", | ||||||
|  |                                     "--penalty-config", | ||||||
|  |                                     "24.0=0.75,48.0=0.5,72.0=0.25" | ||||||
|  |                                 ], | ||||||
|  |                                 "env": [ | ||||||
|  |                                     "REPOS_DIR=/home/tt/.cache", | ||||||
|  |                                     "LOG_FILE_PATH=/home/tt/.cache/joint-teapot-debug.log" | ||||||
|  |                                 ] | ||||||
|  |                             } | ||||||
|  |                         ] | ||||||
|  |                     } | ||||||
|  |                 }, | ||||||
|  |                 "parsers": [ | ||||||
|  |                     { | ||||||
|  |                         "name": "healthcheck", | ||||||
|  |                         "with": { | ||||||
|  |                             "score": 0 | ||||||
|  |                         } | ||||||
|  |                     }, | ||||||
|  |                     { | ||||||
|  |                         "name": "debug", | ||||||
|  |                         "with": {} | ||||||
|  |                     } | ||||||
|  |                 ] | ||||||
|  |             }, | ||||||
|  |             { | ||||||
|  |                 "name": "Generate yes.txt [no]", | ||||||
|  |                 "group": "no", | ||||||
|  |                 "executor": { | ||||||
|  |                     "name": "sandbox", | ||||||
|  |                     "with": { | ||||||
|  |                         "default": { | ||||||
|  |                             "args": [ | ||||||
|  |                                 "sh", | ||||||
|  |                                 "-c", | ||||||
|  |                                 "yes | head -n 10 > yes.txt" | ||||||
|  |                             ], | ||||||
|  |                             "env": [ | ||||||
|  |                                 "PATH=/usr/bin:/bin:/usr/local/bin", | ||||||
|  |                                 "THE_ANSWER=42" | ||||||
|  |                             ], | ||||||
|  |                             "stdin": { | ||||||
|  |                                 "content": "" | ||||||
|  |                             }, | ||||||
|  |                             "stdout": { | ||||||
|  |                                 "name": "stdout", | ||||||
|  |                                 "max": 33554432, | ||||||
|  |                                 "pipe": true | ||||||
|  |                             }, | ||||||
|  |                             "stderr": { | ||||||
|  |                                 "name": "stderr", | ||||||
|  |                                 "max": 33554432, | ||||||
|  |                                 "pipe": true | ||||||
|  |                             }, | ||||||
|  |                             "cpuLimit": 1000000000, | ||||||
|  |                             "clockLimit": 2000000000, | ||||||
|  |                             "memoryLimit": 268435456, | ||||||
|  |                             "stackLimit": 0, | ||||||
|  |                             "procLimit": 50, | ||||||
|  |                             "cpuRateLimit": 0, | ||||||
|  |                             "cpuSetLimit": "", | ||||||
|  |                             "copyIn": { | ||||||
|  |                                 "tools/filelength": { | ||||||
|  |                                     "src": "/home/tt/.config/joj/tools/filelength" | ||||||
|  |                                 }, | ||||||
|  |                                 "h7/Makefile": { | ||||||
|  |                                     "src": "/home/tt/.config/joj/tools/Makefile" | ||||||
|  |                                 } | ||||||
|  |                             }, | ||||||
|  |                             "copyInCached": {}, | ||||||
|  |                             "copyInDir": ".", | ||||||
|  |                             "copyOut": [ | ||||||
|  |                                 "stdout", | ||||||
|  |                                 "stderr" | ||||||
|  |                             ], | ||||||
|  |                             "copyOutCached": [ | ||||||
|  |                                 "yes.txt" | ||||||
|  |                             ], | ||||||
|  |                             "copyOutMax": 0, | ||||||
|  |                             "copyOutDir": "", | ||||||
|  |                             "tty": false, | ||||||
|  |                             "strictMemoryLimit": false, | ||||||
|  |                             "dataSegmentLimit": false, | ||||||
|  |                             "addressSpaceLimit": false | ||||||
|  |                         }, | ||||||
|  |                         "cases": [] | ||||||
|  |                     } | ||||||
|  |                 }, | ||||||
|  |                 "parsers": [ | ||||||
|  |                     { | ||||||
|  |                         "name": "result-status", | ||||||
|  |                         "with": { | ||||||
|  |                             "score": 0, | ||||||
|  |                             "comment": "Congrats! There is a yes.txt file generated!", | ||||||
|  |                             "forceQuitOnNotAccepted": true | ||||||
|  |                         } | ||||||
|  |                     }, | ||||||
|  |                     { | ||||||
|  |                         "name": "result-detail", | ||||||
|  |                         "with": { | ||||||
|  |                             "score": 0, | ||||||
|  |                             "comment": "", | ||||||
|  |                             "showExxecutorStatus": true, | ||||||
|  |                             "showExitStatus": true, | ||||||
|  |                             "showError": false, | ||||||
|  |                             "showTime": true, | ||||||
|  |                             "showMemory": true, | ||||||
|  |                             "showRuntime": true, | ||||||
|  |                             "showProcPeak": false, | ||||||
|  |                             "showFiles": [], | ||||||
|  |                             "filesInCodeBlock": true, | ||||||
|  |                             "maxFileLength": 2048 | ||||||
|  |                         } | ||||||
|  |                     }, | ||||||
|  |                     { | ||||||
|  |                         "name": "keyword", | ||||||
|  |                         "with": { | ||||||
|  |                             "score": 0, | ||||||
|  |                             "matches": [] | ||||||
|  |                         } | ||||||
|  |                     }, | ||||||
|  |                     { | ||||||
|  |                         "name": "clangtidy", | ||||||
|  |                         "with": { | ||||||
|  |                             "score": 0, | ||||||
|  |                             "matches": [] | ||||||
|  |                         } | ||||||
|  |                     }, | ||||||
|  |                     { | ||||||
|  |                         "name": "cppcheck", | ||||||
|  |                         "with": { | ||||||
|  |                             "score": 0, | ||||||
|  |                             "matches": [] | ||||||
|  |                         } | ||||||
|  |                     }, | ||||||
|  |                     { | ||||||
|  |                         "name": "cpplint", | ||||||
|  |                         "with": { | ||||||
|  |                             "score": 0, | ||||||
|  |                             "matches": [] | ||||||
|  |                         } | ||||||
|  |                     }, | ||||||
|  |                     { | ||||||
|  |                         "name": "elf", | ||||||
|  |                         "with": { | ||||||
|  |                             "score": 0, | ||||||
|  |                             "matches": [] | ||||||
|  |                         } | ||||||
|  |                     }, | ||||||
|  |                     { | ||||||
|  |                         "name": "dummy", | ||||||
|  |                         "with": { | ||||||
|  |                             "score": 0, | ||||||
|  |                             "comment": "", | ||||||
|  |                             "forceQuit": false | ||||||
|  |                         } | ||||||
|  |                     }, | ||||||
|  |                     { | ||||||
|  |                         "name": "diff", | ||||||
|  |                         "with": { | ||||||
|  |                             "name": "diff", | ||||||
|  |                             "cases": [] | ||||||
|  |                         } | ||||||
|  |                     } | ||||||
|  |                 ] | ||||||
|  |             } | ||||||
|  |         ], | ||||||
|  |         "preStages": [], | ||||||
|  |         "postStages": [ | ||||||
|  |             { | ||||||
|  |                 "name": "teapot", | ||||||
|  |                 "group": "", | ||||||
|  |                 "executor": { | ||||||
|  |                     "name": "local", | ||||||
|  |                     "with": { | ||||||
|  |                         "default": { | ||||||
|  |                             "args": [ | ||||||
|  |                                 "/usr/local/bin/joint-teapot", | ||||||
|  |                                 "joj3-all-env", | ||||||
|  |                                 "/home/tt/.config/teapot/teapot.env", | ||||||
|  |                                 "--grading-repo-name", | ||||||
|  |                                 "JOJ3-config-generator", | ||||||
|  |                                 "--max-total-score", | ||||||
|  |                                 "100", | ||||||
|  |                                 "--issue-label-name", | ||||||
|  |                                 "Kind/Testing", | ||||||
|  |                                 "--issue-label-color", | ||||||
|  |                                 "#795548", | ||||||
|  |                                 "--scoreboard-filename", | ||||||
|  |                                 "scoreboard-hw7.csv", | ||||||
|  |                                 "--end-time", | ||||||
|  |                                 "2024-12-30T23:59:59", | ||||||
|  |                                 "--penalty-config", | ||||||
|  |                                 "24.0=0.75,48.0=0.5,72.0=0.25" | ||||||
|  |                             ], | ||||||
|  |                             "env": [ | ||||||
|  |                                 "REPOS_DIR=/home/tt/.cache", | ||||||
|  |                                 "LOG_FILE_PATH=/home/tt/.cache/joint-teapot-debug.log" | ||||||
|  |                             ], | ||||||
|  |                             "stdin": { | ||||||
|  |                                 "content": "" | ||||||
|  |                             }, | ||||||
|  |                             "stdout": { | ||||||
|  |                                 "name": "stdout", | ||||||
|  |                                 "max": 33554432, | ||||||
|  |                                 "pipe": true | ||||||
|  |                             }, | ||||||
|  |                             "stderr": { | ||||||
|  |                                 "name": "stderr", | ||||||
|  |                                 "max": 33554432, | ||||||
|  |                                 "pipe": true | ||||||
|  |                             }, | ||||||
|  |                             "cpuLimit": 30000000000, | ||||||
|  |                             "clockLimit": 60000000000, | ||||||
|  |                             "memoryLimit": 268435456, | ||||||
|  |                             "stackLimit": 0, | ||||||
|  |                             "procLimit": 50, | ||||||
|  |                             "cpuRateLimit": 0, | ||||||
|  |                             "cpuSetLimit": "", | ||||||
|  |                             "copyIn": {}, | ||||||
|  |                             "copyInCached": {}, | ||||||
|  |                             "copyInDir": ".", | ||||||
|  |                             "copyOut": [ | ||||||
|  |                                 "stdout", | ||||||
|  |                                 "stderr" | ||||||
|  |                             ], | ||||||
|  |                             "copyOutCached": [], | ||||||
|  |                             "copyOutMax": 0, | ||||||
|  |                             "copyOutDir": "", | ||||||
|  |                             "tty": false, | ||||||
|  |                             "strictMemoryLimit": false, | ||||||
|  |                             "dataSegmentLimit": false, | ||||||
|  |                             "addressSpaceLimit": false | ||||||
|  |                         }, | ||||||
|  |                         "cases": [] | ||||||
|  |                     } | ||||||
|  |                 }, | ||||||
|  |                 "parsers": [ | ||||||
|  |                     { | ||||||
|  |                         "name": "log", | ||||||
|  |                         "with": { | ||||||
|  |                             "msg": "joj3 summary" | ||||||
|  |                         } | ||||||
|  |                     }, | ||||||
|  |                     { | ||||||
|  |                         "name": "debug", | ||||||
|  |                         "with": {} | ||||||
|  |                     } | ||||||
|  |                 ] | ||||||
|  |             } | ||||||
|  |         ] | ||||||
|  |     } | ||||||
|  | } | ||||||
							
								
								
									
										143
									
								
								tests/convert/full/task.toml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										143
									
								
								tests/convert/full/task.toml
									
									
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,143 @@ | ||||||
|  | name = "hw7 ex3" # task name, will be shown in the issue title | ||||||
|  | 
 | ||||||
|  | # scoreboard file name in grading repo, "auto" for automatic generation, optional | ||||||
|  | scoreboard = "auto" | ||||||
|  | # scoreboard = "scoreboard.md" # use this if you want to specify a custom scoreboard | ||||||
|  | 
 | ||||||
|  | # task triggered not in this time period will not pass the health check | ||||||
|  | time.begin = 2024-12-29 23:59:59 # begin time, optional | ||||||
|  | time.end = 2024-12-30 23:59:59 # end time, optional | ||||||
|  | 
 | ||||||
|  | # explanation of the following config: | ||||||
|  | # if the submission is within 0-24 hours late from time.end, | ||||||
|  | # the final score will be multiplied by 0.75 | ||||||
|  | # if the submission is within 24-48 hours, multiplied by 0.5 | ||||||
|  | # if the submission is within 48-72 hours, multiplied by 0.25 | ||||||
|  | penalties.hours = [24, 48, 72] # penalty hours for late submissions | ||||||
|  | penalties.factors = [0.75, 0.5, 0.25] # penalty factors for late submissions | ||||||
|  | 
 | ||||||
|  | # check repo.toml, fields below can override repo.toml | ||||||
|  | max-total-score = 100 | ||||||
|  | groups.name = ["joj", "run"] | ||||||
|  | groups.max-count = [1000, 100] | ||||||
|  | groups.time-period-hour = [24, 1] | ||||||
|  | 
 | ||||||
|  | # list of stages | ||||||
|  | [[stages]] | ||||||
|  | # stage name, content in the `[]` set the group | ||||||
|  | # conventional commit message needs to contain the group name to run it | ||||||
|  | # e.g. commit msg "test(hw7): run yes" will not run this stage | ||||||
|  | # commit msg "test(hw7): run yes [no]" will run this stage | ||||||
|  | name = "Generate yes.txt [no]" | ||||||
|  | 
 | ||||||
|  | # environment variables, will be set in the sandbox | ||||||
|  | # by default, "PATH=/usr/bin:/bin:/usr/local/bin" will be inserted in the front | ||||||
|  | env = ["THE_ANSWER=42"] | ||||||
|  | command = "sh -c 'yes | head -n 10 > yes.txt'" # command to run in the sandbox, use `sh -c` to run shell commands | ||||||
|  | # files to import into the sandbox, relative to `/home/tt/.config/joj/` | ||||||
|  | # e.g. this will copy `/home/tt/.config/joj/tools/filelength` in host | ||||||
|  | # to `/w/tools/filelength` in the sandbox as work dir in sandbox is `/w` | ||||||
|  | files.import = [ "tools/filelength" ] | ||||||
|  | # files to import into the sandbox | ||||||
|  | # key is the path in the host, value is the path in the sandbox | ||||||
|  | # e.g. this will copy `/home/tt/.config/joj/h7/Makefile` in host | ||||||
|  | # to `/w/tools/Makefile` in the sandbox | ||||||
|  | files.import-map = { "tools/Makefile"= "h7/Makefile" } | ||||||
|  | # files to export from the sandbox, relative to `/w`, will be imported to later | ||||||
|  | # stages automatically | ||||||
|  | files.export = [ "yes.txt" ] | ||||||
|  | # whether to copy all files from the current working directory from host (i.e. the whole repo) | ||||||
|  | copy-in-cwd = true # default: true | ||||||
|  | 
 | ||||||
|  | limit.cpu = "1s" # CPU time limit, default: "1s" | ||||||
|  | limit.mem = "256m" # memory limit, default: "256m" | ||||||
|  | limit.time = "2s" # wall-clock time limit, if not set, will be 2x CPU time | ||||||
|  | limit.stdout = "32m" # stdout size limit, default: "32m" | ||||||
|  | limit.stderr = "32m" # stderr size limit, default: "32m" | ||||||
|  | limit.proc = 50 # process limit, default: 50 | ||||||
|  | 
 | ||||||
|  | # parsers to use for this stage | ||||||
|  | # parsers will be run in the order they are listed, | ||||||
|  | # which defines the order of the output comment | ||||||
|  | # all possible parsers are listed here | ||||||
|  | parsers = [ | ||||||
|  |     "result-status", # check if result status is Accepted | ||||||
|  |     "result-detail", # show result details (CPU time, memory, etc.) | ||||||
|  |     "keyword", # match keywords in the output and score them | ||||||
|  |     "clangtidy", # parse clang-tidy output, and match keywords | ||||||
|  |     "cppcheck", # parse cppcheck output, and match keywords | ||||||
|  |     "cpplint", # parse cpplint output, and match keywords | ||||||
|  |     "elf", # parse elf (static analyzer for elm) output, and match keywords | ||||||
|  |     "dummy", # dummy parser, used to show a comment | ||||||
|  |     "diff", # diff the output with the expected output | ||||||
|  | ] | ||||||
|  | 
 | ||||||
|  | result-status.score = 0 | ||||||
|  | result-status.comment = "Congrats! There is a yes.txt file generated!" | ||||||
|  | result-status.force-quit = true | ||||||
|  | 
 | ||||||
|  | result-detail.cpu-time = true | ||||||
|  | result-detail.time = true | ||||||
|  | result-detail.mem = true | ||||||
|  | result-detail.stdout = false | ||||||
|  | result-detail.stderr = false | ||||||
|  | result-detail.exit-status = true | ||||||
|  | result-detail.proc-peak = false | ||||||
|  | result-detail.error = false | ||||||
|  | result-detail.code-block = true | ||||||
|  | result-detail.max-length = 2048 | ||||||
|  | 
 | ||||||
|  | keyword.score = 0 | ||||||
|  | keyword.keyword = [] | ||||||
|  | keyword.weight = [] | ||||||
|  | 
 | ||||||
|  | clangtidy.score = 0 | ||||||
|  | clangtidy.keyword = [] | ||||||
|  | clangtidy.weight = [] | ||||||
|  | 
 | ||||||
|  | cppcheck.score = 0 | ||||||
|  | cppcheck.keyword = [] | ||||||
|  | cppcheck.weight = [] | ||||||
|  | 
 | ||||||
|  | cpplint.score = 0 | ||||||
|  | cpplint.keyword = [] | ||||||
|  | cpplint.weight = [] | ||||||
|  | 
 | ||||||
|  | elf.score = 0 | ||||||
|  | elf.keyword = [] | ||||||
|  | elf.weight = [] | ||||||
|  | 
 | ||||||
|  | dummy.score = 0 | ||||||
|  | dummy.comment = "" | ||||||
|  | dummy.force-quit = false | ||||||
|  | 
 | ||||||
|  | diff.score = 5 | ||||||
|  | diff.ignore-spaces = true | ||||||
|  | diff.hide = false | ||||||
|  | diff.force-quit = false | ||||||
|  | diff.max-length = 2048 | ||||||
|  | diff.max-lines = 50 | ||||||
|  | diff.hide-common-prefix = false | ||||||
|  | 
 | ||||||
|  | # override for cases | ||||||
|  | case0.env = [] | ||||||
|  | case0.command = "" | ||||||
|  | case0.files.import = [] | ||||||
|  | case0.files.import-map = {} | ||||||
|  | case0.files.export = [] | ||||||
|  | case0.copy-in-cwd = true | ||||||
|  | case0.in = "" | ||||||
|  | case0.out = "" | ||||||
|  | case0.limit.cpu = "1s" | ||||||
|  | case0.limit.mem = "256m" | ||||||
|  | case0.limit.time = "2s" | ||||||
|  | case0.limit.stdout = "32m" | ||||||
|  | case0.limit.stderr = "32m" | ||||||
|  | case0.limit.proc = 50 | ||||||
|  | case0.diff.score = 5 | ||||||
|  | case0.diff.ignore-spaces = true | ||||||
|  | case0.diff.hide = false | ||||||
|  | case0.diff.force-quit = false | ||||||
|  | case0.diff.max-length = 2048 | ||||||
|  | case0.diff.max-lines = 50 | ||||||
|  | case0.diff.hide-common-prefix = false | ||||||
|  | @ -29,6 +29,10 @@ def test_empty() -> None: | ||||||
|     load_case("empty") |     load_case("empty") | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|  | def test_full() -> None: | ||||||
|  |     load_case("full") | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
| def test_keyword() -> None: | def test_keyword() -> None: | ||||||
|     load_case("keyword") |     load_case("keyword") | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue
	
	Block a user