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