feat: automatically create default fallback conf
This commit is contained in:
parent
8f96115e6e
commit
8b16214be4
|
@ -95,6 +95,9 @@ def convert(
|
|||
app.pretty_exceptions_enable = False
|
||||
logger.info(f"Converting files in {root.absolute()}")
|
||||
for repo_toml_path in root.glob("**/repo.toml"):
|
||||
fallback_toml_path = repo_toml_path.parent / "conf.toml"
|
||||
if not fallback_toml_path.exists():
|
||||
fallback_toml_path.write_text('name = "invalid commit"\n')
|
||||
for task_toml_path in repo_toml_path.parent.glob("**/*.toml"):
|
||||
if repo_toml_path == task_toml_path:
|
||||
continue
|
||||
|
|
0
tests/convert/empty/repo.toml
Normal file
0
tests/convert/empty/repo.toml
Normal file
182
tests/convert/empty/task.json
Normal file
182
tests/convert/empty/task.json
Normal file
|
@ -0,0 +1,182 @@
|
|||
{
|
||||
"name": "invalid commit",
|
||||
"logPath": "/home/tt/.cache/joj3/invalid/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",
|
||||
"-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.csv"
|
||||
],
|
||||
"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": {}
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"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.csv"
|
||||
],
|
||||
"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": {}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
1
tests/convert/empty/task.toml
Normal file
1
tests/convert/empty/task.toml
Normal file
|
@ -0,0 +1 @@
|
|||
name = "invalid commit"
|
|
@ -25,6 +25,10 @@ def test_elf() -> None:
|
|||
load_case("elf")
|
||||
|
||||
|
||||
def test_empty() -> None:
|
||||
load_case("empty")
|
||||
|
||||
|
||||
def test_keyword() -> None:
|
||||
load_case("keyword")
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user