new executors

This commit is contained in:
Brian Seymour 2019-05-31 13:59:51 -05:00
parent 5220e890c6
commit 0e666cd41a
5 changed files with 18 additions and 5 deletions

3
lxc/executors/rust Normal file
View File

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

View File

@ -12,8 +12,8 @@ cd piston/lxc
# install dependencies
# centos:
yum install epel-release
yum install lxc lxc-templates debootstrap libvirt
yum install -y epel-release
yum install -y lxc lxc-templates debootstrap libvirt
# everything else:
# not documented, please open pull requests with commands for ubuntu/debian/arch/macos
@ -29,7 +29,8 @@ lxc-create -t download -n piston -- --dist ubuntu --release bionic --arch amd64
./shell
# install all necessary piston dependencies
export PATH=/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin
echo 'export PATH=/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin' >> /root/.bashrc
echo 'export PATH=$PATH:/root/.cargo/bin' >> /root/.bashrc
sed -i \
's/http:\/\/archive.ubuntu.com\/ubuntu/http:\/\/mirror.math.princeton.edu\/pub\/ubuntu/' \
/etc/apt/sources.list
@ -38,9 +39,10 @@ apt-get -y install git tzdata nano \
dpkg-dev build-essential python python3 \
ruby nodejs golang php7.2 r-base mono-complete \
nasm openjdk-8-jdk ubuntu-make bf
# IMPORTANT: set dir to /opt/swift/swift-lang
umake swift
ln -s /opt/swift/swift-lang/usr/bin/swift /usr/bin/swift
ln -s /root/.local/share/umake/swift/swift-lang/usr/bin/swift /usr/bin/swift
# IMPORTANT: choose option 1
curl https://sh.rustup.rs -sSf | sh
rm -rf /home/ubuntu
chmod 777 /tmp

3
tests/test.rs Normal file
View File

@ -0,0 +1,3 @@
fn main() {
println!("good");
}

1
tests/test.swift Normal file
View File

@ -0,0 +1 @@
print("hello")

View File

@ -26,3 +26,7 @@ echo 'testing ruby'
../lxc/execute ruby test.rb
echo 'testing brainfuck'
../lxc/execute bf test.bf
echo 'testing rust'
../lxc/execute rust test.rs
echo 'testing swift'
../lxc/execute swift test.swift