From ba19844c0ea9635d69c056bf00a7e23f37cc2686 Mon Sep 17 00:00:00 2001 From: Vrganj Date: Wed, 6 Jan 2021 00:46:49 +0100 Subject: [PATCH] Add D --- api/main.go | 1 + lxc/execute | 3 +++ lxc/executors/d | 4 ++++ lxc/test_all_lxc | 2 ++ lxc/tests/test.d | 5 +++++ lxc/versions | 4 ++++ readme.md | 11 +++++++++++ 7 files changed, 30 insertions(+) create mode 100644 lxc/executors/d create mode 100644 lxc/tests/test.d diff --git a/api/main.go b/api/main.go index 51741d6..d883445 100644 --- a/api/main.go +++ b/api/main.go @@ -71,6 +71,7 @@ func Execute(res http.ResponseWriter, req *http.Request) { "c", "cpp", "c++", "csharp", "cs", "c#", + "d", "deno", "denojs", "denots", "elixir", "exs", "emacs", "elisp", "el", diff --git a/lxc/execute b/lxc/execute index 45a7f46..0834dbf 100755 --- a/lxc/execute +++ b/lxc/execute @@ -60,6 +60,9 @@ case "$lang" in "csharp" | "cs" | "c#") bin=csharp ;; +"d") + bin=dmd + ;; "elixir" | "exs") bin=elixir ;; diff --git a/lxc/executors/d b/lxc/executors/d new file mode 100644 index 0000000..bfceccb --- /dev/null +++ b/lxc/executors/d @@ -0,0 +1,4 @@ +cd /tmp/$2 +cp code.code code.d +timeout -s KILL 10 dmd code.d +runuser runner$1 -c "cd /tmp/$2 ; cat args.args | xargs -d '\n' timeout -s KILL 3 ./code" diff --git a/lxc/test_all_lxc b/lxc/test_all_lxc index 8e7130c..070b4b8 100755 --- a/lxc/test_all_lxc +++ b/lxc/test_all_lxc @@ -9,6 +9,8 @@ echo 'testing cpp' ../execute cpp test.cpp echo 'testing cs' ../execute cs test.cs +echo 'testing d' +../execute d test.d echo 'testing deno ts' ../execute deno testdeno.ts echo 'testing elisp' diff --git a/lxc/tests/test.d b/lxc/tests/test.d new file mode 100644 index 0000000..e46985a --- /dev/null +++ b/lxc/tests/test.d @@ -0,0 +1,5 @@ +import std.stdio; + +void main() { + writeln("good"); +} diff --git a/lxc/versions b/lxc/versions index 12b5f76..a946e07 100755 --- a/lxc/versions +++ b/lxc/versions @@ -29,6 +29,10 @@ echo "elixir" lxc-attach --clear-env -n piston -- /bin/bash -l -c "elixir --version" echo '---' +echo 'd' +lxc-attach --clear-env -n piston -- /bin/bash -l -c "dmd --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 a7ccaff..1abee11 100644 --- a/readme.md +++ b/readme.md @@ -261,6 +261,16 @@ cd nim-1.4.0 echo 'export PATH=$PATH:/opt/nim/bin' >> /opt/.profile source /opt/.profile +# install d +# final binary: /opt/d/dmd2/linux/bin64/dmd +# get version: /opt/d/dmd2/linux/bin64/dmd --version +cd /opt && mkdir d && cd d +wget http://downloads.dlang.org/releases/2.x/2.095.0/dmd.2.095.0.linux.tar.xz +unxz dmd.2.095.0.linux.tar.xz +tar -xf dmd.2.095.0.linux.tar +echo 'export PATH=$PATH:/opt/d/dmd2/linux/bin64' >> /opt/.profile +source /opt/.profile + # create runnable users and apply limits for i in {1..150}; do useradd -M runner$i @@ -363,6 +373,7 @@ If an invalid language is supplied, a typical response will look like the follow - c - cpp - csharp +- d - deno - elixir - emacs