From 3246ed6781fa3fc60d101ebd9ab392fe07a448b3 Mon Sep 17 00:00:00 2001 From: Ethan Edwards Date: Fri, 16 Oct 2020 23:57:45 -0400 Subject: [PATCH 1/4] Added haskell support --- lxc/execute | 3 +++ lxc/executors/haskell | 3 +++ lxc/test_all_lxc | 2 ++ lxc/tests/test.hs | 1 + lxc/versions | 3 +++ readme.md | 6 ++++++ 6 files changed, 18 insertions(+) create mode 100644 lxc/executors/haskell create mode 100644 lxc/tests/test.hs diff --git a/lxc/execute b/lxc/execute index e19b9f4..2582a9f 100755 --- a/lxc/execute +++ b/lxc/execute @@ -117,6 +117,9 @@ case "$lang" in "typescript" | "ts") bin=typescript ;; +"haskell" | "hs") + bin=haskell + ;; *) echo "invalid language" exit diff --git a/lxc/executors/haskell b/lxc/executors/haskell new file mode 100644 index 0000000..d2902b1 --- /dev/null +++ b/lxc/executors/haskell @@ -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" diff --git a/lxc/test_all_lxc b/lxc/test_all_lxc index dd7453f..f3d6dc3 100755 --- a/lxc/test_all_lxc +++ b/lxc/test_all_lxc @@ -45,3 +45,5 @@ echo 'testing python2' ../execute python2 test2.py echo 'testing python3' ../execute python3 test3.py +echo 'testing haskell' +../execute haskell test.hs diff --git a/lxc/tests/test.hs b/lxc/tests/test.hs new file mode 100644 index 0000000..2d96bbc --- /dev/null +++ b/lxc/tests/test.hs @@ -0,0 +1 @@ +main = putStrLn "Hello, World" diff --git a/lxc/versions b/lxc/versions index 1e36ea3..7078168 100755 --- a/lxc/versions +++ b/lxc/versions @@ -66,3 +66,6 @@ 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 '---' diff --git a/readme.md b/readme.md index b3bc4ca..ac7a226 100644 --- a/readme.md +++ b/readme.md @@ -218,6 +218,11 @@ 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 ghc + # create runnable users and apply limits for i in {1..150}; do useradd -M runner$i @@ -323,6 +328,7 @@ If an invalid language is supplied, a typical response will look like the follow - elixir - emacs - go +- haskell - java - julia - kotlin From 084211cb46de2448e78f1d93a4829d032edb9f85 Mon Sep 17 00:00:00 2001 From: Ethan Edwards Date: Sat, 17 Oct 2020 01:22:15 -0400 Subject: [PATCH 2/4] added deno Fixes issue: https://github.com/engineer-man/piston/issues/18 --- lxc/execute | 3 +++ lxc/executors/deno | 7 +++++++ lxc/test_all_lxc | 4 ++++ lxc/tests/testdeno.js | 1 + lxc/tests/testdeno.ts | 1 + lxc/versions | 3 +++ readme.md | 10 +++++++++- 7 files changed, 28 insertions(+), 1 deletion(-) create mode 100644 lxc/executors/deno create mode 100644 lxc/tests/testdeno.js create mode 100644 lxc/tests/testdeno.ts diff --git a/lxc/execute b/lxc/execute index 2582a9f..de824e1 100755 --- a/lxc/execute +++ b/lxc/execute @@ -87,6 +87,9 @@ case "$lang" in "node" | "js" | "javascript") bin=node ;; +"deno" | "denojs" | "denots") + bin=deno + ;; "perl") bin=perl ;; diff --git a/lxc/executors/deno b/lxc/executors/deno new file mode 100644 index 0000000..76d65ae --- /dev/null +++ b/lxc/executors/deno @@ -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 \ No newline at end of file diff --git a/lxc/test_all_lxc b/lxc/test_all_lxc index f3d6dc3..1641e41 100755 --- a/lxc/test_all_lxc +++ b/lxc/test_all_lxc @@ -47,3 +47,7 @@ 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 diff --git a/lxc/tests/testdeno.js b/lxc/tests/testdeno.js new file mode 100644 index 0000000..847245f --- /dev/null +++ b/lxc/tests/testdeno.js @@ -0,0 +1 @@ +console.log('good') diff --git a/lxc/tests/testdeno.ts b/lxc/tests/testdeno.ts new file mode 100644 index 0000000..868450a --- /dev/null +++ b/lxc/tests/testdeno.ts @@ -0,0 +1 @@ +console.log('good') \ No newline at end of file diff --git a/lxc/versions b/lxc/versions index 7078168..d3c6318 100755 --- a/lxc/versions +++ b/lxc/versions @@ -69,3 +69,6 @@ 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 '---' diff --git a/readme.md b/readme.md index ac7a226..91d3ce4 100644 --- a/readme.md +++ b/readme.md @@ -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 @@ -223,6 +223,14 @@ source /opt/.profile # get version: /usr/bin/ghc --version apt install 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"' +echo 'export PATH="$DENO_INSTALL/bin:$PATH"' +source /opt/.profile + # create runnable users and apply limits for i in {1..150}; do useradd -M runner$i From ca5b87b61dd7b9a4fb376964bab651299174591d Mon Sep 17 00:00:00 2001 From: Ethan Edwards Date: Sat, 17 Oct 2020 02:18:58 -0400 Subject: [PATCH 3/4] forgot to add redirects also fixed apt install line --- readme.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/readme.md b/readme.md index 91d3ce4..130f05d 100644 --- a/readme.md +++ b/readme.md @@ -221,14 +221,14 @@ source /opt/.profile # install haskell # final binary: /usr/bin/ghc # get version: /usr/bin/ghc --version -apt install ghc +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"' -echo 'export PATH="$DENO_INSTALL/bin:$PATH"' +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 From bcbc986d9c6fc97b0ce02bdc72d883d3e4f4ed43 Mon Sep 17 00:00:00 2001 From: Ethan Edwards Date: Sat, 17 Oct 2020 02:20:35 -0400 Subject: [PATCH 4/4] cant type :facepalm: --- readme.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/readme.md b/readme.md index 130f05d..f8e9962 100644 --- a/readme.md +++ b/readme.md @@ -227,8 +227,8 @@ apt install -y ghc # 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 +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