Compare commits
11 Commits
e775992e5d
...
26df677b36
Author | SHA1 | Date | |
---|---|---|---|
26df677b36 | |||
391d61d006 | |||
a8a7fd47a0 | |||
ba456cf7f0 | |||
305663538d | |||
81e08b4a8c | |||
2c78d75e07 | |||
56c4981340 | |||
160f16ca2b | |||
19f5c7193f | |||
48c04d2830 |
|
@ -30,6 +30,7 @@ jobs:
|
||||||
run: |
|
run: |
|
||||||
pdm run coverage
|
pdm run coverage
|
||||||
- name: Upload Coverage to Codacy
|
- name: Upload Coverage to Codacy
|
||||||
|
if: github.ref == 'refs/heads/master'
|
||||||
env:
|
env:
|
||||||
CODACY_PROJECT_TOKEN: ${{ secrets.CODACY_PROJECT_TOKEN }}
|
CODACY_PROJECT_TOKEN: ${{ secrets.CODACY_PROJECT_TOKEN }}
|
||||||
run: |
|
run: |
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from typing import Tuple
|
from typing import Tuple, Type, cast
|
||||||
|
|
||||||
import inquirer
|
import inquirer
|
||||||
import tomli
|
import tomli
|
||||||
|
@ -10,8 +10,15 @@ from joj3_config_generator.models import answer, joj1, repo, task
|
||||||
|
|
||||||
def load_joj3_task_toml_answers() -> answer.Answers:
|
def load_joj3_task_toml_answers() -> answer.Answers:
|
||||||
name = inquirer.text("What's the task name?", default="hw0")
|
name = inquirer.text("What's the task name?", default="hw0")
|
||||||
language: answer.LanguageInterface = inquirer.list_input(
|
language = inquirer.list_input(
|
||||||
"What's the language?", choices=answer.LANGUAGES
|
"What's the language?", choices=[(cls.name, cls) for cls in answer.LANGUAGES]
|
||||||
|
)
|
||||||
|
language = cast(Type[answer.LanguageInterface], language)
|
||||||
|
if inquirer.confirm("Load content from templates?", default=True):
|
||||||
|
answers = inquirer.prompt(language.get_template_questions())
|
||||||
|
template_file_content: str = answers["template_file_content"]
|
||||||
|
return answer.Answers(
|
||||||
|
name=name, language=language, template_file_content=template_file_content
|
||||||
)
|
)
|
||||||
stages = inquirer.checkbox(
|
stages = inquirer.checkbox(
|
||||||
"What's the stages?",
|
"What's the stages?",
|
||||||
|
|
|
@ -1,14 +1,14 @@
|
||||||
from abc import ABC, abstractmethod
|
from abc import ABC, abstractmethod
|
||||||
from enum import Enum
|
from enum import Enum
|
||||||
from typing import Any, ClassVar, Dict, List
|
from importlib import resources
|
||||||
|
from typing import Any, ClassVar, Dict, List, Type
|
||||||
|
|
||||||
import inquirer
|
import inquirer
|
||||||
from pydantic import BaseModel, ConfigDict
|
from pydantic import BaseModel, ConfigDict
|
||||||
|
|
||||||
|
|
||||||
class LanguageInterface(ABC):
|
class LanguageInterface(ABC):
|
||||||
@abstractmethod
|
name: ClassVar[str]
|
||||||
def __str__(self) -> str: ...
|
|
||||||
|
|
||||||
@abstractmethod
|
@abstractmethod
|
||||||
class Stage(str, Enum): ...
|
class Stage(str, Enum): ...
|
||||||
|
@ -31,10 +31,25 @@ class LanguageInterface(ABC):
|
||||||
@abstractmethod
|
@abstractmethod
|
||||||
def get_attribute_questions(cls) -> List[Any]: ...
|
def get_attribute_questions(cls) -> List[Any]: ...
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def get_template_questions(cls) -> List[Any]:
|
||||||
|
anchor = "joj3_config_generator.templates"
|
||||||
|
templates_dir = resources.files(anchor).joinpath(cls.name)
|
||||||
|
choices = []
|
||||||
|
for entry in templates_dir.iterdir():
|
||||||
|
if entry.is_file() and entry.name.endswith(".toml"):
|
||||||
|
choices.append((entry.name, entry.read_text()))
|
||||||
|
return [
|
||||||
|
inquirer.List(
|
||||||
|
"template_file_content",
|
||||||
|
message="Which template file do you want?",
|
||||||
|
choices=choices,
|
||||||
|
),
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
class Cpp(LanguageInterface):
|
class Cpp(LanguageInterface):
|
||||||
def __str__(self) -> str:
|
name = "C++"
|
||||||
return "C++"
|
|
||||||
|
|
||||||
class Stage(str, Enum):
|
class Stage(str, Enum):
|
||||||
COMPILATION = "Compilation"
|
COMPILATION = "Compilation"
|
||||||
|
@ -52,23 +67,23 @@ class Cpp(LanguageInterface):
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def get_attribute_questions(cls) -> List[Any]:
|
def get_attribute_questions(cls) -> List[Any]:
|
||||||
|
attribute: Cpp.Attribute = cls.attribute
|
||||||
return [
|
return [
|
||||||
inquirer.Text(
|
inquirer.Text(
|
||||||
name="compile_command",
|
name="compile_command",
|
||||||
message="Compile command",
|
message="Compile command",
|
||||||
default=cls.attribute.compile_command,
|
default=attribute.compile_command,
|
||||||
),
|
),
|
||||||
inquirer.Text(
|
inquirer.Text(
|
||||||
name="run_command",
|
name="run_command",
|
||||||
message="Run command",
|
message="Run command",
|
||||||
default=cls.attribute.run_command,
|
default=attribute.run_command,
|
||||||
),
|
),
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
class Python(LanguageInterface):
|
class Python(LanguageInterface):
|
||||||
def __str__(self) -> str:
|
name = "Python"
|
||||||
return "Python"
|
|
||||||
|
|
||||||
class Stage(str, Enum):
|
class Stage(str, Enum):
|
||||||
RUN = "Run"
|
RUN = "Run"
|
||||||
|
@ -81,18 +96,18 @@ class Python(LanguageInterface):
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def get_attribute_questions(cls) -> List[Any]:
|
def get_attribute_questions(cls) -> List[Any]:
|
||||||
|
attribute: Python.Attribute = cls.attribute
|
||||||
return [
|
return [
|
||||||
inquirer.Text(
|
inquirer.Text(
|
||||||
name="run_command",
|
name="run_command",
|
||||||
message="Run command",
|
message="Run command",
|
||||||
default=cls.attribute.run_command,
|
default=attribute.run_command,
|
||||||
),
|
),
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
class Rust(LanguageInterface):
|
class Rust(LanguageInterface):
|
||||||
def __str__(self) -> str:
|
name = "Rust"
|
||||||
return "Rust"
|
|
||||||
|
|
||||||
class Stage(str, Enum):
|
class Stage(str, Enum):
|
||||||
COMPILATION = "Compilation"
|
COMPILATION = "Compilation"
|
||||||
|
@ -107,18 +122,20 @@ class Rust(LanguageInterface):
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def get_attribute_questions(cls) -> List[Any]:
|
def get_attribute_questions(cls) -> List[Any]:
|
||||||
|
attribute: Rust.Attribute = cls.attribute
|
||||||
return []
|
return []
|
||||||
|
|
||||||
|
|
||||||
LANGUAGES = [
|
LANGUAGES: List[Type[LanguageInterface]] = [
|
||||||
Cpp(),
|
Cpp,
|
||||||
Python(),
|
Python,
|
||||||
Rust(),
|
Rust,
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
class Answers(BaseModel):
|
class Answers(BaseModel):
|
||||||
name: str
|
name: str
|
||||||
language: LanguageInterface
|
language: Type[LanguageInterface]
|
||||||
|
template_file_content: str = ""
|
||||||
|
|
||||||
model_config = ConfigDict(arbitrary_types_allowed=True)
|
model_config = ConfigDict(arbitrary_types_allowed=True)
|
||||||
|
|
|
@ -3,8 +3,9 @@ from pathlib import Path
|
||||||
from joj3_config_generator.models.common import Memory, Time
|
from joj3_config_generator.models.common import Memory, Time
|
||||||
|
|
||||||
DEFAULT_CPU_LIMIT = Time("1s")
|
DEFAULT_CPU_LIMIT = Time("1s")
|
||||||
DEFAULT_MEMORY_LIMIT = Memory("128m")
|
DEFAULT_MEMORY_LIMIT = Memory("256m")
|
||||||
DEFAULT_FILE_LIMIT = Memory("32m")
|
DEFAULT_FILE_LIMIT = Memory("32m")
|
||||||
|
DEFAULT_CASE_SCORE = 5
|
||||||
|
|
||||||
JOJ3_CONFIG_ROOT = Path("/home/tt/.config/joj")
|
JOJ3_CONFIG_ROOT = Path("/home/tt/.config/joj")
|
||||||
TEAPOT_CONFIG_ROOT = Path("/home/tt/.config/teapot")
|
TEAPOT_CONFIG_ROOT = Path("/home/tt/.config/teapot")
|
||||||
|
|
13
joj3_config_generator/templates/C++/clang-tidy.toml
Normal file
13
joj3_config_generator/templates/C++/clang-tidy.toml
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
[[stages]]
|
||||||
|
name = "[cq] Clang-tidy"
|
||||||
|
command = "run-clang-tidy-18 -header-filter=.* -quiet -load=/usr/local/lib/libcodequality.so -p h7/build h7/ex2.cpp"
|
||||||
|
files.import = [ "tests/homework/h7/.clang-tidy", "h7/build/compile_commands.json" ]
|
||||||
|
limit.stdout = "65m"
|
||||||
|
|
||||||
|
parsers = [ "clangtidy", "result-detail" ]
|
||||||
|
clangtidy.keyword = [ "codequality-unchecked-malloc-result", "codequality-no-global-variables", "codequality-no-header-guard", "codequality-no-fflush-stdin", "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", "portability" ]
|
||||||
|
clangtidy.weight = [ 5, 20, 20, 20, 10, 5, 5, 5, 15, 5, 5, 5, 5, 5, 5, 5, 5, 5]
|
||||||
|
result-detail.exitstatus = true
|
||||||
|
result-detail.stdout = true
|
||||||
|
result-detail.time = false
|
||||||
|
result-detail.mem = false
|
12
joj3_config_generator/templates/C++/cppcheck.toml
Normal file
12
joj3_config_generator/templates/C++/cppcheck.toml
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
[[stages]]
|
||||||
|
name = "[cq] Cppcheck"
|
||||||
|
command = "cppcheck --template='{\"file\":\"{file}\",\"line\":{line}, \"column\":{column}, \"severity\":\"{severity}\", \"message\":\"{message}\", \"id\":\"{id}\"}' --force --enable=all --suppress=missingIncludeSystem --quiet h7/ex2.cpp"
|
||||||
|
limit.stderr = "65m"
|
||||||
|
|
||||||
|
parsers = [ "cppcheck", "result-detail" ]
|
||||||
|
cppcheck.keyword = ["error", "warning", "portability", "performance", "style"]
|
||||||
|
cppcheck.weight = [15, 5, 5, 5, 5]
|
||||||
|
result-detail.exitstatus = true
|
||||||
|
result-detail.stderr = true
|
||||||
|
result-detail.time = false
|
||||||
|
result-detail.mem = false
|
12
joj3_config_generator/templates/C++/cpplint.toml
Normal file
12
joj3_config_generator/templates/C++/cpplint.toml
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
[[stages]]
|
||||||
|
name = "[cq] Cpplint"
|
||||||
|
command = "cpplint --linelength=120 --filter=-legal,-readability/casting,-whitespace,-runtime/printf,-runtime/threadsafe_fn,-runtime/int,-readability/todo,-build/include_subdir,-build/header_guard,-build/include_what_you_use --recursive --exclude=build h7/ex2.cpp"
|
||||||
|
limit.stdout = "65m"
|
||||||
|
|
||||||
|
parsers = ["cpplint", "result-detail"]
|
||||||
|
cpplint.keyword = ["runtime", "readability", "build"]
|
||||||
|
cpplint.weight = [5, 20, 10]
|
||||||
|
result-detail.exitstatus = true
|
||||||
|
result-detail.stderr = true
|
||||||
|
result-detail.time = false
|
||||||
|
result-detail.mem = false
|
3
joj3_config_generator/templates/Python/basic.toml
Normal file
3
joj3_config_generator/templates/Python/basic.toml
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
[[stages]]
|
||||||
|
name = "Run"
|
||||||
|
command = "python3 main.py"
|
3
joj3_config_generator/templates/Rust/basic.toml
Normal file
3
joj3_config_generator/templates/Rust/basic.toml
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
[[stages]]
|
||||||
|
name = "Run"
|
||||||
|
command = "cargo run"
|
|
@ -1,19 +1,27 @@
|
||||||
from typing import Any, Callable, Dict, List, Type
|
from typing import Any, Callable, Dict, List, Type
|
||||||
|
|
||||||
|
import tomli
|
||||||
|
|
||||||
from joj3_config_generator.models import answer, task
|
from joj3_config_generator.models import answer, task
|
||||||
|
|
||||||
|
|
||||||
def get_task_conf_from_answers(answers: answer.Answers) -> task.Config:
|
def get_task_conf_from_answers(answers: answer.Answers) -> task.Config:
|
||||||
|
if answers.template_file_content:
|
||||||
|
toml_dict = tomli.loads(answers.template_file_content)
|
||||||
|
return task.Config(
|
||||||
|
task=task.Task(name=answers.name),
|
||||||
|
stages=toml_dict["stages"],
|
||||||
|
)
|
||||||
language = answers.language
|
language = answers.language
|
||||||
transformer_dict = get_transformer_dict()
|
transformer_dict = get_transformer_dict()
|
||||||
transformer = transformer_dict[type(language)]
|
transformer = transformer_dict[language]
|
||||||
stages = transformer(language)
|
stages = transformer(language)
|
||||||
return task.Config(task=task.Task(name=answers.name), stages=stages)
|
return task.Config(task=task.Task(name=answers.name), stages=stages)
|
||||||
|
|
||||||
|
|
||||||
def get_transformer_dict() -> Dict[
|
def get_transformer_dict() -> Dict[
|
||||||
Type[Any],
|
Type[answer.LanguageInterface],
|
||||||
Callable[[Any], List[task.Stage]],
|
Callable[[Type[Any]], List[task.Stage]],
|
||||||
]:
|
]:
|
||||||
return {
|
return {
|
||||||
answer.Cpp: get_cpp_stages,
|
answer.Cpp: get_cpp_stages,
|
||||||
|
@ -23,7 +31,7 @@ def get_transformer_dict() -> Dict[
|
||||||
|
|
||||||
|
|
||||||
# TODO: implement
|
# TODO: implement
|
||||||
def get_cpp_stages(language: answer.Cpp) -> List[task.Stage]:
|
def get_cpp_stages(language: Type[answer.Cpp]) -> List[task.Stage]:
|
||||||
stages = language.stages
|
stages = language.stages
|
||||||
attribute: answer.Cpp.Attribute = language.attribute
|
attribute: answer.Cpp.Attribute = language.attribute
|
||||||
task_stages = []
|
task_stages = []
|
||||||
|
@ -39,14 +47,14 @@ def get_cpp_stages(language: answer.Cpp) -> List[task.Stage]:
|
||||||
|
|
||||||
|
|
||||||
# TODO: implement
|
# TODO: implement
|
||||||
def get_python_stages(language: answer.Python) -> List[task.Stage]:
|
def get_python_stages(language: Type[answer.Python]) -> List[task.Stage]:
|
||||||
stages = language.stages
|
stages = language.stages
|
||||||
attribute: answer.Python.Attribute = language.attribute
|
attribute: answer.Python.Attribute = language.attribute
|
||||||
return []
|
return []
|
||||||
|
|
||||||
|
|
||||||
# TODO: implement
|
# TODO: implement
|
||||||
def get_rust_stages(language: answer.Rust) -> List[task.Stage]:
|
def get_rust_stages(language: Type[answer.Rust]) -> List[task.Stage]:
|
||||||
stages = language.stages
|
stages = language.stages
|
||||||
attribute: answer.Rust.Attribute = language.attribute
|
attribute: answer.Rust.Attribute = language.attribute
|
||||||
return []
|
return []
|
||||||
|
|
|
@ -2,7 +2,7 @@ import hashlib
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from typing import List
|
from typing import List
|
||||||
|
|
||||||
from joj3_config_generator.models import repo, result
|
from joj3_config_generator.models import common, repo, result
|
||||||
from joj3_config_generator.models.const import TEAPOT_CONFIG_ROOT, TEAPOT_LOG_PATH
|
from joj3_config_generator.models.const import TEAPOT_CONFIG_ROOT, TEAPOT_LOG_PATH
|
||||||
|
|
||||||
|
|
||||||
|
@ -25,6 +25,8 @@ def get_teapot_stage(repo_conf: repo.Config) -> result.StageDetail:
|
||||||
default=result.Cmd(
|
default=result.Cmd(
|
||||||
args=args,
|
args=args,
|
||||||
env=[f"LOG_FILE_PATH={TEAPOT_LOG_PATH}"],
|
env=[f"LOG_FILE_PATH={TEAPOT_LOG_PATH}"],
|
||||||
|
cpu_limit=common.Time("30s"),
|
||||||
|
clock_limit=common.Time("60s"),
|
||||||
),
|
),
|
||||||
cases=[],
|
cases=[],
|
||||||
),
|
),
|
||||||
|
@ -71,7 +73,9 @@ def get_health_check_stage(repo_conf: repo.Config) -> result.StageDetail:
|
||||||
executor=result.Executor(
|
executor=result.Executor(
|
||||||
name="local",
|
name="local",
|
||||||
with_=result.ExecutorWith(
|
with_=result.ExecutorWith(
|
||||||
default=result.Cmd(),
|
default=result.Cmd(
|
||||||
|
cpu_limit=common.Time("10s"), clock_limit=common.Time("20s")
|
||||||
|
),
|
||||||
cases=[
|
cases=[
|
||||||
result.OptionalCmd(
|
result.OptionalCmd(
|
||||||
args=get_health_check_args(repo_conf),
|
args=get_health_check_args(repo_conf),
|
||||||
|
|
|
@ -4,7 +4,7 @@ from functools import partial
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from typing import Any, Callable, Dict, List, Set, Tuple
|
from typing import Any, Callable, Dict, List, Set, Tuple
|
||||||
|
|
||||||
from joj3_config_generator.models import result, task
|
from joj3_config_generator.models import const, result, task
|
||||||
from joj3_config_generator.models.common import Memory, Time
|
from joj3_config_generator.models.common import Memory, Time
|
||||||
from joj3_config_generator.models.const import JOJ3_CONFIG_ROOT
|
from joj3_config_generator.models.const import JOJ3_CONFIG_ROOT
|
||||||
from joj3_config_generator.models.task import Parser as ParserEnum
|
from joj3_config_generator.models.task import Parser as ParserEnum
|
||||||
|
@ -166,14 +166,25 @@ def fix_diff(
|
||||||
task_path: Path,
|
task_path: Path,
|
||||||
) -> None:
|
) -> None:
|
||||||
base_dir = JOJ3_CONFIG_ROOT / task_path.parent
|
base_dir = JOJ3_CONFIG_ROOT / task_path.parent
|
||||||
valid_cases = (
|
# all intended testcases that is detected
|
||||||
(case, task_stage.cases[case])
|
|
||||||
for case in task_stage.cases
|
|
||||||
if case not in task_stage.skip and case in task_stage.cases
|
|
||||||
)
|
|
||||||
testcases = get_testcases(task_root, task_path)
|
testcases = get_testcases(task_root, task_path)
|
||||||
# TODO: better filter strategy
|
# all testcases that is not specified in the toml config
|
||||||
default_cases = sorted(testcases.difference(task_stage.cases))
|
default_cases = sorted(
|
||||||
|
testcases.difference(
|
||||||
|
[
|
||||||
|
casei
|
||||||
|
for casei in testcases
|
||||||
|
if any(casei.endswith(casej) for casej in task_stage.cases)
|
||||||
|
]
|
||||||
|
)
|
||||||
|
)
|
||||||
|
# those in toml config that is not skiped
|
||||||
|
valid_cases = [
|
||||||
|
(casej, task_stage.cases[casei])
|
||||||
|
for casei in task_stage.cases
|
||||||
|
for casej in testcases
|
||||||
|
if (casei not in task_stage.skip and casej.endswith(casei))
|
||||||
|
]
|
||||||
stage_cases = []
|
stage_cases = []
|
||||||
parser_cases = []
|
parser_cases = []
|
||||||
for case, case_stage in valid_cases:
|
for case, case_stage in valid_cases:
|
||||||
|
@ -211,6 +222,7 @@ def fix_diff(
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
parser_cases.append(parser_case)
|
parser_cases.append(parser_case)
|
||||||
|
|
||||||
for case in default_cases:
|
for case in default_cases:
|
||||||
cmd = result.OptionalCmd(
|
cmd = result.OptionalCmd(
|
||||||
stdin=result.LocalFile(src=str(base_dir / f"{case}.in"))
|
stdin=result.LocalFile(src=str(base_dir / f"{case}.in"))
|
||||||
|
@ -219,8 +231,7 @@ def fix_diff(
|
||||||
parser_case = result.DiffCasesConfig(
|
parser_case = result.DiffCasesConfig(
|
||||||
outputs=[
|
outputs=[
|
||||||
result.DiffOutputConfig(
|
result.DiffOutputConfig(
|
||||||
# TODO: how to balance a good score strategy
|
score=const.DEFAULT_CASE_SCORE,
|
||||||
score=5, # default score
|
|
||||||
file_name="stdout",
|
file_name="stdout",
|
||||||
answer_path=str(base_dir / f"{case}.out"),
|
answer_path=str(base_dir / f"{case}.out"),
|
||||||
)
|
)
|
||||||
|
|
|
@ -32,9 +32,9 @@
|
||||||
"max": 33554432,
|
"max": 33554432,
|
||||||
"pipe": true
|
"pipe": true
|
||||||
},
|
},
|
||||||
"cpuLimit": 1000000000,
|
"cpuLimit": 10000000000,
|
||||||
"clockLimit": 2000000000,
|
"clockLimit": 20000000000,
|
||||||
"memoryLimit": 134217728,
|
"memoryLimit": 268435456,
|
||||||
"stackLimit": 0,
|
"stackLimit": 0,
|
||||||
"procLimit": 50,
|
"procLimit": 50,
|
||||||
"cpuRateLimit": 0,
|
"cpuRateLimit": 0,
|
||||||
|
@ -124,7 +124,7 @@
|
||||||
},
|
},
|
||||||
"cpuLimit": 1000000000,
|
"cpuLimit": 1000000000,
|
||||||
"clockLimit": 2000000000,
|
"clockLimit": 2000000000,
|
||||||
"memoryLimit": 134217728,
|
"memoryLimit": 268435456,
|
||||||
"stackLimit": 0,
|
"stackLimit": 0,
|
||||||
"procLimit": 50,
|
"procLimit": 50,
|
||||||
"cpuRateLimit": 0,
|
"cpuRateLimit": 0,
|
||||||
|
@ -211,7 +211,7 @@
|
||||||
},
|
},
|
||||||
"cpuLimit": 1000000000,
|
"cpuLimit": 1000000000,
|
||||||
"clockLimit": 2000000000,
|
"clockLimit": 2000000000,
|
||||||
"memoryLimit": 134217728,
|
"memoryLimit": 268435456,
|
||||||
"stackLimit": 0,
|
"stackLimit": 0,
|
||||||
"procLimit": 50,
|
"procLimit": 50,
|
||||||
"cpuRateLimit": 0,
|
"cpuRateLimit": 0,
|
||||||
|
@ -311,7 +311,7 @@
|
||||||
},
|
},
|
||||||
"cpuLimit": 1000000000,
|
"cpuLimit": 1000000000,
|
||||||
"clockLimit": 2000000000,
|
"clockLimit": 2000000000,
|
||||||
"memoryLimit": 134217728,
|
"memoryLimit": 268435456,
|
||||||
"stackLimit": 0,
|
"stackLimit": 0,
|
||||||
"procLimit": 50,
|
"procLimit": 50,
|
||||||
"cpuRateLimit": 0,
|
"cpuRateLimit": 0,
|
||||||
|
@ -437,7 +437,7 @@
|
||||||
},
|
},
|
||||||
"cpuLimit": 1000000000,
|
"cpuLimit": 1000000000,
|
||||||
"clockLimit": 2000000000,
|
"clockLimit": 2000000000,
|
||||||
"memoryLimit": 134217728,
|
"memoryLimit": 268435456,
|
||||||
"stackLimit": 0,
|
"stackLimit": 0,
|
||||||
"procLimit": 50,
|
"procLimit": 50,
|
||||||
"cpuRateLimit": 0,
|
"cpuRateLimit": 0,
|
||||||
|
@ -582,7 +582,7 @@
|
||||||
},
|
},
|
||||||
"cpuLimit": 1000000000,
|
"cpuLimit": 1000000000,
|
||||||
"clockLimit": 2000000000,
|
"clockLimit": 2000000000,
|
||||||
"memoryLimit": 134217728,
|
"memoryLimit": 268435456,
|
||||||
"stackLimit": 0,
|
"stackLimit": 0,
|
||||||
"procLimit": 50,
|
"procLimit": 50,
|
||||||
"cpuRateLimit": 0,
|
"cpuRateLimit": 0,
|
||||||
|
@ -705,22 +705,7 @@
|
||||||
"dataSegmentLimit": false,
|
"dataSegmentLimit": false,
|
||||||
"addressSpaceLimit": false
|
"addressSpaceLimit": false
|
||||||
},
|
},
|
||||||
"cases": [
|
"cases": []
|
||||||
{
|
|
||||||
"stdin": {
|
|
||||||
"src": "/home/tt/.config/joj/basic/case0.in"
|
|
||||||
},
|
|
||||||
"cpuLimit": 500000000,
|
|
||||||
"clockLimit": 1000000000,
|
|
||||||
"memoryLimit": 5242880
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"stdin": {
|
|
||||||
"src": "/home/tt/.config/joj/basic/case1.in"
|
|
||||||
},
|
|
||||||
"memoryLimit": 5242880
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"parsers": [
|
"parsers": [
|
||||||
|
@ -728,32 +713,7 @@
|
||||||
"name": "diff",
|
"name": "diff",
|
||||||
"with": {
|
"with": {
|
||||||
"name": "diff",
|
"name": "diff",
|
||||||
"cases": [
|
"cases": []
|
||||||
{
|
|
||||||
"outputs": [
|
|
||||||
{
|
|
||||||
"score": 5,
|
|
||||||
"fileName": "stdout",
|
|
||||||
"answerPath": "/home/tt/.config/joj/basic/case0.out",
|
|
||||||
"forceQuitOnDiff": false,
|
|
||||||
"alwaysHide": false,
|
|
||||||
"compareSpace": false
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"outputs": [
|
|
||||||
{
|
|
||||||
"score": 5,
|
|
||||||
"fileName": "stdout",
|
|
||||||
"answerPath": "/home/tt/.config/joj/basic/case1.out",
|
|
||||||
"forceQuitOnDiff": false,
|
|
||||||
"alwaysHide": false,
|
|
||||||
"compareSpace": false
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -806,9 +766,9 @@
|
||||||
"max": 33554432,
|
"max": 33554432,
|
||||||
"pipe": true
|
"pipe": true
|
||||||
},
|
},
|
||||||
"cpuLimit": 1000000000,
|
"cpuLimit": 30000000000,
|
||||||
"clockLimit": 2000000000,
|
"clockLimit": 60000000000,
|
||||||
"memoryLimit": 134217728,
|
"memoryLimit": 268435456,
|
||||||
"stackLimit": 0,
|
"stackLimit": 0,
|
||||||
"procLimit": 50,
|
"procLimit": 50,
|
||||||
"cpuRateLimit": 0,
|
"cpuRateLimit": 0,
|
||||||
|
|
|
@ -42,7 +42,7 @@
|
||||||
},
|
},
|
||||||
"cpuLimit": 1000000000,
|
"cpuLimit": 1000000000,
|
||||||
"clockLimit": 2000000000,
|
"clockLimit": 2000000000,
|
||||||
"memoryLimit": 134217728,
|
"memoryLimit": 268435456,
|
||||||
"stackLimit": 0,
|
"stackLimit": 0,
|
||||||
"procLimit": 50,
|
"procLimit": 50,
|
||||||
"cpuRateLimit": 0,
|
"cpuRateLimit": 0,
|
||||||
|
|
|
@ -42,7 +42,7 @@
|
||||||
},
|
},
|
||||||
"cpuLimit": 1000000000,
|
"cpuLimit": 1000000000,
|
||||||
"clockLimit": 2000000000,
|
"clockLimit": 2000000000,
|
||||||
"memoryLimit": 134217728,
|
"memoryLimit": 268435456,
|
||||||
"stackLimit": 0,
|
"stackLimit": 0,
|
||||||
"procLimit": 50,
|
"procLimit": 50,
|
||||||
"cpuRateLimit": 0,
|
"cpuRateLimit": 0,
|
||||||
|
|
|
@ -41,7 +41,7 @@
|
||||||
},
|
},
|
||||||
"cpuLimit": 1000000000,
|
"cpuLimit": 1000000000,
|
||||||
"clockLimit": 2000000000,
|
"clockLimit": 2000000000,
|
||||||
"memoryLimit": 134217728,
|
"memoryLimit": 268435456,
|
||||||
"stackLimit": 0,
|
"stackLimit": 0,
|
||||||
"procLimit": 50,
|
"procLimit": 50,
|
||||||
"cpuRateLimit": 0,
|
"cpuRateLimit": 0,
|
||||||
|
|
|
@ -76,6 +76,30 @@
|
||||||
"clockLimit": 4000000000,
|
"clockLimit": 4000000000,
|
||||||
"memoryLimit": 4194304
|
"memoryLimit": 4194304
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"stdin": {
|
||||||
|
"src": "/home/tt/.config/joj/diff/case9.in"
|
||||||
|
},
|
||||||
|
"memoryLimit": 268435456
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"stdin": {
|
||||||
|
"src": "/home/tt/.config/joj/diff/task1/subtask1/case11.in"
|
||||||
|
},
|
||||||
|
"memoryLimit": 268435456
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"stdin": {
|
||||||
|
"src": "/home/tt/.config/joj/diff/task1/subtask1/case10.in"
|
||||||
|
},
|
||||||
|
"memoryLimit": 268435456
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"stdin": {
|
||||||
|
"src": "/home/tt/.config/joj/diff/task1/case5.in"
|
||||||
|
},
|
||||||
|
"memoryLimit": 268435456
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"stdin": {
|
"stdin": {
|
||||||
"src": "/home/tt/.config/joj/diff/case2.in"
|
"src": "/home/tt/.config/joj/diff/case2.in"
|
||||||
|
@ -88,32 +112,22 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"stdin": {
|
"stdin": {
|
||||||
"src": "/home/tt/.config/joj/diff/task1/subtask1/task5.in"
|
"src": "/home/tt/.config/joj/diff/task1/case4.in"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"stdin": {
|
"stdin": {
|
||||||
"src": "/home/tt/.config/joj/diff/task1/subtask1/task6.in"
|
"src": "/home/tt/.config/joj/diff/task2/case6.in"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"stdin": {
|
"stdin": {
|
||||||
"src": "/home/tt/.config/joj/diff/task1/task1.in"
|
"src": "/home/tt/.config/joj/diff/task2/case7.in"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"stdin": {
|
"stdin": {
|
||||||
"src": "/home/tt/.config/joj/diff/task1/task2.in"
|
"src": "/home/tt/.config/joj/diff/task2/case8.in"
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"stdin": {
|
|
||||||
"src": "/home/tt/.config/joj/diff/task2/task3.in"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"stdin": {
|
|
||||||
"src": "/home/tt/.config/joj/diff/task2/task4.in"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
@ -140,7 +154,7 @@
|
||||||
{
|
{
|
||||||
"outputs": [
|
"outputs": [
|
||||||
{
|
{
|
||||||
"score": 5,
|
"score": 123214122421,
|
||||||
"fileName": "stdout",
|
"fileName": "stdout",
|
||||||
"answerPath": "/home/tt/.config/joj/diff/case1.out",
|
"answerPath": "/home/tt/.config/joj/diff/case1.out",
|
||||||
"forceQuitOnDiff": false,
|
"forceQuitOnDiff": false,
|
||||||
|
@ -149,6 +163,54 @@
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"outputs": [
|
||||||
|
{
|
||||||
|
"score": 1232131,
|
||||||
|
"fileName": "stdout",
|
||||||
|
"answerPath": "/home/tt/.config/joj/diff/case9.out",
|
||||||
|
"forceQuitOnDiff": false,
|
||||||
|
"alwaysHide": false,
|
||||||
|
"compareSpace": false
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"outputs": [
|
||||||
|
{
|
||||||
|
"score": 92321,
|
||||||
|
"fileName": "stdout",
|
||||||
|
"answerPath": "/home/tt/.config/joj/diff/task1/subtask1/case11.out",
|
||||||
|
"forceQuitOnDiff": false,
|
||||||
|
"alwaysHide": false,
|
||||||
|
"compareSpace": false
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"outputs": [
|
||||||
|
{
|
||||||
|
"score": 823131,
|
||||||
|
"fileName": "stdout",
|
||||||
|
"answerPath": "/home/tt/.config/joj/diff/task1/subtask1/case10.out",
|
||||||
|
"forceQuitOnDiff": false,
|
||||||
|
"alwaysHide": false,
|
||||||
|
"compareSpace": false
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"outputs": [
|
||||||
|
{
|
||||||
|
"score": 2590,
|
||||||
|
"fileName": "stdout",
|
||||||
|
"answerPath": "/home/tt/.config/joj/diff/task1/case5.out",
|
||||||
|
"forceQuitOnDiff": false,
|
||||||
|
"alwaysHide": false,
|
||||||
|
"compareSpace": false
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"outputs": [
|
"outputs": [
|
||||||
{
|
{
|
||||||
|
@ -178,7 +240,7 @@
|
||||||
{
|
{
|
||||||
"score": 5,
|
"score": 5,
|
||||||
"fileName": "stdout",
|
"fileName": "stdout",
|
||||||
"answerPath": "/home/tt/.config/joj/diff/task1/subtask1/task5.out",
|
"answerPath": "/home/tt/.config/joj/diff/task1/case4.out",
|
||||||
"forceQuitOnDiff": false,
|
"forceQuitOnDiff": false,
|
||||||
"alwaysHide": false,
|
"alwaysHide": false,
|
||||||
"compareSpace": false
|
"compareSpace": false
|
||||||
|
@ -190,7 +252,7 @@
|
||||||
{
|
{
|
||||||
"score": 5,
|
"score": 5,
|
||||||
"fileName": "stdout",
|
"fileName": "stdout",
|
||||||
"answerPath": "/home/tt/.config/joj/diff/task1/subtask1/task6.out",
|
"answerPath": "/home/tt/.config/joj/diff/task2/case6.out",
|
||||||
"forceQuitOnDiff": false,
|
"forceQuitOnDiff": false,
|
||||||
"alwaysHide": false,
|
"alwaysHide": false,
|
||||||
"compareSpace": false
|
"compareSpace": false
|
||||||
|
@ -202,7 +264,7 @@
|
||||||
{
|
{
|
||||||
"score": 5,
|
"score": 5,
|
||||||
"fileName": "stdout",
|
"fileName": "stdout",
|
||||||
"answerPath": "/home/tt/.config/joj/diff/task1/task1.out",
|
"answerPath": "/home/tt/.config/joj/diff/task2/case7.out",
|
||||||
"forceQuitOnDiff": false,
|
"forceQuitOnDiff": false,
|
||||||
"alwaysHide": false,
|
"alwaysHide": false,
|
||||||
"compareSpace": false
|
"compareSpace": false
|
||||||
|
@ -214,31 +276,7 @@
|
||||||
{
|
{
|
||||||
"score": 5,
|
"score": 5,
|
||||||
"fileName": "stdout",
|
"fileName": "stdout",
|
||||||
"answerPath": "/home/tt/.config/joj/diff/task1/task2.out",
|
"answerPath": "/home/tt/.config/joj/diff/task2/case8.out",
|
||||||
"forceQuitOnDiff": false,
|
|
||||||
"alwaysHide": false,
|
|
||||||
"compareSpace": false
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"outputs": [
|
|
||||||
{
|
|
||||||
"score": 5,
|
|
||||||
"fileName": "stdout",
|
|
||||||
"answerPath": "/home/tt/.config/joj/diff/task2/task3.out",
|
|
||||||
"forceQuitOnDiff": false,
|
|
||||||
"alwaysHide": false,
|
|
||||||
"compareSpace": false
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"outputs": [
|
|
||||||
{
|
|
||||||
"score": 5,
|
|
||||||
"fileName": "stdout",
|
|
||||||
"answerPath": "/home/tt/.config/joj/diff/task2/task4.out",
|
|
||||||
"forceQuitOnDiff": false,
|
"forceQuitOnDiff": false,
|
||||||
"alwaysHide": false,
|
"alwaysHide": false,
|
||||||
"compareSpace": false
|
"compareSpace": false
|
||||||
|
|
|
@ -23,10 +23,18 @@ case0.diff.output.ignore_spaces = true
|
||||||
#case0.command = "./h7/build/ex2"
|
#case0.command = "./h7/build/ex2"
|
||||||
case0.in = "case0.in"
|
case0.in = "case0.in"
|
||||||
|
|
||||||
case1.diff.output.score = 5
|
case1.diff.output.score = 123214122421
|
||||||
case1.limit.cpu = "2s"
|
case1.limit.cpu = "2s"
|
||||||
case1.limit.mem = "4m"
|
case1.limit.mem = "4m"
|
||||||
case1.diff.output.ignore_spaces = true
|
case1.diff.output.ignore_spaces = true
|
||||||
#case1.limit.stdout = 8
|
#case1.limit.stdout = 8
|
||||||
#case1.command = "./h7/build/ex2"
|
#case1.command = "./h7/build/ex2"
|
||||||
case1.in = "case1.in"
|
case1.in = "case1.in"
|
||||||
|
|
||||||
|
case9.diff.output.score = 1232131
|
||||||
|
|
||||||
|
case11.diff.output.score = 92321
|
||||||
|
|
||||||
|
case10.diff.output.score = 823131
|
||||||
|
|
||||||
|
case5.diff.output.score = 2590
|
||||||
|
|
0
tests/convert/diff/task2/case7.in
Normal file
0
tests/convert/diff/task2/case7.in
Normal file
0
tests/convert/diff/task2/case7.out
Normal file
0
tests/convert/diff/task2/case7.out
Normal file
0
tests/convert/diff/task2/case8.in
Normal file
0
tests/convert/diff/task2/case8.in
Normal file
0
tests/convert/diff/task2/case8.out
Normal file
0
tests/convert/diff/task2/case8.out
Normal file
|
@ -40,7 +40,7 @@
|
||||||
},
|
},
|
||||||
"cpuLimit": 1000000000,
|
"cpuLimit": 1000000000,
|
||||||
"clockLimit": 2000000000,
|
"clockLimit": 2000000000,
|
||||||
"memoryLimit": 134217728,
|
"memoryLimit": 268435456,
|
||||||
"stackLimit": 0,
|
"stackLimit": 0,
|
||||||
"procLimit": 50,
|
"procLimit": 50,
|
||||||
"cpuRateLimit": 0,
|
"cpuRateLimit": 0,
|
||||||
|
|
|
@ -40,7 +40,7 @@
|
||||||
},
|
},
|
||||||
"cpuLimit": 1000000000,
|
"cpuLimit": 1000000000,
|
||||||
"clockLimit": 2000000000,
|
"clockLimit": 2000000000,
|
||||||
"memoryLimit": 134217728,
|
"memoryLimit": 268435456,
|
||||||
"stackLimit": 0,
|
"stackLimit": 0,
|
||||||
"procLimit": 50,
|
"procLimit": 50,
|
||||||
"cpuRateLimit": 0,
|
"cpuRateLimit": 0,
|
||||||
|
|
|
@ -13,7 +13,7 @@ def load_case(case_name: str) -> None:
|
||||||
answers_json_path = root / case_name / "answers.json"
|
answers_json_path = root / case_name / "answers.json"
|
||||||
task_toml_path = root / case_name / "task.toml"
|
task_toml_path = root / case_name / "task.toml"
|
||||||
answers_dict = json.loads(answers_json_path.read_text())
|
answers_dict = json.loads(answers_json_path.read_text())
|
||||||
language = next(x for x in answer.LANGUAGES if str(x) == answers_dict["language"])
|
language = next(x for x in answer.LANGUAGES if x.name == answers_dict["language"])
|
||||||
language.set_stages(answers_dict["stages"])
|
language.set_stages(answers_dict["stages"])
|
||||||
language.set_attribute(answers_dict["attribute"])
|
language.set_attribute(answers_dict["attribute"])
|
||||||
answers = answer.Answers(name=answers_dict["name"], language=language)
|
answers = answer.Answers(name=answers_dict["name"], language=language)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user