docs: add a simple example
This commit is contained in:
parent
b252a54a83
commit
6e2d37d7e5
6
_example/simple/a.cc
Normal file
6
_example/simple/a.cc
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
#include <iostream>
|
||||||
|
int main() {
|
||||||
|
int a, b;
|
||||||
|
std::cin >> a >> b;
|
||||||
|
std::cout << a + b << '\n';
|
||||||
|
}
|
52
_example/simple/conf.toml
Normal file
52
_example/simple/conf.toml
Normal file
|
@ -0,0 +1,52 @@
|
||||||
|
[[stages]]
|
||||||
|
name = "compile"
|
||||||
|
[stages.executor]
|
||||||
|
name = "sandbox"
|
||||||
|
[stages.executor.with]
|
||||||
|
args = ["/usr/bin/g++", "a.cc", "-o", "a"]
|
||||||
|
env = ["PATH=/usr/bin:/bin"]
|
||||||
|
cpuLimit = 10_000_000_000
|
||||||
|
memoryLimit = 104_857_600
|
||||||
|
procLimit = 50
|
||||||
|
copyInCwd = true
|
||||||
|
copyOut = ["stdout", "stderr"]
|
||||||
|
copyOutCached = ["a"]
|
||||||
|
[[stages.executor.with.files]]
|
||||||
|
content = ""
|
||||||
|
[[stages.executor.with.files]]
|
||||||
|
name = "stdout"
|
||||||
|
max = 4_096
|
||||||
|
[[stages.executor.with.files]]
|
||||||
|
name = "stderr"
|
||||||
|
max = 4_096
|
||||||
|
[stages.parser]
|
||||||
|
name = "dummy"
|
||||||
|
[stages.parser.with]
|
||||||
|
score = 100
|
||||||
|
comment = "compile done"
|
||||||
|
[[stages]]
|
||||||
|
name = "run"
|
||||||
|
[stages.executor]
|
||||||
|
name = "sandbox"
|
||||||
|
[stages.executor.with]
|
||||||
|
args = ["./a"]
|
||||||
|
env = ["PATH=/usr/bin:/bin"]
|
||||||
|
cpuLimit = 10_000_000_000
|
||||||
|
memoryLimit = 104_857_600
|
||||||
|
procLimit = 50
|
||||||
|
copyOut = ["stdout", "stderr"]
|
||||||
|
[stages.executor.with.copyInCached]
|
||||||
|
a = "a"
|
||||||
|
[[stages.executor.with.files]]
|
||||||
|
content = "1 1"
|
||||||
|
[[stages.executor.with.files]]
|
||||||
|
name = "stdout"
|
||||||
|
max = 4_096
|
||||||
|
[[stages.executor.with.files]]
|
||||||
|
name = "stderr"
|
||||||
|
max = 4_096
|
||||||
|
[stages.parser]
|
||||||
|
name = "dummy"
|
||||||
|
[stages.parser.with]
|
||||||
|
score = 100
|
||||||
|
comment = "run done"
|
8
_example/simple/run.sh
Executable file
8
_example/simple/run.sh
Executable file
|
@ -0,0 +1,8 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
set -xe
|
||||||
|
DIRNAME=`dirname -- "$0"`
|
||||||
|
# cd to make CopyInCwd work
|
||||||
|
cd $DIRNAME
|
||||||
|
./../../build/joj3
|
||||||
|
cd -
|
Loading…
Reference in New Issue
Block a user