diff --git a/lxc/executors/rust b/lxc/executors/rust new file mode 100644 index 0000000..46533c7 --- /dev/null +++ b/lxc/executors/rust @@ -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" diff --git a/readme.md b/readme.md index e9f84fb..fe1de78 100644 --- a/readme.md +++ b/readme.md @@ -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 diff --git a/tests/test.rs b/tests/test.rs new file mode 100644 index 0000000..2d3384a --- /dev/null +++ b/tests/test.rs @@ -0,0 +1,3 @@ +fn main() { + println!("good"); +} diff --git a/tests/test.swift b/tests/test.swift new file mode 100644 index 0000000..11b15b1 --- /dev/null +++ b/tests/test.swift @@ -0,0 +1 @@ +print("hello") diff --git a/tests/test_all_lxc b/tests/test_all_lxc index 63041d4..afb638c 100755 --- a/tests/test_all_lxc +++ b/tests/test_all_lxc @@ -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