fix jelly, move all executor code to runner permission, introduce stdout/stderr separate output to the api

This commit is contained in:
Brian Seymour 2021-01-13 23:45:48 -06:00
parent 15b6f6e8d6
commit b81690a9de
18 changed files with 101 additions and 41 deletions

View file

@ -135,9 +135,9 @@ case "$lang" in
esac
# runner
timeout -s KILL 10 \
timeout -s KILL 20 \
lxc-attach --clear-env -n piston -- \
/bin/bash -l -c "bash /exec/$bin $newinc $epoch 2>&1 | head -c 65536"
/bin/bash -l -c "bash /exec/$bin $newinc $epoch"
# process janitor
lxc-attach --clear-env -n piston -- \

View file

@ -1,4 +1,4 @@
runuser runner$1 -c "\
cd /tmp/$2 ; \
timeout -s KILL 10 gcc -std=c11 -o binary -x c code.code ; \
gcc -std=c11 -o binary -x c code.code ; \
cat args.args | xargs -d '\n' timeout -s KILL 3 ./binary"

View file

@ -1,3 +1,4 @@
cd /tmp/$2
timeout -s KILL 10 g++ -std=c++17 -o binary -x c++ code.code
runuser runner$1 -c "cd /tmp/$2 ; cat args.args | xargs -d '\n' timeout -s KILL 3 ./binary"
runuser runner$1 -c "\
cd /tmp/$2 ; \
g++ -std=c++17 -o binary -x c++ code.code ; \
cat args.args | xargs -d '\n' timeout -s KILL 3 ./binary"

View file

@ -1,3 +1,4 @@
cd /tmp/$2
timeout -s KILL 10 mcs $(echo code.code | sed 's/\///') -nowarn:0219 -out:binary
runuser runner$1 -c "cd /tmp/$2 ; cat args.args | xargs -d '\n' timeout -s KILL 3 mono binary"
runuser runner$1 -c "\
cd /tmp/$2 ; \
mcs $(echo code.code | sed 's/\///') -nowarn:0219 -out:binary ; \
cat args.args | xargs -d '\n' timeout -s KILL 3 mono binary"

View file

@ -1,7 +1,7 @@
cd /tmp/$2
if [[ -z $(grep '[^[:space:]]' args.args) ]]; then
runuser -l runner$1 -c "cd /tmp/$2 ; timeout -s KILL 3 emacs -Q --script code.code"
runuser runner$1 -c "cd /tmp/$2 ; timeout -s KILL 3 emacs -Q --script code.code"
else
runuser -l runner$1 -c "cd /tmp/$2 ; cat args.args | xargs -d '\n' timeout -s KILL 3 emacs -Q --script code.code"
runuser runner$1 -c "cd /tmp/$2 ; cat args.args | xargs -d '\n' timeout -s KILL 3 emacs -Q --script code.code"
fi

View file

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

View file

@ -1,4 +1,7 @@
cd /tmp/$2
mv code.code code.hs
timeout -s KILL 10 ghc -dynamic -o binary code.hs > /dev/null 2>&1
runuser runner$1 -c "cd /tmp/$2 ; cat args.args | xargs -d '\n' timeout -s KILL 3 ./binary"
runuser runner$1 -c "\
cd /tmp/$2 ; \
ghc -dynamic -o binary code.hs > /dev/null 2>&1 ; \
cat args.args | xargs -d '\n' timeout -s KILL 3 ./binary"

View file

@ -2,5 +2,8 @@ cd /tmp/$2
cp code.code interim.java
name=$(grep -Po "(?<=\n|\A)\s*(public\s+)?(class|interface)\s+\K([^\n\s{]+)" interim.java)
mv interim.java $name.java
timeout -s KILL 10 javac $name.java
runuser runner$1 -c "cd /tmp/$2 ; cat args.args | xargs -d '\n' timeout -s KILL 3 java $name"
runuser runner$1 -c "\
cd /tmp/$2 ; \
javac $name.java ; \
cat args.args | xargs -d '\n' timeout -s KILL 3 java $name"

