Skip to content

Commit cd0779d

Browse files
authored
Merge pull request #358 from online-judge-tools/docs/improve-custom
Update documents about user-defined languages
2 parents 4f8ebde + 5d4538d commit cd0779d

File tree

3 files changed

+6
-1
lines changed

3 files changed

+6
-1
lines changed

.verify-helper/docs/static/document.ja.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,13 +93,15 @@ NIMFLAGS = ["--warning:on", "--opt:none"]
9393

9494
上記以外の言語でも実行可能です (例: [examples/awk/circle.test.awk](https://github.com/online-judge-tools/verification-helper/blob/master/examples/awk/circle.test.awk))。
9595
`.verify-helper/config.toml` というファイルを作って、以下のようにコンパイルや実行のためのコマンドを書いてください (例: [.verify-helper/config.toml](https://github.com/online-judge-tools/verification-helper/blob/master/.verify-helper/config.toml))。
96+
`compile` と `execute` のフィールドは必須で、その他は省略可能です。
9697

9798
``` toml
9899
[languages.awk]
99100
compile = "bash -c 'echo hello > {tempdir}/hello'"
100101
execute = "env AWKPATH={basedir} awk -f {path}"
101102
bundle = "false"
102103
list_dependencies = "sed 's/^@include \"\\(.*\\)\"$/\\1/ ; t ; d' {path}"
104+
verification_file_suffix = ".test.sed"
103105
```
104106

105107
## verify 自動実行

.verify-helper/docs/static/document.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,13 +92,15 @@ You can customize the method to list depending files with `languages.rust.list_d
9292
### Settings for other languages
9393

9494
You can use languages other than above (e.g. AWK [examples/awk/circle.test.awk](https://github.com/online-judge-tools/verification-helper/blob/master/examples/awk/circle.test.awk)). Please write commands to compile and execute in the config file `.verify-helper/config.toml` (e.g. [.verify-helper/config.toml](https://github.com/kmyk/online-judge-verify-helper/blob/master/.verify-helper/config.toml)).
95+
`compile` field and `execute` field is required, and other fields are optional.
9596

9697
``` toml
9798
[languages.awk]
9899
compile = "bash -c 'echo hello > {tempdir}/hello'"
99100
execute = "env AWKPATH={basedir} awk -f {path}"
100101
bundle = "false"
101102
list_dependencies = "sed 's/^@include \"\\(.*\\)\"$/\\1/ ; t ; d' {path}"
103+
verification_file_suffix = ".test.sed"
102104
```
103105

104106
## Automating the verification

onlinejudge_verify/languages/user_defined.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,8 @@ def list_dependencies(self, path: pathlib.Path, *, basedir: pathlib.Path) -> Lis
6464
return dependencies
6565

6666
def bundle(self, path: pathlib.Path, *, basedir: pathlib.Path, options: Dict[str, Any]) -> bytes:
67-
assert 'bundle' in self.config
67+
if 'bundle' not in self.config:
68+
raise RuntimeError('bundler is not specified: {}'.format(str(path)))
6869
command = self.config['bundle'].format(path=str(path), basedir=str(basedir))
6970
logger.info('$ %s', command)
7071
return subprocess.check_output(shlex.split(command))

0 commit comments

Comments
 (0)