chore: more examples
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
张泊明518370910136 2024-03-05 05:38:49 -05:00
parent 2e80543abf
commit 540937c949
GPG Key ID: D47306D7062CDA9D
12 changed files with 76 additions and 5 deletions

View File

@ -14,5 +14,6 @@ steps:
- export PATH=$PATH:/usr/local/go/bin - export PATH=$PATH:/usr/local/go/bin
- go env -w GOPROXY=https://goproxy.cn,direct - go env -w GOPROXY=https://goproxy.cn,direct
- make - make
- ./_example/simple/run.sh - ./_example/success/run.sh
- ./_example/compile_error/run.sh
- cp build/joj3 /home/drone/.local/bin/joj3 - cp build/joj3 /home/drone/.local/bin/joj3

View File

@ -5,13 +5,13 @@
In order to register sandbox executor, you need to run go-judge before running this program. In order to register sandbox executor, you need to run go-judge before running this program.
```bash ```bash
$ make clean && make && ./_example/simple/run.sh $ make clean && make && ./_example/success/run.sh
rm -rf ./build/* rm -rf ./build/*
rm -rf *.out rm -rf *.out
go build -o ./build/joj3 ./cmd/joj3 go build -o ./build/joj3 ./cmd/joj3
++ dirname -- ./_example/simple/run.sh ++ dirname -- ./_example/success/run.sh
+ DIRNAME=./_example/simple + DIRNAME=./_example/success
+ cd ./_example/simple + cd ./_example/success
+ ./../../build/joj3 + ./../../build/joj3
+ cat ./joj3_result.json + cat ./joj3_result.json
[{"Name":"compile","Results":[{"Score":100,"Comment":"compile done, executor status: run time: 265269232 ns, memory: 57790464 bytes"}]},{"Name":"run","Results":[{"Score":100,"Comment":"executor status: run time: 2033735 ns, memory: 13225984 bytes"},{"Score":100,"Comment":"executor status: run time: 3117399 ns, memory: 14548992 bytes"}]}] [{"Name":"compile","Results":[{"Score":100,"Comment":"compile done, executor status: run time: 265269232 ns, memory: 57790464 bytes"}]},{"Name":"run","Results":[{"Score":100,"Comment":"executor status: run time: 2033735 ns, memory: 13225984 bytes"},{"Score":100,"Comment":"executor status: run time: 3117399 ns, memory: 14548992 bytes"}]}]

View File

@ -0,0 +1,60 @@
logLevel = 0
[[stages]]
name = "compile"
[stages.executor]
name = "sandbox"
[stages.executor.with.default]
args = ["g++", "b.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.default.stdin]
content = ""
[stages.executor.with.default.stdout]
name = "stdout"
max = 4_096
[stages.executor.with.default.stderr]
name = "stderr"
max = 4_096
[stages.parser]
name = "result-status"
[stages.parser.with]
score = 100
comment = "compile done"
[[stages]]
name = "run"
[stages.executor]
name = "sandbox"
[stages.executor.with.default]
args = ["./a"]
env = ["PATH=/usr/bin:/bin"]
cpuLimit = 1_000_000_000
memoryLimit = 104_857_600
procLimit = 50
copyOut = ["stdout", "stderr"]
[stages.executor.with.default.stdout]
name = "stdout"
max = 4_096
[stages.executor.with.default.stderr]
name = "stderr"
max = 4_096
[stages.executor.with.default.copyInCached]
a = "a"
[[stages.executor.with.cases]]
[stages.executor.with.cases.stdin]
src = "./cases/1.in"
[[stages.executor.with.cases]]
[stages.executor.with.cases.stdin]
src = "./cases/2.in"
[stages.parser]
name = "diff"
[[stages.parser.with.cases]]
score = 100
stdoutPath = "./cases/1.out"
[[stages.parser.with.cases]]
score = 100
stdoutPath = "./cases/2.out"

10
_example/success/run.sh Executable file
View File

@ -0,0 +1,10 @@
#!/usr/bin/env bash
set -xe
DIRNAME=`dirname -- "$0"`
# cd to make CopyInCwd work
cd $DIRNAME
./../../build/joj3
cat ./joj3_result.json
rm -f ./joj3_result.json
cd -