View file

@ -1,4 +1,6 @@
cd /tmp/$2
cp code.code code.kt
timeout -s KILL 10 kotlinc code.kt -include-runtime -d code.jar
runuser runner$1 -c "cd /tmp/$2 ; cat args.args | xargs -d '\n' timeout -s KILL 3 java -jar code.jar"
runuser runner$1 -c "\
cd /tmp/$2 ; \
kotlinc code.kt -include-runtime -d code.jar ; \
cat args.args | xargs -d '\n' timeout -s KILL 3 java -jar code.jar"

View file

@ -1,4 +1,5 @@
cd /tmp/$2
timeout -s KILL 10 nasm -f elf32 -o binary.o code.code
timeout -s KILL 10 ld -m elf_i386 binary.o -o binary
runuser runner$1 -c "cd /tmp/$2 ; cat args.args | xargs -d '\n' timeout -s KILL 3 ./binary"
runuser runner$1 -c "\
cd /tmp/$2 ; \
nasm -f elf32 -o binary.o code.code ; \
ld -m elf_i386 binary.o -o binary ; \
cat args.args | xargs -d '\n' timeout -s KILL 3 ./binary"

View file

@ -1,4 +1,5 @@
cd /tmp/$2
timeout -s KILL 10 nasm -f elf64 -o binary.o code.code
timeout -s KILL 10 ld -m elf_x86_64 binary.o -o binary
runuser runner$1 -c "cd /tmp/$2 ; cat args.args | xargs -d '\n' timeout -s KILL 3 ./binary"
runuser runner$1 -c "\
cd /tmp/$2 ; \
nasm -f elf64 -o binary.o code.code ; \
ld -m elf_x86_64 binary.o -o binary ; \
cat args.args | xargs -d '\n' timeout -s KILL 3 ./binary"

View file

@ -1,3 +1,5 @@
cd /tmp/$2
timeout -s KILL 10 rustc -o binary code.code
runuser runner$1 -c "cd /tmp/$2 ; cat args.args | xargs -d '\n' timeout -s KILL 3 ./binary"
rustc -o binary code.code
runuser runner$1 -c "\
cd /tmp/$2 ; \
cat args.args | xargs -d '\n' timeout -s KILL 3 ./binary"

View file

@ -1,6 +1,7 @@
cd /tmp/$2
mv code.code interim.ts
timeout -s KILL 10 tsc interim.ts
rm interim.ts
mv interim.js code.code
runuser runner$1 -c "cd /tmp/$2 ; cat args.args | xargs -d '\n' timeout -s KILL 3 node code.code"
runuser runner$1 -c "\
cd /tmp/$2 ; \
mv code.code interim.ts ; \
tsc interim.ts ; \
rm -f interim.ts ; \
mv interim.js code.code ; \
cat args.args | xargs -d '\n' timeout -s KILL 3 node code.code"

View file

@ -6,4 +6,4 @@ cp -f executors/* /var/lib/lxc/piston/rootfs/exec
chmod 700 /var/lib/lxc/piston/rootfs/exec/*
chown -R root:root /var/lib/lxc/piston/rootfs/exec
lxc-start -n piston -d
#lxc-start -n piston -d

View file

@ -9,7 +9,7 @@ echo 'testing cpp'
../execute cpp test.cpp
echo 'testing cs'
../execute cs test.cs
echo 'testing deno ts'
echo 'testing deno'
../execute deno testdeno.ts
echo 'testing elisp'
../execute elisp test.el
@ -21,6 +21,8 @@ echo 'testing haskell'
../execute haskell test.hs
echo 'testing java'
../execute java test.java
echo 'testing jelly'
../execute jelly test.jelly
echo 'testing jl'
../execute jl test.jl
echo 'testing js'

1
lxc/tests/test.jelly Normal file
View file

@ -0,0 +1 @@
“3ḅaė;œ»