Skip to content

Commit 5d4538d

Browse files
committed
Update documents about user-defined languages
1 parent 30b57ff commit 5d4538d

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
@@ -96,13 +96,15 @@ NIMFLAGS = ["--warning:on", "--opt:none"]
9696

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

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

108110
## verify 自動実行

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,13 +62,15 @@ There is no config now.
6262
### Settings for other languages
6363

6464
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)).
65+
`compile` field and `execute` field is required, and other fields are optional.
6566

6667
``` toml
6768
[languages.awk]
6869
compile = "bash -c 'echo hello > {tempdir}/hello'"
6970
execute = "env AWKPATH={basedir} awk -f {path}"
7071
bundle = "false"
7172
list_dependencies = "sed 's/^@include \"\\(.*\\)\"$/\\1/ ; t ; d' {path}"
73+
verification_file_suffix = ".test.sed"
7274
```
7375

7476
## 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)