Merge pull request #22 from ethancedwards8/deno_support

Deno and Haskell support
This commit is contained in:
Brian Seymour 2020-10-17 11:27:57 -05:00 committed by GitHub
commit 486c720868
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 46 additions and 1 deletions

View File

@ -87,6 +87,9 @@ case "$lang" in
"node" | "js" | "javascript")
bin=node
;;
"deno" | "denojs" | "denots")
bin=deno
;;
"perl")
bin=perl
;;
@ -117,6 +120,9 @@ case "$lang" in
"typescript" | "ts")
bin=typescript
;;
"haskell" | "hs")
bin=haskell
;;
*)
echo "invalid language"
exit

7
lxc/executors/deno Normal file
View File

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

3
lxc/executors/haskell Normal file
View File

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

View File

@ -45,3 +45,9 @@ echo 'testing python2'
../execute python2 test2.py
echo 'testing python3'
../execute python3 test3.py
echo 'testing haskell'
../execute haskell test.hs
echo 'testing deno js'
../execute deno testdeno.js
echo 'testing deno ts'
../execute deno testdeno.ts

1
lxc/tests/test.hs Normal file
View File

@ -0,0 +1 @@
main = putStrLn "Hello, World"

1
lxc/tests/testdeno.js Normal file
View File

@ -0,0 +1 @@
console.log('good')

1
lxc/tests/testdeno.ts Normal file
View File

@ -0,0 +1 @@
console.log('good')

View File

@ -66,3 +66,9 @@ echo '---'
echo 'typescript'
lxc-attach --clear-env -n piston -- /bin/bash -l -c "tsc --version"
echo '---'
echo 'haskell'
lxc-attach --clear-env -n piston -- /bin/bash -l -c "ghc --version"
echo '---'
echo 'deno'
lxc-attach --clear-env -n piston -- /bin/bash -l -c "deno --version"
echo '---'

View File

@ -54,7 +54,7 @@ apt-get update
apt-get install -y \
nano wget build-essential pkg-config libxml2-dev \
libsqlite3-dev mono-complete curl cmake libpython2.7-dev \
ruby libtinfo-dev
ruby libtinfo-dev unzip
# install python2
# final binary: /opt/python2/Python-2.7.17/python
@ -218,6 +218,19 @@ make
echo 'export PATH=$PATH:/opt/lua/lua54/src' >> /opt/.profile
source /opt/.profile
# install haskell
# final binary: /usr/bin/ghc
# get version: /usr/bin/ghc --version
apt install -y ghc
# install deno
# final binary: /opt/.deno/bin/deno
# get version: /opt/.deno/bin/deno --version
curl -fsSL https://deno.land/x/install/install.sh | sh
echo 'export DENO_INSTALL="/opt/.deno"' >> /opt/.profile
echo 'export PATH="$DENO_INSTALL/bin:$PATH"' >> /opt/.profile
source /opt/.profile
# create runnable users and apply limits
for i in {1..150}; do
useradd -M runner$i
@ -323,6 +336,7 @@ If an invalid language is supplied, a typical response will look like the follow
- elixir
- emacs
- go
- haskell
- java
- julia
- kotlin