added a version of piston which uses lxc instead of docker, added tests for lxc

This commit is contained in:
Brian Seymour 2018-10-22 16:38:52 -05:00
parent 748f438718
commit b26d1b5b45
30 changed files with 233 additions and 0 deletions

3
lxc/executors/c Executable file
View file

@ -0,0 +1,3 @@
cd /tmp/$1
timeout -s KILL 10 gcc -o binary -x c code.code
timeout -s KILL 3 bash -c "cat args.args | xargs -d '\n' ./binary"

3
lxc/executors/cpp Executable file
View file

@ -0,0 +1,3 @@
cd /tmp/$1
timeout -s KILL 10 g++ -o binary -x c++ code.code
timeout -s KILL 3 bash -c "cat args.args | xargs -d '\n' ./binary"

3
lxc/executors/csharp Executable file
View file

@ -0,0 +1,3 @@
cd /tmp/$1
timeout -s KILL 10 mcs $(echo code.code | sed 's/\///') -out:binary
timeout -s KILL 3 bash -c "cat args.args | xargs -d '\n' mono binary"

6
lxc/executors/go Executable file
View file

@ -0,0 +1,6 @@
cd /tmp/$1
cp code.code interim.go
file="interim.go"
GOROOT=/usr/lib/go timeout -s KILL 10 go build $file
file=${file%%.*}
timeout -s KILL 3 bash -c "cat args.args | xargs -d '\n' ./$file"

6
lxc/executors/java Executable file
View file

@ -0,0 +1,6 @@
cd /tmp/$1
cp code.code interim.java
name=$(cat interim.java | grep -Eo 'public\s+class\s+([A-Za-z0-9]+)' | sed -n 's/ */ /gp' | cut -d' ' -f3)
mv interim.java $name.java
timeout -s KILL 10 javac $name.java
timeout -s KILL 3 bash -c "cat args.args | xargs -d '\n' java $name"

4
lxc/executors/nasm Executable file
View file

@ -0,0 +1,4 @@
cd /tmp/$1
timeout -s KILL 10 nasm -f elf64 -o binary.o code.code
timeout -s KILL 10 ld binary.o -o binary
timeout -s KILL 3 bash -c "cat args.args | xargs -d '\n' ./binary"

2
lxc/executors/node Executable file
View file

@ -0,0 +1,2 @@
cd /tmp/$1
timeout -s KILL 3 bash -c "cat args.args | xargs -d '\n' nodejs code.code"

2
lxc/executors/php Executable file
View file

@ -0,0 +1,2 @@
cd /tmp/$1
timeout -s KILL 3 bash -c "cat args.args | xargs -d '\n' php code.code"

2
lxc/executors/python2 Executable file
View file

@ -0,0 +1,2 @@
cd /tmp/$1
timeout -s KILL 3 bash -c "cat args.args | xargs -d '\n' python2 code.code"

2
lxc/executors/python3 Executable file
View file

@ -0,0 +1,2 @@
cd /tmp/$1
timeout -s KILL 3 bash -c "cat args.args | xargs -d '\n' python3.6 code.code"

2
lxc/executors/r Executable file
View file

@ -0,0 +1,2 @@
cd /tmp/$1
timeout -s KILL 3 bash -c "cat args.args | xargs -d '\n' Rscript code.code"

2
lxc/executors/ruby Executable file
View file

@ -0,0 +1,2 @@
cd /tmp/$1
timeout -s KILL 3 bash -c "cat args.args | xargs -d '\n' ruby code.code"