diff --git a/.bashrc b/.bashrc new file mode 100644 index 0000000..89f0a1b --- /dev/null +++ b/.bashrc @@ -0,0 +1,12 @@ +echo "Judge0 - The most advanced open-source online code execution system in the world." +echo "© 2020 Herman Zvonimir Došilović" +echo +echo " Version: ${JUDGE0_VERSION:-N/A}" +echo " Homepage: https://judge0.com" +echo " Changelog: https://github.com/judge0/api/blob/master/CHANGELOG.md" #" +echo " Source Code: https://github.com/judge0/api" +echo " Documentation: https://api.judge0.com" +echo " Mailing List: https://subscribe.judge0.com" +echo " Bug Tracker: https://github.com/judge0/api/issues" +echo " Author: Herman Zvonimir Došilović " +echo " License: https://github.com/judge0/api/blob/master/LICENSE" \ No newline at end of file diff --git a/Dockerfile b/Dockerfile deleted file mode 100644 index e8a1c51..0000000 --- a/Dockerfile +++ /dev/null @@ -1,549 +0,0 @@ -# Check for latest version here: https://hub.docker.com/_/buildpack-deps?tab=tags&page=1&name=buster&ordering=last_updated -# This is just a snapshot of buildpack-deps:buster that was last updated on 2019-12-28. -FROM judge0/buildpack-deps:buster-2019-12-28 - -# Check for latest version here: https://gcc.gnu.org/releases.html, https://ftpmirror.gnu.org/gcc -ENV GCC_VERSIONS \ - 7.4.0 \ - 8.3.0 \ - 9.2.0 -RUN set -xe && \ - for VERSION in $GCC_VERSIONS; do \ - curl -fSsL "https://ftpmirror.gnu.org/gcc/gcc-$VERSION/gcc-$VERSION.tar.gz" -o /tmp/gcc-$VERSION.tar.gz && \ - mkdir /tmp/gcc-$VERSION && \ - tar -xf /tmp/gcc-$VERSION.tar.gz -C /tmp/gcc-$VERSION --strip-components=1 && \ - rm /tmp/gcc-$VERSION.tar.gz && \ - cd /tmp/gcc-$VERSION && \ - ./contrib/download_prerequisites && \ - { rm *.tar.* || true; } && \ - tmpdir="$(mktemp -d)" && \ - cd "$tmpdir"; \ - if [ $VERSION = "9.2.0" ]; then \ - ENABLE_FORTRAN=",fortran"; \ - else \ - ENABLE_FORTRAN=""; \ - fi; \ - /tmp/gcc-$VERSION/configure \ - --disable-multilib \ - --enable-languages=c,c++$ENABLE_FORTRAN \ - --prefix=/usr/local/gcc-$VERSION && \ - make -j$(nproc) && \ - make -j$(nproc) install-strip && \ - rm -rf /tmp/*; \ - done - -# Check for latest version here: https://www.ruby-lang.org/en/downloads -ENV RUBY_VERSIONS \ - 2.7.0 -RUN set -xe && \ - for VERSION in $RUBY_VERSIONS; do \ - curl -fSsL "https://cache.ruby-lang.org/pub/ruby/${VERSION%.*}/ruby-$VERSION.tar.gz" -o /tmp/ruby-$VERSION.tar.gz && \ - mkdir /tmp/ruby-$VERSION && \ - tar -xf /tmp/ruby-$VERSION.tar.gz -C /tmp/ruby-$VERSION --strip-components=1 && \ - rm /tmp/ruby-$VERSION.tar.gz && \ - cd /tmp/ruby-$VERSION && \ - ./configure \ - --disable-install-doc \ - --prefix=/usr/local/ruby-$VERSION && \ - make -j$(nproc) && \ - make -j$(nproc) install && \ - rm -rf /tmp/*; \ - done - -# Check for latest version here: https://www.python.org/downloads -ENV PYTHON_VERSIONS \ - 3.8.1 \ - 2.7.17 -RUN set -xe && \ - for VERSION in $PYTHON_VERSIONS; do \ - curl -fSsL "https://www.python.org/ftp/python/$VERSION/Python-$VERSION.tar.xz" -o /tmp/python-$VERSION.tar.xz && \ - mkdir /tmp/python-$VERSION && \ - tar -xf /tmp/python-$VERSION.tar.xz -C /tmp/python-$VERSION --strip-components=1 && \ - rm /tmp/python-$VERSION.tar.xz && \ - cd /tmp/python-$VERSION && \ - ./configure \ - --prefix=/usr/local/python-$VERSION && \ - make -j$(nproc) && \ - make -j$(nproc) install && \ - rm -rf /tmp/*; \ - done - -# Check for latest version here: https://ftp.gnu.org/gnu/octave -ENV OCTAVE_VERSIONS \ - 5.1.0 -RUN set -xe && \ - apt-get update && \ - apt-get install -y --no-install-recommends gfortran libblas-dev liblapack-dev libpcre3-dev && \ - rm -rf /var/lib/apt/lists/* && \ - for VERSION in $OCTAVE_VERSIONS; do \ - curl -fSsL "https://ftp.gnu.org/gnu/octave/octave-$VERSION.tar.gz" -o /tmp/octave-$VERSION.tar.gz && \ - mkdir /tmp/octave-$VERSION && \ - tar -xf /tmp/octave-$VERSION.tar.gz -C /tmp/octave-$VERSION --strip-components=1 && \ - rm /tmp/octave-$VERSION.tar.gz && \ - cd /tmp/octave-$VERSION && \ - ./configure \ - --prefix=/usr/local/octave-$VERSION && \ - make -j$(nproc) && \ - make -j$(nproc) install && \ - rm -rf /tmp/*; \ - done - -# Check for latest version here: https://jdk.java.net -RUN set -xe && \ - curl -fSsL "https://download.java.net/java/GA/jdk13.0.1/cec27d702aa74d5a8630c65ae61e4305/9/GPL/openjdk-13.0.1_linux-x64_bin.tar.gz" -o /tmp/openjdk13.tar.gz && \ - mkdir /usr/local/openjdk13 && \ - tar -xf /tmp/openjdk13.tar.gz -C /usr/local/openjdk13 --strip-components=1 && \ - rm /tmp/openjdk13.tar.gz && \ - ln -s /usr/local/openjdk13/bin/javac /usr/local/bin/javac && \ - ln -s /usr/local/openjdk13/bin/java /usr/local/bin/java && \ - ln -s /usr/local/openjdk13/bin/jar /usr/local/bin/jar - -# Check for latest version here: https://ftpmirror.gnu.org/bash -ENV BASH_VERSIONS \ - 5.0 -RUN set -xe && \ - for VERSION in $BASH_VERSIONS; do \ - curl -fSsL "https://ftpmirror.gnu.org/bash/bash-$VERSION.tar.gz" -o /tmp/bash-$VERSION.tar.gz && \ - mkdir /tmp/bash-$VERSION && \ - tar -xf /tmp/bash-$VERSION.tar.gz -C /tmp/bash-$VERSION --strip-components=1 && \ - rm /tmp/bash-$VERSION.tar.gz && \ - cd /tmp/bash-$VERSION && \ - ./configure \ - --prefix=/usr/local/bash-$VERSION && \ - make -j$(nproc) && \ - make -j$(nproc) install && \ - rm -rf /tmp/*; \ - done - -# Check for latest version here: https://www.freepascal.org/download.html -ENV FPC_VERSIONS \ - 3.0.4 -RUN set -xe && \ - for VERSION in $FPC_VERSIONS; do \ - curl -fSsL "ftp://ftp.freepascal.org/fpc/dist/$VERSION/x86_64-linux/fpc-$VERSION.x86_64-linux.tar" -o /tmp/fpc-$VERSION.tar && \ - mkdir /tmp/fpc-$VERSION && \ - tar -xf /tmp/fpc-$VERSION.tar -C /tmp/fpc-$VERSION --strip-components=1 && \ - rm /tmp/fpc-$VERSION.tar && \ - cd /tmp/fpc-$VERSION && \ - echo "/usr/local/fpc-$VERSION" | sh install.sh && \ - rm -rf /tmp/*; \ - done - -# Check for latest version here: https://www.haskell.org/ghc/download.html -ENV HASKELL_VERSIONS \ - 8.8.1 -RUN set -xe && \ - apt-get update && \ - apt-get install -y --no-install-recommends libgmp-dev libtinfo5 && \ - rm -rf /var/lib/apt/lists/* && \ - for VERSION in $HASKELL_VERSIONS; do \ - curl -fSsL "https://downloads.haskell.org/~ghc/$VERSION/ghc-$VERSION-x86_64-deb8-linux.tar.xz" -o /tmp/ghc-$VERSION.tar.xz && \ - mkdir /tmp/ghc-$VERSION && \ - tar -xf /tmp/ghc-$VERSION.tar.xz -C /tmp/ghc-$VERSION --strip-components=1 && \ - rm /tmp/ghc-$VERSION.tar.xz && \ - cd /tmp/ghc-$VERSION && \ - ./configure \ - --prefix=/usr/local/ghc-$VERSION && \ - make -j$(nproc) install && \ - rm -rf /tmp/*; \ - done - -# Check for latest version here: https://www.mono-project.com/download/stable -ENV MONO_VERSIONS \ - 6.6.0.161 -RUN set -xe && \ - apt-get update && \ - apt-get install -y --no-install-recommends cmake && \ - rm -rf /var/lib/apt/lists/* && \ - for VERSION in $MONO_VERSIONS; do \ - curl -fSsL "https://download.mono-project.com/sources/mono/mono-$VERSION.tar.xz" -o /tmp/mono-$VERSION.tar.xz && \ - mkdir /tmp/mono-$VERSION && \ - tar -xf /tmp/mono-$VERSION.tar.xz -C /tmp/mono-$VERSION --strip-components=1 && \ - rm /tmp/mono-$VERSION.tar.xz && \ - cd /tmp/mono-$VERSION && \ - ./configure \ - --prefix=/usr/local/mono-$VERSION && \ - make -j$(nproc) && \ - make -j$(proc) install && \ - rm -rf /tmp/*; \ - done - -# Check for latest version here: https://nodejs.org/en -ENV NODE_VERSIONS \ - 12.14.0 -RUN set -xe && \ - for VERSION in $NODE_VERSIONS; do \ - curl -fSsL "https://nodejs.org/dist/v$VERSION/node-v$VERSION.tar.gz" -o /tmp/node-$VERSION.tar.gz && \ - mkdir /tmp/node-$VERSION && \ - tar -xf /tmp/node-$VERSION.tar.gz -C /tmp/node-$VERSION --strip-components=1 && \ - rm /tmp/node-$VERSION.tar.gz && \ - cd /tmp/node-$VERSION && \ - ./configure \ - --prefix=/usr/local/node-$VERSION && \ - make -j$(nproc) && \ - make -j$(nproc) install && \ - rm -rf /tmp/*; \ - done - -# Check for latest version here: https://github.com/erlang/otp/releases -ENV ERLANG_VERSIONS \ - 22.2 -RUN set -xe && \ - apt-get update && \ - apt-get install -y --no-install-recommends unzip && \ - rm -rf /var/lib/apt/lists/* && \ - for VERSION in $ERLANG_VERSIONS; do \ - curl -fSsL "https://github.com/erlang/otp/archive/OTP-$VERSION.tar.gz" -o /tmp/erlang-$VERSION.tar.gz && \ - mkdir /tmp/erlang-$VERSION && \ - tar -xf /tmp/erlang-$VERSION.tar.gz -C /tmp/erlang-$VERSION --strip-components=1 && \ - rm /tmp/erlang-$VERSION.tar.gz && \ - cd /tmp/erlang-$VERSION && \ - ./otp_build autoconf && \ - ./configure \ - --prefix=/usr/local/erlang-$VERSION && \ - make -j$(nproc) && \ - make -j$(nproc) install && \ - rm -rf /tmp/*; \ - done; \ - ln -s /usr/local/erlang-22.2/bin/erl /usr/local/bin/erl - -# Check for latest version here: https://github.com/elixir-lang/elixir/releases -ENV ELIXIR_VERSIONS \ - 1.9.4 -RUN set -xe && \ - apt-get update && \ - apt-get install -y --no-install-recommends unzip && \ - rm -rf /var/lib/apt/lists/* && \ - for VERSION in $ELIXIR_VERSIONS; do \ - curl -fSsL "https://github.com/elixir-lang/elixir/releases/download/v$VERSION/Precompiled.zip" -o /tmp/elixir-$VERSION.zip && \ - unzip -d /usr/local/elixir-$VERSION /tmp/elixir-$VERSION.zip && \ - rm -rf /tmp/*; \ - done - -# Check for latest version here: https://www.rust-lang.org -ENV RUST_VERSIONS \ - 1.40.0 -RUN set -xe && \ - for VERSION in $RUST_VERSIONS; do \ - curl -fSsL "https://static.rust-lang.org/dist/rust-$VERSION-x86_64-unknown-linux-gnu.tar.gz" -o /tmp/rust-$VERSION.tar.gz && \ - mkdir /tmp/rust-$VERSION && \ - tar -xf /tmp/rust-$VERSION.tar.gz -C /tmp/rust-$VERSION --strip-components=1 && \ - rm /tmp/rust-$VERSION.tar.gz && \ - cd /tmp/rust-$VERSION && \ - ./install.sh \ - --prefix=/usr/local/rust-$VERSION \ - --components=rustc,rust-std-x86_64-unknown-linux-gnu && \ - rm -rf /tmp/*; \ - done - -# Check for latest version here: https://golang.org/dl -ENV GO_VERSIONS \ - 1.13.5 -RUN set -xe && \ - for VERSION in $GO_VERSIONS; do \ - curl -fSsL "https://storage.googleapis.com/golang/go$VERSION.linux-amd64.tar.gz" -o /tmp/go-$VERSION.tar.gz && \ - mkdir /usr/local/go-$VERSION && \ - tar -xf /tmp/go-$VERSION.tar.gz -C /usr/local/go-$VERSION --strip-components=1 && \ - rm -rf /tmp/*; \ - done - -# Check for latest version here: https://sourceforge.net/projects/fbc/files/Binaries%20-%20Linux -ENV FBC_VERSIONS \ - 1.07.1 -RUN set -xe && \ - for VERSION in $FBC_VERSIONS; do \ - curl -fSsL "https://downloads.sourceforge.net/project/fbc/Binaries%20-%20Linux/FreeBASIC-$VERSION-linux-x86_64.tar.gz" -o /tmp/fbc-$VERSION.tar.gz && \ - mkdir /usr/local/fbc-$VERSION && \ - tar -xf /tmp/fbc-$VERSION.tar.gz -C /usr/local/fbc-$VERSION --strip-components=1 && \ - rm -rf /tmp/*; \ - done - -# Check for latest version here: https://github.com/ocaml/ocaml/releases -ENV OCAML_VERSIONS \ - 4.09.0 -RUN set -xe && \ - for VERSION in $OCAML_VERSIONS; do \ - curl -fSsL "https://github.com/ocaml/ocaml/archive/$VERSION.tar.gz" -o /tmp/ocaml-$VERSION.tar.gz && \ - mkdir /tmp/ocaml-$VERSION && \ - tar -xf /tmp/ocaml-$VERSION.tar.gz -C /tmp/ocaml-$VERSION --strip-components=1 && \ - rm /tmp/ocaml-$VERSION.tar.gz && \ - cd /tmp/ocaml-$VERSION && \ - ./configure \ - -prefix /usr/local/ocaml-$VERSION \ - --disable-ocamldoc --disable-debugger && \ - make -j$(nproc) world.opt && \ - make -j$(nproc) install && \ - rm -rf /tmp/*; \ - done - -# Check for latest version here: https://www.php.net/downloads -ENV PHP_VERSIONS \ - 7.4.1 -RUN set -xe && \ - apt-get update && \ - apt-get install -y --no-install-recommends bison re2c && \ - rm -rf /var/lib/apt/lists/* && \ - for VERSION in $PHP_VERSIONS; do \ - curl -fSsL "https://codeload.github.com/php/php-src/tar.gz/php-$VERSION" -o /tmp/php-$VERSION.tar.gz && \ - mkdir /tmp/php-$VERSION && \ - tar -xf /tmp/php-$VERSION.tar.gz -C /tmp/php-$VERSION --strip-components=1 && \ - rm /tmp/php-$VERSION.tar.gz && \ - cd /tmp/php-$VERSION && \ - ./buildconf --force && \ - ./configure \ - --prefix=/usr/local/php-$VERSION && \ - make -j$(nproc) && \ - make -j$(nproc) install && \ - rm -rf /tmp/*; \ - done - -# Check for latest version here: https://dlang.org/download.html#dmd -ENV D_VERSIONS \ - 2.089.1 -RUN set -xe && \ - for VERSION in $D_VERSIONS; do \ - curl -fSsL "http://downloads.dlang.org/releases/2.x/$VERSION/dmd.$VERSION.linux.tar.xz" -o /tmp/d-$VERSION.tar.gz && \ - mkdir /usr/local/d-$VERSION && \ - tar -xf /tmp/d-$VERSION.tar.gz -C /usr/local/d-$VERSION --strip-components=1 && \ - rm -rf /usr/local/d-$VERSION/linux/*32 && \ - rm -rf /tmp/*; \ - done - -# Check for latest version here: https://www.lua.org/download.html -ENV LUA_VERSIONS \ - 5.3.5 -RUN set -xe && \ - for VERSION in $LUA_VERSIONS; do \ - curl -fSsL "https://downloads.sourceforge.net/project/luabinaries/$VERSION/Tools%20Executables/lua-${VERSION}_Linux44_64_bin.tar.gz" -o /tmp/lua-$VERSION.tar.gz && \ - mkdir /usr/local/lua-$VERSION && \ - tar -xf /tmp/lua-$VERSION.tar.gz -C /usr/local/lua-$VERSION && \ - rm -rf /tmp/*; \ - done; \ - ln -s /lib/x86_64-linux-gnu/libreadline.so.7 /lib/x86_64-linux-gnu/libreadline.so.6 - -# Check for latest version here: https://github.com/microsoft/TypeScript/releases -ENV TYPESCRIPT_VERSIONS \ - 3.7.4 -RUN set -xe && \ - curl -fSsL "https://deb.nodesource.com/setup_12.x" | bash - && \ - apt-get update && \ - apt-get install -y --no-install-recommends nodejs && \ - rm -rf /var/lib/apt/lists/* && \ - for VERSION in $TYPESCRIPT_VERSIONS; do \ - npm install -g typescript@$VERSION; \ - done - -# Check for latest version here: https://nasm.us -ENV NASM_VERSIONS \ - 2.14.02 -RUN set -xe && \ - for VERSION in $NASM_VERSIONS; do \ - curl -fSsL "https://www.nasm.us/pub/nasm/releasebuilds/$VERSION/nasm-$VERSION.tar.gz" -o /tmp/nasm-$VERSION.tar.gz && \ - mkdir /tmp/nasm-$VERSION && \ - tar -xf /tmp/nasm-$VERSION.tar.gz -C /tmp/nasm-$VERSION --strip-components=1 && \ - rm /tmp/nasm-$VERSION.tar.gz && \ - cd /tmp/nasm-$VERSION && \ - ./configure \ - --prefix=/usr/local/nasm-$VERSION && \ - make -j$(nproc) nasm ndisasm && \ - make -j$(nproc) strip && \ - make -j$(nproc) install && \ - echo "/usr/local/nasm-$VERSION/bin/nasm -o main.o \$@ && ld main.o" >> /usr/local/nasm-$VERSION/bin/nasmld && \ - chmod +x /usr/local/nasm-$VERSION/bin/nasmld && \ - rm -rf /tmp/*; \ - done - -# Check for latest version here: http://gprolog.org/#download -ENV GPROLOG_VERSIONS \ - 1.4.5 -RUN set -xe && \ - for VERSION in $GPROLOG_VERSIONS; do \ - curl -fSsL "http://gprolog.org/gprolog-$VERSION.tar.gz" -o /tmp/gprolog-$VERSION.tar.gz && \ - mkdir /tmp/gprolog-$VERSION && \ - tar -xf /tmp/gprolog-$VERSION.tar.gz -C /tmp/gprolog-$VERSION --strip-components=1 && \ - rm /tmp/gprolog-$VERSION.tar.gz && \ - cd /tmp/gprolog-$VERSION/src && \ - ./configure \ - --prefix=/usr/local/gprolog-$VERSION && \ - make -j$(nproc) && \ - make -j$(nproc) install-strip && \ - rm -rf /tmp/*; \ - done - -# Check for latest version here: http://www.sbcl.org/platform-table.html -ENV SBCL_VERSIONS \ - 2.0.0 -RUN set -xe && \ - apt-get update && \ - apt-get install -y --no-install-recommends bison re2c && \ - rm -rf /var/lib/apt/lists/* && \ - for VERSION in $SBCL_VERSIONS; do \ - curl -fSsL "https://downloads.sourceforge.net/project/sbcl/sbcl/$VERSION/sbcl-$VERSION-x86-64-linux-binary.tar.bz2" -o /tmp/sbcl-$VERSION.tar.bz2 && \ - mkdir /tmp/sbcl-$VERSION && \ - tar -xf /tmp/sbcl-$VERSION.tar.bz2 -C /tmp/sbcl-$VERSION --strip-components=1 && \ - cd /tmp/sbcl-$VERSION && \ - export INSTALL_ROOT=/usr/local/sbcl-$VERSION && \ - sh install.sh && \ - rm -rf /tmp/*; \ - done - -# Check for latest version here: https://ftp.gnu.org/gnu/gnucobol -ENV COBOL_VERSIONS \ - 2.2 -RUN set -xe && \ - for VERSION in $COBOL_VERSIONS; do \ - curl -fSsL "https://ftp.gnu.org/gnu/gnucobol/gnucobol-$VERSION.tar.xz" -o /tmp/gnucobol-$VERSION.tar.xz && \ - mkdir /tmp/gnucobol-$VERSION && \ - tar -xf /tmp/gnucobol-$VERSION.tar.xz -C /tmp/gnucobol-$VERSION --strip-components=1 && \ - rm /tmp/gnucobol-$VERSION.tar.xz && \ - cd /tmp/gnucobol-$VERSION && \ - ./configure \ - --prefix=/usr/local/gnucobol-$VERSION && \ - make -j$(nproc) && \ - make -j$(nproc) install && \ - rm -rf /tmp/*; \ - done - -# Check for latest version here: https://swift.org/download -ENV SWIFT_VERSIONS \ - 5.2.3 -RUN set -xe && \ - apt-get update && \ - apt-get install -y --no-install-recommends libncurses5 && \ - rm -rf /var/lib/apt/lists/* && \ - for VERSION in $SWIFT_VERSIONS; do \ - curl -fSsL "https://swift.org/builds/swift-$VERSION-release/ubuntu1804/swift-$VERSION-RELEASE/swift-$VERSION-RELEASE-ubuntu18.04.tar.gz" -o /tmp/swift-$VERSION.tar.gz && \ - mkdir /usr/local/swift-$VERSION && \ - tar -xf /tmp/swift-$VERSION.tar.gz -C /usr/local/swift-$VERSION --strip-components=2 && \ - rm -rf /tmp/*; \ - done - -# Check for latest version here: https://kotlinlang.org -ENV KOTLIN_VERSIONS \ - 1.3.70 -RUN set -xe && \ - for VERSION in $KOTLIN_VERSIONS; do \ - curl -fSsL "https://github.com/JetBrains/kotlin/releases/download/v$VERSION/kotlin-compiler-$VERSION.zip" -o /tmp/kotlin-$VERSION.zip && \ - unzip -d /usr/local/kotlin-$VERSION /tmp/kotlin-$VERSION.zip && \ - mv /usr/local/kotlin-$VERSION/kotlinc/* /usr/local/kotlin-$VERSION/ && \ - rm -rf /usr/local/kotlin-$VERSION/kotlinc && \ - rm -rf /tmp/*; \ - done - -# Check for latest version here: https://hub.docker.com/_/mono -# I currently use this to add support for Visual Basic.Net but this can be also -# used to support C# language which has been already supported but with manual -# installation of Mono (see above). -ENV MONO_VERSION 6.6.0.161 -RUN set -xe && \ - apt-get update && \ - apt-get install -y --no-install-recommends gnupg dirmngr && \ - rm -rf /var/lib/apt/lists/* && \ - export GNUPGHOME="$(mktemp -d)" && \ - gpg --batch --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF && \ - gpg --batch --export --armor 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF > /etc/apt/trusted.gpg.d/mono.gpg.asc && \ - gpgconf --kill all && \ - rm -rf "$GNUPGHOME" && \ - apt-key list | grep Xamarin && \ - apt-get purge -y --auto-remove gnupg dirmngr && \ - echo "deb http://download.mono-project.com/repo/debian stable-stretch/snapshots/$MONO_VERSION main" > /etc/apt/sources.list.d/mono-official-stable.list && \ - apt-get update && \ - apt-get install -y --no-install-recommends mono-vbnc && \ - rm -rf /var/lib/apt/lists/* /tmp/* - -# Check for latest version here: https://packages.debian.org/buster/clang-7 -# Used for additional compilers for C, C++ and used for Objective-C. -RUN set -xe && \ - apt-get update && \ - apt-get install -y --no-install-recommends clang-7 gnustep-devel && \ - rm -rf /var/lib/apt/lists/* - -# Check for latest version here: https://cloud.r-project.org/src/base -ENV R_VERSIONS \ - 4.0.0 -RUN set -xe && \ - apt-get update && \ - apt-get install -y --no-install-recommends libpcre2-dev && \ - rm -rf /var/lib/apt/lists/* && \ - for VERSION in $R_VERSIONS; do \ - curl -fSsL "https://cloud.r-project.org/src/base/R-4/R-$VERSION.tar.gz" -o /tmp/r-$VERSION.tar.gz && \ - mkdir /tmp/r-$VERSION && \ - tar -xf /tmp/r-$VERSION.tar.gz -C /tmp/r-$VERSION --strip-components=1 && \ - rm /tmp/r-$VERSION.tar.gz && \ - cd /tmp/r-$VERSION && \ - ./configure \ - --prefix=/usr/local/r-$VERSION && \ - make -j$(nproc) && \ - make -j$(nproc) install && \ - rm -rf /tmp/*; \ - done - -# Check for latest version here: https://packages.debian.org/buster/sqlite3 -# Used for support of SQLite. -RUN set -xe && \ - apt-get update && \ - apt-get install -y --no-install-recommends sqlite3 && \ - rm -rf /var/lib/apt/lists/* - -# Check for latest version here: https://scala-lang.org -ENV SCALA_VERSIONS \ - 2.13.2 -RUN set -xe && \ - for VERSION in $SCALA_VERSIONS; do \ - curl -fSsL "https://downloads.lightbend.com/scala/$VERSION/scala-$VERSION.tgz" -o /tmp/scala-$VERSION.tgz && \ - mkdir /usr/local/scala-$VERSION && \ - tar -xf /tmp/scala-$VERSION.tgz -C /usr/local/scala-$VERSION --strip-components=1 && \ - rm -rf /tmp/*; \ - done - -# Support for Perl came "for free" since it is already installed. - -# Check for latest version here: https://github.com/clojure/clojure/releases -ENV CLOJURE_VERSION 1.10.1 -RUN set -xe && \ - apt-get update && \ - apt-get install -y --no-install-recommends maven && \ - cd /tmp && \ - git clone https://github.com/clojure/clojure && \ - cd clojure && \ - git checkout clojure-$CLOJURE_VERSION && \ - mvn -Plocal -Dmaven.test.skip=true package && \ - mkdir /usr/local/clojure-$CLOJURE_VERSION && \ - cp clojure.jar /usr/local/clojure-$CLOJURE_VERSION && \ - apt-get remove --purge -y maven && \ - rm -rf /var/lib/apt/lists/* /tmp/* - -# Check for latest version here: https://github.com/dotnet/sdk/releases -RUN set -xe && \ - curl -fSsL "https://download.visualstudio.microsoft.com/download/pr/7d4c708b-38db-48b2-8532-9fc8a3ab0e42/23229fd17482119822bd9261b3570d87/dotnet-sdk-3.1.202-linux-x64.tar.gz" -o /tmp/dotnet.tar.gz && \ - mkdir /usr/local/dotnet-sdk && \ - tar -xf /tmp/dotnet.tar.gz -C /usr/local/dotnet-sdk && \ - rm -rf /tmp/* - -# Check for latest version here: https://groovy.apache.org/download.html -RUN set -xe && \ - curl -fSsL "https://dl.bintray.com/groovy/maven/apache-groovy-binary-3.0.3.zip" -o /tmp/groovy.zip && \ - unzip /tmp/groovy.zip -d /usr/local && \ - rm -rf /tmp/* - -RUN set -xe && \ - apt-get update && \ - apt-get install -y --no-install-recommends locales && \ - rm -rf /var/lib/apt/lists/* && \ - echo "en_US.UTF-8 UTF-8" > /etc/locale.gen && \ - locale-gen -ENV LANG=en_US.UTF-8 LANGUAGE=en_US:en LC_ALL=en_US.UTF-8 - -RUN set -xe && \ - apt-get update && \ - apt-get install -y --no-install-recommends git libcap-dev && \ - rm -rf /var/lib/apt/lists/* && \ - git clone https://github.com/judge0/isolate.git /tmp/isolate && \ - cd /tmp/isolate && \ - git checkout 9be3ff6ff0670763e564912a6662730e55b69536 && \ - make -j$(nproc) install && \ - rm -rf /tmp/* -ENV BOX_ROOT /var/local/lib/isolate - -LABEL maintainer="Herman Zvonimir Došilović " -LABEL version="1.3.0" diff --git a/bin/debug-tests b/bin/debug-tests deleted file mode 100755 index df7a2f5..0000000 --- a/bin/debug-tests +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/bash -[[ ! -v IMAGE ]] && IMAGE=judge0/api-base:1.0.0 -cd tests -echo "Opening shell for debugging inside Docker container of image $IMAGE" -docker run -it --rm -v $PWD:/tests -w /tests --privileged $IMAGE bash \ No newline at end of file diff --git a/bin/run-tests b/bin/run-tests deleted file mode 100755 index 1ced848..0000000 --- a/bin/run-tests +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/bash -[[ ! -v IMAGE ]] && IMAGE=judge0/api-base:1.0.0 -cd tests -echo "Running tests on image $IMAGE" -docker run -it --rm -v $PWD:/tests -w /tests --privileged $IMAGE ./run $@ \ No newline at end of file diff --git a/build.sh b/build.sh new file mode 100755 index 0000000..ab3720f --- /dev/null +++ b/build.sh @@ -0,0 +1,107 @@ +#!/bin/bash +set -e + +function get_argument() { + if [[ -n "$2" ]] && [[ ${2:0:1} != "-" ]]; then + echo "$2" + else + echo "Error: Argument for $1 is missing" >&2 + exit 1 + fi +} + +PARAMS="" +edition="slim" +while [[ $# -gt 0 ]]; do + case "$1" in + --build) + build=1 + shift + ;; + --compilers) + compilers="$(get_argument $1 $2)" + shift 2 + ;; + --edition) + edition="$(get_argument $1 $2)" + shift 2 + ;; + --version) + version="$(get_argument $1 $2)" + shift 2 + ;; + -*|--*) + echo "Error: Unknown option $1" >&2 + echo "Usage: $0 [--build] [--compilers ,...] [--edition edition] [--version version] base_image" + exit 1 + ;; + *) + PARAMS="$PARAMS $1" + shift + ;; + esac +done + +eval set -- "$PARAMS" + +compilers_dir="compilers/$edition" + +if [[ -z "$compilers" ]]; then + compilers="$(cd $compilers_dir; ls -d -- *)" +else + compilers="${compilers//,/ }" +fi + +for compiler in $compilers; do + [[ ! -d $compilers_dir/$compiler ]] && continue + dockerfiles="$dockerfiles $compilers_dir/$compiler/Dockerfile" +done + +base_image="$1" +dockerfile="# THIS DOCKERFILE WAS GENERATED BY JUDGE0 BUILD TOOL. DO NOT EDIT.\n\n" +if [[ -z "$base_image" ]]; then + dockerfiles="compilers/slim/Dockerfile $dockerfiles" +else + dockerfile="${dockerfile}FROM $base_image\n\n" +fi + +for f in $dockerfiles; do + if [[ ! -f $f ]]; then + echo "File $f does not exist. Skipping." + continue + fi + echo "Adding $f." + dockerfile="$dockerfile$(cat $f)\n\n" +done + +if [[ -z "$version" ]]; then + version="$(git log -1 --format=%h --abbrev=8)" +fi + +if [[ $edition != "standard" ]]; then + version="$version-$edition" +fi + +mkdir -p dist/$edition +file="dist/$edition/Dockerfile" + +dockerfile=$dockerfile$(cat << EOF +COPY $file / + +LABEL version="$version" +EOF +) + +echo -e "$dockerfile" > $file + +image="judge0/api-base:$version" + +build_command="docker build -t $image -f $file ." +echo "Generated new Dockerfile and saved it in $file." +echo +echo " $build_command" +echo + +if [[ $build -eq 1 ]]; then + $build_command +fi diff --git a/compilers/Dockerfile.template b/compilers/Dockerfile.template new file mode 100644 index 0000000..9ff60bf --- /dev/null +++ b/compilers/Dockerfile.template @@ -0,0 +1,8 @@ +# Latest version: +ENV _VERSIONS 1.0 2.0 3.0 +COPY compilers///update.cron /cron/ +COPY compilers///update.sh /update/ +RUN set -xe && \ + # INSTALLATION COMMANDS... + apt-get autoremove --purge && \ + rm -rf /tmp/* /var/lib/apt/lists/* diff --git a/compilers/extra/c3/Dockerfile b/compilers/extra/c3/Dockerfile new file mode 100644 index 0000000..5e9d660 --- /dev/null +++ b/compilers/extra/c3/Dockerfile @@ -0,0 +1,13 @@ +# Latest version: https://github.com/c3lang/c3c +ENV C3_VERSIONS latest +COPY compilers/extra/c3/update.cron /cron/c3 +COPY compilers/extra/c3/update.sh /update/c3 +RUN set -xe && \ + echo "deb http://apt.llvm.org/buster/ llvm-toolchain-buster-10 main" > /etc/apt/sources.list.d/llvm.list && \ + echo "deb-src http://apt.llvm.org/buster/ llvm-toolchain-buster-10 main" >> /etc/apt/sources.list.d/llvm.list && \ + wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | apt-key add - && \ + apt-get update && \ + apt-get install -y --no-install-recommends clang-10 llvm-10-dev && \ + /update/c3 && \ + apt-get autoremove --purge && \ + rm -rf /tmp/* /var/lib/apt/lists/* diff --git a/compilers/extra/c3/test/c3/lang.properties b/compilers/extra/c3/test/c3/lang.properties new file mode 100644 index 0000000..3702872 --- /dev/null +++ b/compilers/extra/c3/test/c3/lang.properties @@ -0,0 +1,6 @@ +VERSIONS="$C3_VERSIONS" +NAME="C3 ($VERSION)" +SOURCE_FILE="main.c3" +BINARY_FILE="a.out" +COMPILE_CMD="/usr/local/c3-latest/c3c $ARGS compile $SOURCE_FILE && /usr/bin/clang-10 main.o" +RUN_CMD="./$BINARY_FILE $ARGS" \ No newline at end of file diff --git a/extra/tests/c3/main.c3 b/compilers/extra/c3/test/c3/main.c3 similarity index 100% rename from extra/tests/c3/main.c3 rename to compilers/extra/c3/test/c3/main.c3 diff --git a/compilers/extra/c3/update.cron b/compilers/extra/c3/update.cron new file mode 100644 index 0000000..4488f27 --- /dev/null +++ b/compilers/extra/c3/update.cron @@ -0,0 +1 @@ +0 * * * * /update/c3 &> /cron-log/c3.log diff --git a/compilers/extra/c3/update.sh b/compilers/extra/c3/update.sh new file mode 100755 index 0000000..008dd3f --- /dev/null +++ b/compilers/extra/c3/update.sh @@ -0,0 +1,19 @@ +#!/bin/bash +cd /tmp + +if [[ ! -d c3c ]]; then + git clone https://github.com/c3lang/c3c.git +fi + +cd c3c +mkdir -p build +cd build +rm -rf * + +cmake -DCMAKE_C_FLAGS="-w" .. +make -j$(nproc) + +mkdir -p /usr/local/c3-latest/ +if [[ -f c3c ]]; then + cp -f c3c /usr/local/c3-latest/ +fi \ No newline at end of file diff --git a/compilers/slim/Dockerfile b/compilers/slim/Dockerfile new file mode 100644 index 0000000..62c9337 --- /dev/null +++ b/compilers/slim/Dockerfile @@ -0,0 +1,73 @@ +# Latest version: https://hub.docker.com/_/buildpack-deps?tab=tags&page=1&name=buster&ordering=last_updated +# This is a snapshot of buildpack-deps:buster that was last updated on 2019-12-28. +FROM judge0/buildpack-deps:buster-2019-12-28 + +# Install common software and isolate. +RUN set -xe && \ + apt-get update && \ + apt-get install -y --no-install-recommends \ + cmake \ + cmake-extras \ + cron \ + curl \ + g++ \ + gcc \ + git \ + git-lfs \ + libcap-dev \ + locales \ + make \ + nodejs \ + npm \ + sudo \ + tar \ + unzip \ + wget && \ + echo "en_US.UTF-8 UTF-8" > /etc/locale.gen && \ + locale-gen && \ + git clone https://github.com/judge0/isolate.git /tmp/isolate && \ + cd /tmp/isolate && \ + git checkout 9be3ff6ff0670763e564912a6662730e55b69536 && \ + make -j$(nproc) install && \ + useradd -r judge0 -s /bin/bash && \ + echo "judge0 ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers && \ + apt-get autoremove --purge && \ + echo "[[ ! \$DOCKER_ENTRYPOINT -eq 1 ]] && source /.bashrc" >> /etc/bash.bashrc && \ + rm -rf /tmp/* /var/lib/apt/lists/* +ENV LANG=en_US.UTF-8 LANGUAGE=en_US:en LC_ALL=en_US.UTF-8 +ENV BOX_ROOT /var/local/lib/isolate + +# Latest version: https://www.ruby-lang.org/en/downloads +ENV RUBY_VERSIONS 2.7.0 +RUN set -xe && \ + for VERSION in $RUBY_VERSIONS; do \ + curl -fSsL "https://cache.ruby-lang.org/pub/ruby/${VERSION%.*}/ruby-$VERSION.tar.gz" -o /tmp/ruby-$VERSION.tar.gz && \ + mkdir /tmp/ruby-$VERSION && \ + tar -xf /tmp/ruby-$VERSION.tar.gz -C /tmp/ruby-$VERSION --strip-components=1 && \ + rm /tmp/ruby-$VERSION.tar.gz && \ + cd /tmp/ruby-$VERSION && \ + ./configure \ + --disable-install-doc \ + --prefix=/usr/local/ruby-$VERSION && \ + make -j$(nproc) && \ + make -j$(nproc) install && \ + rm -rf /tmp/*; \ + done; \ + apt-get autoremove --purge && \ + rm -rf /tmp/* /var/lib/apt/lists/* +ENV GEM_HOME "/opt/.gem" +ENV PATH "/usr/local/ruby-2.7.0/bin:$GEM_HOME/bin:$PATH" + +ENV JUDGE0_HOMEPAGE "https://judge0.com" +LABEL homepage=$JUDGE0_HOMEPAGE + +ENV JUDGE0_SOURCE_CODE "https://github.com/judge0" +LABEL source_code=$JUDGE0_SOURCE_CODE + +ENV JUDGE0_MAINTAINER "Herman Zvonimir Došilović " +LABEL maintainer=$JUDGE0_MAINTAINER + +COPY .bashrc / +COPY docker-entrypoint.sh /usr/local/bin/ + +ENTRYPOINT ["docker-entrypoint.sh"] \ No newline at end of file diff --git a/compilers/standard/mono/Dockerfile b/compilers/standard/mono/Dockerfile new file mode 100644 index 0000000..f798415 --- /dev/null +++ b/compilers/standard/mono/Dockerfile @@ -0,0 +1,11 @@ +# Latest version: https://www.mono-project.com/download/stable +ENV MONO_VERSIONS 6.8.0.123 +RUN set -xe && \ + apt-get update && \ + apt-get install -y --no-install-recommends apt-transport-https dirmngr gnupg ca-certificates && \ + apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF && \ + echo "deb https://download.mono-project.com/repo/debian stable-buster main" | tee /etc/apt/sources.list.d/mono-official-stable.list && \ + apt-get update && \ + apt-get install -y --no-install-recommends mono-devel mono-vbnc fsharp && \ + apt-get autoremove --purge && \ + rm -rf /tmp/* /var/lib/apt/lists/* diff --git a/tests/mono/Main.cs b/compilers/standard/mono/test/c#/Main.cs similarity index 100% rename from tests/mono/Main.cs rename to compilers/standard/mono/test/c#/Main.cs diff --git a/compilers/standard/mono/test/c#/lang.properties b/compilers/standard/mono/test/c#/lang.properties new file mode 100644 index 0000000..3bd3987 --- /dev/null +++ b/compilers/standard/mono/test/c#/lang.properties @@ -0,0 +1,6 @@ +VERSIONS="6.8.0.123" +NAME="C# (Mono $VERSION)" +SOURCE_FILE="Main.cs" +BINARY_FILE="Main.exe" +COMPILE_CMD="/usr/bin/mcs $ARGS $SOURCE_FILE" +RUN_CMD="/usr/bin/mono $BINARY_FILE" \ No newline at end of file diff --git a/compilers/standard/mono/test/f#/lang.properties b/compilers/standard/mono/test/f#/lang.properties new file mode 100644 index 0000000..bf2eb2f --- /dev/null +++ b/compilers/standard/mono/test/f#/lang.properties @@ -0,0 +1,6 @@ +VERSIONS="10.2.3" +NAME="F# (fsharpc $VERSION)" +SOURCE_FILE="script.fsx" +BINARY_FILE="script.exe" +COMPILE_CMD="/usr/bin/fsharpc $ARGS $SOURCE_FILE" +RUN_CMD="./$BINARY_FILE" \ No newline at end of file diff --git a/tests/f#/script.fsx b/compilers/standard/mono/test/f#/script.fsx similarity index 100% rename from tests/f#/script.fsx rename to compilers/standard/mono/test/f#/script.fsx diff --git a/tests/vb/Main.vb b/compilers/standard/mono/test/vb/Main.vb similarity index 100% rename from tests/vb/Main.vb rename to compilers/standard/mono/test/vb/Main.vb diff --git a/tests/vb/lang.properties b/compilers/standard/mono/test/vb/lang.properties similarity index 100% rename from tests/vb/lang.properties rename to compilers/standard/mono/test/vb/lang.properties diff --git a/compilers/standard/perl/Dockerfile b/compilers/standard/perl/Dockerfile new file mode 100644 index 0000000..3e8bef2 --- /dev/null +++ b/compilers/standard/perl/Dockerfile @@ -0,0 +1,7 @@ +# Latest version: https://www.perl.org/get.html +ENV PERL_VERSIONS 5.28.1 +RUN set -xe && \ + apt-get update && \ + apt-get install -y --no-install-recommends perl && \ + apt-get autoremove --purge && \ + rm -rf /tmp/* /var/lib/apt/lists/* diff --git a/tests/perl/lang.properties b/compilers/standard/perl/test/perl/lang.properties similarity index 53% rename from tests/perl/lang.properties rename to compilers/standard/perl/test/perl/lang.properties index a0cea05..d5abf5f 100644 --- a/tests/perl/lang.properties +++ b/compilers/standard/perl/test/perl/lang.properties @@ -1,6 +1,6 @@ -VERSIONS="5.28.1" +VERSIONS="$PERL_VERSIONS" NAME="Perl ($VERSION)" SOURCE_FILE="script.pl" BINARY_FILE="" COMPILE_CMD="" -RUN_CMD="/usr/bin/perl $SOURCE_FILE" \ No newline at end of file +RUN_CMD="/usr/bin/perl $SOURCE_FILE $ARGS" \ No newline at end of file diff --git a/compilers/standard/perl/test/perl/script.pl b/compilers/standard/perl/test/perl/script.pl new file mode 100644 index 0000000..8a5b453 --- /dev/null +++ b/compilers/standard/perl/test/perl/script.pl @@ -0,0 +1,13 @@ +# Source: https://rosettacode.org/wiki/Sorting_algorithms/Bubble_sort#Perl +sub bubble_sort { + for my $i (0 .. $#_){ + for my $j ($i + 1 .. $#_){ + $_[$j] < $_[$i] and @_[$i, $j] = @_[$j, $i]; + } + } +} + +my @a = (100, 99, 98, 97, 96, 95, 94, 93, 92, 91, 90, 89, 88, 87, 86, 85, 84, 83, 82, 81, 80, 79, 78, 77, 76, 75, 74, 73, 72, 71, 70, 69, 68, 67, 66, 65, 64, 63, 62, 61, 60, 59, 58, 57, 56, 55, 54, 53, 52, 51, 50, 49, 48, 47, 46, 45, 44, 43, 42, 41, 40, 39, 38, 37, 36, 35, 34, 33, 32, 31, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1); +bubble_sort(@a); + +print "hello, world\n"; \ No newline at end of file diff --git a/dist/extra/Dockerfile b/dist/extra/Dockerfile new file mode 100644 index 0000000..5b2f807 --- /dev/null +++ b/dist/extra/Dockerfile @@ -0,0 +1,21 @@ +# THIS DOCKERFILE WAS GENERATED BY JUDGE0 BUILD TOOL. DO NOT EDIT. + +FROM judge0/api-base:2.0.0-slim + +# Latest version: https://github.com/c3lang/c3c +ENV C3_VERSIONS latest +COPY compilers/extra/c3/update.cron /cron/c3 +COPY compilers/extra/c3/update.sh /update/c3 +RUN set -xe && \ + echo "deb http://apt.llvm.org/buster/ llvm-toolchain-buster-10 main" > /etc/apt/sources.list.d/llvm.list && \ + echo "deb-src http://apt.llvm.org/buster/ llvm-toolchain-buster-10 main" >> /etc/apt/sources.list.d/llvm.list && \ + wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | apt-key add - && \ + apt-get update && \ + apt-get install -y --no-install-recommends clang-10 llvm-10-dev && \ + /update/c3 && \ + apt-get autoremove --purge && \ + rm -rf /tmp/* /var/lib/apt/lists/* + +COPY dist/extra/Dockerfile / + +LABEL version="2.0.0-extra" diff --git a/dist/slim/Dockerfile b/dist/slim/Dockerfile new file mode 100644 index 0000000..f4a06cf --- /dev/null +++ b/dist/slim/Dockerfile @@ -0,0 +1,79 @@ +# THIS DOCKERFILE WAS GENERATED BY JUDGE0 BUILD TOOL. DO NOT EDIT. + +# Latest version: https://hub.docker.com/_/buildpack-deps?tab=tags&page=1&name=buster&ordering=last_updated +# This is a snapshot of buildpack-deps:buster that was last updated on 2019-12-28. +FROM judge0/buildpack-deps:buster-2019-12-28 + +# Install common software and isolate. +RUN set -xe && \ + apt-get update && \ + apt-get install -y --no-install-recommends \ + cmake \ + cmake-extras \ + cron \ + curl \ + g++ \ + gcc \ + git \ + git-lfs \ + libcap-dev \ + locales \ + make \ + nodejs \ + npm \ + sudo \ + tar \ + unzip \ + wget && \ + echo "en_US.UTF-8 UTF-8" > /etc/locale.gen && \ + locale-gen && \ + git clone https://github.com/judge0/isolate.git /tmp/isolate && \ + cd /tmp/isolate && \ + git checkout 9be3ff6ff0670763e564912a6662730e55b69536 && \ + make -j$(nproc) install && \ + useradd -r judge0 -s /bin/bash && \ + echo "judge0 ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers && \ + apt-get autoremove --purge && \ + echo "[[ ! \$DOCKER_ENTRYPOINT -eq 1 ]] && source /.bashrc" >> /etc/bash.bashrc && \ + rm -rf /tmp/* /var/lib/apt/lists/* +ENV LANG=en_US.UTF-8 LANGUAGE=en_US:en LC_ALL=en_US.UTF-8 +ENV BOX_ROOT /var/local/lib/isolate + +# Latest version: https://www.ruby-lang.org/en/downloads +ENV RUBY_VERSIONS 2.7.0 +RUN set -xe && \ + for VERSION in $RUBY_VERSIONS; do \ + curl -fSsL "https://cache.ruby-lang.org/pub/ruby/${VERSION%.*}/ruby-$VERSION.tar.gz" -o /tmp/ruby-$VERSION.tar.gz && \ + mkdir /tmp/ruby-$VERSION && \ + tar -xf /tmp/ruby-$VERSION.tar.gz -C /tmp/ruby-$VERSION --strip-components=1 && \ + rm /tmp/ruby-$VERSION.tar.gz && \ + cd /tmp/ruby-$VERSION && \ + ./configure \ + --disable-install-doc \ + --prefix=/usr/local/ruby-$VERSION && \ + make -j$(nproc) && \ + make -j$(nproc) install && \ + rm -rf /tmp/*; \ + done; \ + apt-get autoremove --purge && \ + rm -rf /tmp/* /var/lib/apt/lists/* +ENV GEM_HOME "/opt/.gem" +ENV PATH "/usr/local/ruby-2.7.0/bin:$GEM_HOME/bin:$PATH" + +ENV JUDGE0_HOMEPAGE "https://judge0.com" +LABEL homepage=$JUDGE0_HOMEPAGE + +ENV JUDGE0_SOURCE_CODE "https://github.com/judge0" +LABEL source_code=$JUDGE0_SOURCE_CODE + +ENV JUDGE0_MAINTAINER "Herman Zvonimir Došilović " +LABEL maintainer=$JUDGE0_MAINTAINER + +COPY .bashrc / +COPY docker-entrypoint.sh /usr/local/bin/ + +ENTRYPOINT ["docker-entrypoint.sh"] + +COPY dist/slim/Dockerfile / + +LABEL version="2.0.0-slim" diff --git a/dist/standard/Dockerfile b/dist/standard/Dockerfile new file mode 100644 index 0000000..f919ab0 --- /dev/null +++ b/dist/standard/Dockerfile @@ -0,0 +1,27 @@ +# THIS DOCKERFILE WAS GENERATED BY JUDGE0 BUILD TOOL. DO NOT EDIT. + +FROM judge0/api-base:2.0.0-slim + +# Latest version: https://www.mono-project.com/download/stable +ENV MONO_VERSIONS 6.8.0.123 +RUN set -xe && \ + apt-get update && \ + apt-get install -y --no-install-recommends apt-transport-https dirmngr gnupg ca-certificates && \ + apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF && \ + echo "deb https://download.mono-project.com/repo/debian stable-buster main" | tee /etc/apt/sources.list.d/mono-official-stable.list && \ + apt-get update && \ + apt-get install -y --no-install-recommends mono-devel mono-vbnc fsharp && \ + apt-get autoremove --purge && \ + rm -rf /tmp/* /var/lib/apt/lists/* + +# Latest version: https://www.perl.org/get.html +ENV PERL_VERSIONS 5.28.1 +RUN set -xe && \ + apt-get update && \ + apt-get install -y --no-install-recommends perl && \ + apt-get autoremove --purge && \ + rm -rf /tmp/* /var/lib/apt/lists/* + +COPY dist/standard/Dockerfile / + +LABEL version="2.0.0" diff --git a/docker-entrypoint.sh b/docker-entrypoint.sh new file mode 100755 index 0000000..b5f18f5 --- /dev/null +++ b/docker-entrypoint.sh @@ -0,0 +1,14 @@ +#!/bin/bash +[[ $(whoami) != "root" ]] && SUDO=sudo + +$SUDO mkdir -p /cron /cron-log +$SUDO touch /cron/default +$SUDO cat /cron/* | $SUDO crontab - +$SUDO cron &> /dev/null + +export DOCKER_ENTRYPOINT=1 +source /.bashrc +echo +echo "Current time: $(date)" + +exec "$@" \ No newline at end of file diff --git a/extra/Dockerfile b/extra/Dockerfile deleted file mode 100644 index 81a52ac..0000000 --- a/extra/Dockerfile +++ /dev/null @@ -1,78 +0,0 @@ -FROM judge0/api-base:1.2.1-slim - -# Python for ML -RUN apt-get update && \ - apt-get install -y python3 python3-pip && \ - pip3 install \ - mlxtend \ - numpy \ - pandas \ - scikit-learn \ - scipy && \ - rm -rf /var/lib/apt/lists/* - -# Nim -COPY ./bin/update/nim /update/ -RUN set -xe && \ - /update/nim - -# MPI for C, C++ and Python -RUN set -xe && \ - apt-get update && \ - apt-get install -y --no-install-recommends libopenmpi-dev python3-mpi4py && \ - rm -rf /var/lib/apt/lists/* - -# Java -RUN set -xe && \ - curl -fSsL "https://download.java.net/java/GA/jdk14.0.1/664493ef4a6946b186ff29eb326336a2/7/GPL/openjdk-14.0.1_linux-x64_bin.tar.gz" -o /tmp/openjdk14.tar.gz && \ - mkdir /usr/local/openjdk14 && \ - tar -xf /tmp/openjdk14.tar.gz -C /usr/local/openjdk14 --strip-components=1 && \ - rm -rf /tmp/* - -# JUnit Platform Console Standalone -RUN set -xe && \ - mkdir /usr/local/junit-platform-console-standalone-1.6.2 && \ - cd /usr/local/junit-platform-console-standalone-1.6.2 && \ - curl -fSsL "https://repo1.maven.org/maven2/org/junit/platform/junit-platform-console-standalone/1.6.2/junit-platform-console-standalone-1.6.2.jar" -o launcher.jar - -# C3 -COPY ./bin/update/c3 /update/ -RUN set -xe && \ - echo "deb http://apt.llvm.org/buster/ llvm-toolchain-buster-10 main" > /etc/apt/sources.list.d/llvm.list && \ - echo "deb-src http://apt.llvm.org/buster/ llvm-toolchain-buster-10 main" >> /etc/apt/sources.list.d/llvm.list && \ - wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | apt-key add - && \ - apt-get update && \ - apt-get install -y --no-install-recommends clang-10 cmake cmake-extras llvm-10-dev && \ - ln -s /usr/bin/clang++-10 /usr/bin/clang++ && \ - ln -s /usr/bin/clang-10 /usr/bin/clang && \ - /update/c3 && \ - rm -rf /var/lib/apt/lists/* - -COPY ./bin/update/bosque /update/ -ENV PATH "/usr/local/node/bin:$PATH" -RUN set -xe && \ - echo "deb http://deb.debian.org/debian sid main" >> /etc/apt/sources.list && \ - apt-get update && \ - apt-get install -y --no-install-recommends g++-10 git-lfs && \ - curl -fSsL https://nodejs.org/dist/v12.16.3/node-v12.16.3-linux-x64.tar.xz -o /tmp/node.tar.xz && \ - mkdir /usr/local/node && \ - tar -xf /tmp/node.tar.xz -C /usr/local/node --strip-components=1 && \ - ln -fs /usr/local/node/bin/node /usr/bin/node && \ - ln -fs /usr/local/node/bin/npm /usr/bin/npm && \ - ln -fs /usr/local/node/bin/npx /usr/bin/npx && \ - npm install -g typescript && \ - /update/bosque && \ - rm -rf /var/lib/apt/lists/* /tmp/* - -COPY cron /etc/cron.d -RUN set -xe && \ - apt-get update && \ - apt-get install -y --no-install-recommends cron && \ - rm -rf /var/lib/apt/lists/* && \ - cat /etc/cron.d/* | crontab - - -COPY docker-entrypoint.sh / -ENTRYPOINT ["/docker-entrypoint.sh"] - -LABEL maintainer="Herman Zvonimir Došilović " -LABEL version="1.3.0-extra" \ No newline at end of file diff --git a/extra/bin/update/bosque b/extra/bin/update/bosque deleted file mode 100755 index 109cd5e..0000000 --- a/extra/bin/update/bosque +++ /dev/null @@ -1,20 +0,0 @@ -#!/bin/bash -cd /usr/local - -if [[ ! -d BosqueLanguage ]]; then - git clone https://github.com/microsoft/BosqueLanguage -fi - -cd BosqueLanguage -git pull origin master - -cd impl -npm install -npm run-script build - -cd /tmp -wget http://minio.judge0.com/public/api/extra/main.bsq -node /usr/local/BosqueLanguage/impl/bin/runtimes/exegen/exegen.js -c g++-10 main.bsq -rm -rf /tmp/* - -chmod -R 777 /usr/local/BosqueLanguage/impl \ No newline at end of file diff --git a/extra/bin/update/c3 b/extra/bin/update/c3 deleted file mode 100755 index cf8ae7c..0000000 --- a/extra/bin/update/c3 +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/bash -cd /tmp - -git clone https://github.com/c3lang/c3c.git -cd c3c - -mkdir build -cd build -cmake -DCMAKE_C_FLAGS="-w" .. -make -j$(nproc) - -mkdir -p /usr/local/c3 -[[ -f c3c ]] && cp c3c /usr/local/c3/ - -cd / -rm -rf /tmp/c3c \ No newline at end of file diff --git a/extra/bin/update/nim b/extra/bin/update/nim deleted file mode 100755 index cd07082..0000000 --- a/extra/bin/update/nim +++ /dev/null @@ -1,21 +0,0 @@ -#!/bin/bash -nimDir=/usr/local/nim -nim=$nimDir/bin/nim - -stable_version=`curl -fSsL https://nim-lang.org/channels/stable` -[[ -f $nim ]] && current_version=`$nim -v | head -n 1 | awk '{ print $4 }'` - -echo "Current version: $current_version" -echo "Latest stable version: $stable_version" - -if [[ $stable_version != $current_version ]]; then - echo "Updating Nim to latest stable version." - curl -fSsL "https://nim-lang.org/download/nim-$stable_version-linux_x64.tar.xz" -o /tmp/nim.tar.xf - rm -rf $nimDir - mkdir $nimDir - tar -xf /tmp/nim.tar.xf -C $nimDir --strip-components=1 - chmod +x $nim - rm /tmp/nim.tar.xf -else - echo "Nim is already up to date." -fi \ No newline at end of file diff --git a/extra/cron/bosque b/extra/cron/bosque deleted file mode 100644 index 9a35a12..0000000 --- a/extra/cron/bosque +++ /dev/null @@ -1 +0,0 @@ -0 * * * * /update/bosque &> /var/log/bosque.log diff --git a/extra/cron/c3 b/extra/cron/c3 deleted file mode 100644 index 1bebb85..0000000 --- a/extra/cron/c3 +++ /dev/null @@ -1 +0,0 @@ -0 * * * * /update/c3 &> /var/log/c3.log diff --git a/extra/cron/nim b/extra/cron/nim deleted file mode 100644 index 7179aaa..0000000 --- a/extra/cron/nim +++ /dev/null @@ -1 +0,0 @@ -0 0 * * * /update/nim &> /var/log/nim.log diff --git a/extra/docker-entrypoint.sh b/extra/docker-entrypoint.sh deleted file mode 100755 index 5bd8074..0000000 --- a/extra/docker-entrypoint.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/bash -cron -exec "$@" \ No newline at end of file diff --git a/extra/tests/bosque/lang.properties b/extra/tests/bosque/lang.properties deleted file mode 100644 index 1290d22..0000000 --- a/extra/tests/bosque/lang.properties +++ /dev/null @@ -1,6 +0,0 @@ -VERSIONS="latest" -NAME="Bosque (latest)" -SOURCE_FILE="main.bsq" -BINARY_FILE="a.out" -COMPILE_CMD="/usr/bin/node /usr/local/BosqueLanguage/impl/bin/runtimes/exegen/exegen.js -c g++-10 $ARGS $SOURCE_FILE" -RUN_CMD="./$BINARY_FILE $ARGS" \ No newline at end of file diff --git a/extra/tests/bosque/main.bsq b/extra/tests/bosque/main.bsq deleted file mode 100644 index 8d187ae..0000000 --- a/extra/tests/bosque/main.bsq +++ /dev/null @@ -1,45 +0,0 @@ -// On the Judge0 IDE, Bosque (https://github.com/microsoft/BosqueLanguage) -// is automatically updated every hour to the latest commit on master branch. - -namespace NSMain; - -concept WithName { - invariant $name != ""; - - field name: String; -} - -concept Greeting { - abstract method sayHello(): String; - - virtual method sayGoodbye(): String { - return "goodbye"; - } -} - -entity GenericGreeting provides Greeting { - const instance: GenericGreeting = GenericGreeting@{}; - - override method sayHello(): String { - return "hello world"; - } -} - -entity NamedGreeting provides WithName, Greeting { - override method sayHello(): String { - return String::concat("hello", " ", this.name); - } -} - -entrypoint function main(arg?: String): String { - var val = arg ?| ""; - if (val == "1") { - return GenericGreeting@{}->sayHello(); - } - elif (val == "2") { - return GenericGreeting::instance->sayHello(); - } - else { - return NamedGreeting@{name="bob"}->sayHello(); - } -} \ No newline at end of file diff --git a/extra/tests/c3/lang.properties b/extra/tests/c3/lang.properties deleted file mode 100644 index 2992f22..0000000 --- a/extra/tests/c3/lang.properties +++ /dev/null @@ -1,6 +0,0 @@ -VERSIONS="latest" -NAME="C3 (latest)" -SOURCE_FILE="main.c3" -BINARY_FILE="a.out" -COMPILE_CMD="/usr/local/c3/c3c $ARGS compile $SOURCE_FILE; /usr/bin/clang-10 main.o" -RUN_CMD="./$BINARY_FILE $ARGS" \ No newline at end of file diff --git a/extra/tests/clang++/lang.properties b/extra/tests/clang++/lang.properties deleted file mode 100644 index 3284df8..0000000 --- a/extra/tests/clang++/lang.properties +++ /dev/null @@ -1,6 +0,0 @@ -VERSIONS="10.0.1" -NAME="C++ (Clang $VERSION)" -SOURCE_FILE="main.cpp" -BINARY_FILE="a.out" -COMPILE_CMD="/usr/bin/clang++-10 $ARGS $SOURCE_FILE" -RUN_CMD="./$BINARY_FILE $ARGS" \ No newline at end of file diff --git a/extra/tests/clang++/main.cpp b/extra/tests/clang++/main.cpp deleted file mode 100644 index bf6330d..0000000 --- a/extra/tests/clang++/main.cpp +++ /dev/null @@ -1,10 +0,0 @@ -#include -#include - -int main() -{ - std::string name; - std::cin >> name; - std::cout << "hello, " << name << '\n'; - return 0; -} \ No newline at end of file diff --git a/extra/tests/clang/lang.properties b/extra/tests/clang/lang.properties deleted file mode 100644 index 309134c..0000000 --- a/extra/tests/clang/lang.properties +++ /dev/null @@ -1,6 +0,0 @@ -VERSIONS="10.0.1" -NAME="C (Clang $VERSION)" -SOURCE_FILE="main.c" -BINARY_FILE="a.out" -COMPILE_CMD="/usr/bin/clang-10 $ARGS $SOURCE_FILE" -RUN_CMD="./$BINARY_FILE $ARGS" \ No newline at end of file diff --git a/extra/tests/clang/main.c b/extra/tests/clang/main.c deleted file mode 100644 index 01da7fa..0000000 --- a/extra/tests/clang/main.c +++ /dev/null @@ -1,9 +0,0 @@ -#include - -int main() -{ - char name[10]; - scanf("%s", name); - printf("hello, %s\n", name); - return 0; -} \ No newline at end of file diff --git a/extra/tests/java-jdk14/Main.java b/extra/tests/java-jdk14/Main.java deleted file mode 100644 index 203e4ef..0000000 --- a/extra/tests/java-jdk14/Main.java +++ /dev/null @@ -1,5 +0,0 @@ -public class Main { - public static void main(String[] args) { - System.out.println("hello, world"); - } -} \ No newline at end of file diff --git a/extra/tests/java-jdk14/lang.properties b/extra/tests/java-jdk14/lang.properties deleted file mode 100644 index 59ff3c2..0000000 --- a/extra/tests/java-jdk14/lang.properties +++ /dev/null @@ -1,6 +0,0 @@ -VERSIONS="14.0.1" -NAME="Java (OpenJDK $VERSION)" -SOURCE_FILE="Main.java" -BINARY_FILE="Main" -COMPILE_CMD="/usr/local/openjdk14/bin/javac $ARGS $SOURCE_FILE" -RUN_CMD="/usr/local/openjdk14/bin/java $BINARY_FILE $ARGS" \ No newline at end of file diff --git a/extra/tests/junit/MainTest.java b/extra/tests/junit/MainTest.java deleted file mode 100644 index 7cd6050..0000000 --- a/extra/tests/junit/MainTest.java +++ /dev/null @@ -1,18 +0,0 @@ -import static org.junit.jupiter.api.Assertions.assertEquals; - -import org.junit.jupiter.api.Test; - -class MainTest { - static class Calculator { - public int add(int x, int y) { - return x + y; - } - } - - private final Calculator calculator = new Calculator(); - - @Test - void addition() { - assertEquals(2, calculator.add(1, 1)); - } -} diff --git a/extra/tests/junit/lang.properties b/extra/tests/junit/lang.properties deleted file mode 100644 index 5983fbf..0000000 --- a/extra/tests/junit/lang.properties +++ /dev/null @@ -1,6 +0,0 @@ -VERSIONS="14.0.1" -NAME="Java Test (OpenJDK $VERSION, JUnit Platform Console Standalone 1.6.2)" -SOURCE_FILE="MainTest.java" -BINARY_FILE="MainTest" -COMPILE_CMD="/usr/local/openjdk14/bin/javac -cp /usr/local/junit-platform-console-standalone-1.6.2/launcher.jar $ARGS $SOURCE_FILE" -RUN_CMD="/usr/local/openjdk14/bin/java -jar /usr/local/junit-platform-console-standalone-1.6.2/launcher.jar --disable-ansi-colors --disable-banner -cp . -c $BINARY_FILE $ARGS" \ No newline at end of file diff --git a/extra/tests/mpicc/lang.properties b/extra/tests/mpicc/lang.properties deleted file mode 100644 index d9053e1..0000000 --- a/extra/tests/mpicc/lang.properties +++ /dev/null @@ -1,6 +0,0 @@ -VERSIONS="8.3.0" -NAME="MPI (OpenRTE 3.1.3) with C (GCC $VERSION)" -SOURCE_FILE="main.c" -BINARY_FILE="a.out" -COMPILE_CMD="/usr/bin/mpicc $ARGS $SOURCE_FILE" -RUN_CMD="/usr/bin/mpiexec --allow-run-as-root --oversubscribe $ARGS ./$BINARY_FILE" \ No newline at end of file diff --git a/extra/tests/mpicc/main.c b/extra/tests/mpicc/main.c deleted file mode 100644 index 065f428..0000000 --- a/extra/tests/mpicc/main.c +++ /dev/null @@ -1,20 +0,0 @@ -#include - -#include - -int main() -{ - MPI_Init(NULL, NULL); - - int world_size; - MPI_Comm_size(MPI_COMM_WORLD, &world_size); - - int world_rank; - MPI_Comm_rank(MPI_COMM_WORLD, &world_rank); - - printf("Hello from processor with rank %d out of %d processors.\n", world_rank, world_size); - - MPI_Finalize(); - - return 0; -} \ No newline at end of file diff --git a/extra/tests/mpicxx/lang.properties b/extra/tests/mpicxx/lang.properties deleted file mode 100644 index af97586..0000000 --- a/extra/tests/mpicxx/lang.properties +++ /dev/null @@ -1,6 +0,0 @@ -VERSIONS="8.3.0" -NAME="MPI (OpenRTE 3.1.3) with C++ (GCC $VERSION)" -SOURCE_FILE="main.cpp" -BINARY_FILE="a.out" -COMPILE_CMD="/usr/bin/mpicxx $ARGS $SOURCE_FILE" -RUN_CMD="/usr/bin/mpiexec --allow-run-as-root --oversubscribe $ARGS ./$BINARY_FILE" \ No newline at end of file diff --git a/extra/tests/mpicxx/main.cpp b/extra/tests/mpicxx/main.cpp deleted file mode 100644 index 4238074..0000000 --- a/extra/tests/mpicxx/main.cpp +++ /dev/null @@ -1,21 +0,0 @@ -#include - -#include - -int main() -{ - MPI_Init(NULL, NULL); - - int world_size; - MPI_Comm_size(MPI_COMM_WORLD, &world_size); - - int world_rank; - MPI_Comm_rank(MPI_COMM_WORLD, &world_rank); - - std::cout << "Hello from processor with rank " - << world_rank << " out of " << world_size << " processors.\n"; - - MPI_Finalize(); - - return 0; -} \ No newline at end of file diff --git a/extra/tests/mpipy/lang.properties b/extra/tests/mpipy/lang.properties deleted file mode 100644 index 10af2a3..0000000 --- a/extra/tests/mpipy/lang.properties +++ /dev/null @@ -1,6 +0,0 @@ -VERSIONS="3.7.3" -NAME="MPI (OpenRTE 3.1.3) with Python ($VERSION)" -SOURCE_FILE="script.py" -BINARY_FILE="" -COMPILE_CMD="" -RUN_CMD="/usr/bin/mpiexec --allow-run-as-root --oversubscribe $ARGS /usr/bin/python3 $SOURCE_FILE" \ No newline at end of file diff --git a/extra/tests/mpipy/script.py b/extra/tests/mpipy/script.py deleted file mode 100644 index dd49d78..0000000 --- a/extra/tests/mpipy/script.py +++ /dev/null @@ -1,7 +0,0 @@ -from mpi4py import MPI - -comm = MPI.COMM_WORLD -world_size = comm.Get_size() -world_rank = comm.Get_rank() - -print(f"Hello from processor with rank {world_rank} out of {world_size} processors") \ No newline at end of file diff --git a/extra/tests/nim/lang.properties b/extra/tests/nim/lang.properties deleted file mode 100644 index d2ae532..0000000 --- a/extra/tests/nim/lang.properties +++ /dev/null @@ -1,6 +0,0 @@ -VERSIONS="stable" -NAME="Nim ($VERSION)" -SOURCE_FILE="main.nim" -BINARY_FILE="main" -COMPILE_CMD="/usr/local/nim/bin/nim compile --nimcache:.cache/nim $ARGS $SOURCE_FILE" -RUN_CMD="./$BINARY_FILE $ARGS" \ No newline at end of file diff --git a/extra/tests/nim/main.nim b/extra/tests/nim/main.nim deleted file mode 100644 index 38ca08e..0000000 --- a/extra/tests/nim/main.nim +++ /dev/null @@ -1 +0,0 @@ -echo "hello, world" \ No newline at end of file diff --git a/extra/tests/python3-for-ml/lang.properties b/extra/tests/python3-for-ml/lang.properties deleted file mode 100644 index 76a248f..0000000 --- a/extra/tests/python3-for-ml/lang.properties +++ /dev/null @@ -1,6 +0,0 @@ -VERSIONS="3.7.3" -NAME="Python for ML ($VERSION)" -SOURCE_FILE="script.py" -BINARY_FILE="" -COMPILE_CMD="" -RUN_CMD="/usr/bin/python3 $SOURCE_FILE $ARGS" \ No newline at end of file diff --git a/extra/tests/python3-for-ml/script.py b/extra/tests/python3-for-ml/script.py deleted file mode 100644 index 01e6b70..0000000 --- a/extra/tests/python3-for-ml/script.py +++ /dev/null @@ -1,7 +0,0 @@ -import mlxtend -import numpy -import pandas -import scipy -import sklearn - -print("hello, world") \ No newline at end of file diff --git a/extra/tests/run b/extra/tests/run deleted file mode 100755 index 12878d5..0000000 --- a/extra/tests/run +++ /dev/null @@ -1,137 +0,0 @@ -#!/bin/bash -set -e - -if [[ ! -f /.dockerenv ]]; then - echo "Tests should be run inside a Docker container. Use bin/run-tests script from the root of the project." - exit -1 -fi - -while [[ $# -gt 0 ]]; do - key="$1" - case $key in - -l|--language) - PREFERRED_LANGUAGE="$2" - shift - shift - ;; - --isolate) - ISOLATE=true - shift - ;; - --skip-cleanup) - SKIP_CLEANUP=true - shift - ;; - *) - echo "Unknown option $key" - echo "Usage: ./run [--language ] [--isolate]" - exit -1 - ;; - esac -done - -readonly LANG_PROPERTIES_FILE=lang.properties -readonly SKIP_FILE=.skip -readonly SQLITE_DB=db.sqlite - -for directory in *; do - [[ ! -d $directory ]] && continue - [[ -f $directory/$SKIP_FILE ]] && continue - - lang_properties=$directory/$LANG_PROPERTIES_FILE - [[ ! -f $lang_properties ]] && continue - - [[ -v PREFERRED_LANGUAGE && $PREFERRED_LANGUAGE != $directory ]] && continue - - source $lang_properties - for VERSION in $VERSIONS; do - source $lang_properties - - echo "--- $NAME ---" - cd $directory - - if [[ $ISOLATE == true ]]; then - echo "Initializing isolate box." - - set +e - workdir="$(isolate --cg --init)" - isolate_exit=$? - set -e - if [[ $isolate_exit != 0 ]]; then - echo "Sandbox not cleaned. Cleaning now." - isolate --cg --cleanup - workdir="$(isolate --cg --init)" - fi - - boxdir=$workdir/box - echo "Using box directory $boxdir" - - cp $SOURCE_FILE $boxdir - [[ -f $SQLITE_DB ]] && cp $SQLITE_DB $boxdir - - if [[ $COMPILE_CMD != "" ]]; then - if [[ $COMPILE_CMD_ISOLATE != "" ]]; then - COMPILE_CMD=$COMPILE_CMD_ISOLATE - unset COMPILE_CMD_ISOLATE - fi - echo $COMPILE_CMD > $boxdir/compile - - echo "Compiling inside isolate." - - set +e - isolate --cg -i /dev/null -t 15 -x 0 -w 20 -k 128000 -p120 --cg-timing --cg-mem=512000 -f 4096 \ - -E HOME=$workdir -E PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" \ - -E LANG -E LANGUAGE -E LC_ALL -d /etc:noexec -d /usr/local/BosqueLanguage/impl:rw --run -- /bin/bash compile - - if [[ $? != 0 ]]; then - if [[ $SKIP_CLEANUP != true ]]; then - echo "Running isolate cleanup." - isolate --cg --cleanup - rm -rf $workdir || true - else - echo "Skipping cleanup after execution." - fi - exit -1 - fi - - set -e - fi - - if [[ $RUN_CMD_ISOLATE != "" ]]; then - RUN_CMD=$RUN_CMD_ISOLATE - unset RUN_CMD_ISOLATE - fi - echo $RUN_CMD > $boxdir/run - echo "world" > $workdir/stdin - - echo "Running inside isolate." - - set +e - isolate --cg -t 2 -x 0.5 -w 5 -k 64000 -p60 --cg-timing --cg-mem=128000 --share-net -f 5120 \ - -E HOME=$workdir -E PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" \ - -E LANG -E LANGUAGE -E LC_ALL -d /etc:noexec --run -- /bin/bash run < $workdir/stdin - - if [[ $? != 0 ]]; then - exit_after_cleanup=true - fi - - if [[ $SKIP_CLEANUP != true ]]; then - echo "Running isolate cleanup." - isolate --cg --cleanup - rm -rf $workdir || true - else - echo "Skipping cleanup after execution." - fi - [[ $exit_after_cleanup == true ]] && exit -1 - - set -e - else - bash -c "$COMPILE_CMD" - echo "world" | bash -c "$RUN_CMD" - rm $(ls . | grep -v \.${SOURCE_FILE##*.} | grep -v $LANG_PROPERTIES_FILE | grep -v $SQLITE_DB) &> /dev/null || true - fi - - cd .. - echo - done -done diff --git a/generate_json.py b/generate_json.py deleted file mode 100755 index 57414f7..0000000 --- a/generate_json.py +++ /dev/null @@ -1,76 +0,0 @@ -#!/usr/bin/env python -import json -import logging -import os -import sys - -logging.basicConfig( - format="[%(asctime)s] [%(process)d] [%(levelname)s] %(message)s", - datefmt="%Y-%m-%d %H:%M:%S %z", - level=logging.INFO -) - -TESTS_DIR="tests" -LANG_PROPERTIES_FILE="lang.properties" -SKIP_LANG_FILE=".skip" - -def parse_lang_properties(lang_properties): - variables = {"ARGS": "%s"} - for line in lang_properties.split("\n"): - key, value = line.split("=", maxsplit=1) - variables[key] = value[1:-1] - - versions = variables["VERSIONS"].split() - languages = [] - - for version in versions: - language = {} - variables["VERSION"] = version - for key in variables: - resolved_value = variables[key] - for key2 in variables: - resolved_value = resolved_value.replace(f"${key2}", variables[key2]) - language[key] = resolved_value - languages.append(language) - return languages - -if __name__ == "__main__": - if not os.path.exists(TESTS_DIR): - logging.error("Tests directory does not exist. Please run this script from the root of the project.") - sys.exit(-1) - - languages = [] - for directory in os.listdir(TESTS_DIR): - if not os.path.isdir(os.path.join(TESTS_DIR, directory)): - continue - if os.path.exists(os.path.join(TESTS_DIR, directory, SKIP_LANG_FILE)): - continue - with open(os.path.join(TESTS_DIR, directory, LANG_PROPERTIES_FILE)) as f: - lang_properties = f.read() - languages.extend(parse_lang_properties(lang_properties)) - - languages.sort(key=lambda x: x["NAME"].lower()) - - cleaned_languages = [] - for id, language in enumerate(languages, start=1): - cleaned_language = { - "id": id, - "name": language["NAME"], - "is_archived": False, - "source_file": language["SOURCE_FILE"] - } - - if language["COMPILE_CMD"] != "": - compile_cmd = language["COMPILE_CMD"] - if "COMPILE_CMD_ISOLATE" in language: - compile_cmd = language["COMPILE_CMD_ISOLATE"] - cleaned_language["compile_cmd"] = compile_cmd - - run_cmd = language["RUN_CMD"] - if "RUN_CMD_ISOLATE" in language: - run_cmd = language["RUN_CMD_ISOLATE"] - cleaned_language["run_cmd"] = run_cmd - - cleaned_languages.append(cleaned_language) - - print(json.dumps(cleaned_languages, indent=4)) \ No newline at end of file diff --git a/slim/Dockerfile b/slim/Dockerfile deleted file mode 100644 index e287c75..0000000 --- a/slim/Dockerfile +++ /dev/null @@ -1,48 +0,0 @@ -# Check for latest version here: https://hub.docker.com/_/buildpack-deps?tab=tags&page=1&name=buster&ordering=last_updated -# This is just a snapshot of buildpack-deps:buster that was last updated on 2019-12-28. -FROM judge0/buildpack-deps:buster-2019-12-28 - -# Check for latest version here: https://www.ruby-lang.org/en/downloads -ENV RUBY_VERSIONS \ - 2.7.0 -RUN set -xe && \ - for VERSION in $RUBY_VERSIONS; do \ - curl -fSsL "https://cache.ruby-lang.org/pub/ruby/${VERSION%.*}/ruby-$VERSION.tar.gz" -o /tmp/ruby-$VERSION.tar.gz && \ - mkdir /tmp/ruby-$VERSION && \ - tar -xf /tmp/ruby-$VERSION.tar.gz -C /tmp/ruby-$VERSION --strip-components=1 && \ - rm /tmp/ruby-$VERSION.tar.gz && \ - cd /tmp/ruby-$VERSION && \ - ./configure \ - --disable-install-doc \ - --prefix=/usr/local/ruby-$VERSION && \ - make -j$(nproc) && \ - make -j$(nproc) install && \ - rm -rf /tmp/*; \ - done - -RUN set -xe && \ - apt-get update && \ - apt-get install -y --no-install-recommends nodejs npm && \ - rm -rf /var/lib/apt/lists/* - -RUN set -xe && \ - apt-get update && \ - apt-get install -y --no-install-recommends locales && \ - rm -rf /var/lib/apt/lists/* && \ - echo "en_US.UTF-8 UTF-8" > /etc/locale.gen && \ - locale-gen -ENV LANG=en_US.UTF-8 LANGUAGE=en_US:en LC_ALL=en_US.UTF-8 - -RUN set -xe && \ - apt-get update && \ - apt-get install -y --no-install-recommends git libcap-dev && \ - rm -rf /var/lib/apt/lists/* && \ - git clone https://github.com/judge0/isolate.git /tmp/isolate && \ - cd /tmp/isolate && \ - git checkout 9be3ff6ff0670763e564912a6662730e55b69536 && \ - make -j$(nproc) install && \ - rm -rf /tmp/* -ENV BOX_ROOT /var/local/lib/isolate - -LABEL maintainer="Herman Zvonimir Došilović " -LABEL version="1.3.0-slim" diff --git a/test.sh b/test.sh new file mode 100755 index 0000000..53ec9e0 --- /dev/null +++ b/test.sh @@ -0,0 +1,173 @@ +#!/bin/bash +set -e + +if [[ ! -f /.dockerenv ]]; then + echo "Creating a new container from image $1" + docker run -it --privileged --rm -v $PWD:/api-base -w /api-base $1 bash + exit 0 +fi + +function get_argument() { + if [[ -n "$2" ]] && [[ ${2:0:1} != "-" ]]; then + echo "$2" + else + echo "Error: Argument for $1 is missing" >&2 + exit 1 + fi +} + +pushd () { + command pushd "$@" > /dev/null +} + +popd () { + command popd "$@" > /dev/null +} + +edition="standard" +isolate=0 +cleanup=1 +while [[ $# -gt 0 ]]; do + case "$1" in + --edition) + edition="$(get_argument $1 $2)" + shift 2 + ;; + --isolate) + isolate=1 + shift + ;; + --compiler) + compiler="$(get_argument $1 $2)" + shift 2 + ;; + --skip-cleanup) + cleanup=0 + shift + ;; + *) + echo "Error: Unknown option $1" >&2 + echo "Usage: $0 [--edition edition] [--isolate] [--compiler compiler] [--skip-cleanup]" + exit 1 + ;; + esac +done + +readonly LANG_PROPERTIES_FILE=lang.properties +readonly SKIP_FILE=.skip +readonly SQLITE_DB=db.sqlite + +pushd compilers/$edition +for dir in *; do + [[ ! -d $dir ]] && continue + [[ ! -z "$compiler" && "$dir" != "$compiler" ]] && continue + [[ -z "$compiler" && -f $dir/$SKIP_FILE ]] && continue + + test_dir=$dir/test + [[ ! -d $test_dir ]] && continue + + pushd $test_dir + for lang in *; do + [[ ! -d $lang ]] && continue + + lang_properties=$lang/$LANG_PROPERTIES_FILE + [[ ! -f $lang_properties ]] && continue + + source $lang_properties + + pushd $lang + for VERSION in $VERSIONS; do + source $LANG_PROPERTIES_FILE + echo "+-------------------------------------------------------------------------------" + echo "| $NAME " + echo "+-------------------------------------------------------------------------------" + + if [[ $isolate -eq 1 ]]; then + echo "Initializing isolate box." + + set +e + workdir="$(isolate --cg --init)" + isolate_exit=$? + set -e + if [[ ! $isolate_exit -eq 0 ]]; then + echo "Sandbox not cleaned. Cleaning now." + isolate --cg --cleanup + workdir="$(isolate --cg --init)" + fi + + boxdir=$workdir/box + echo "Using box directory $boxdir" + + cp $SOURCE_FILE $boxdir + [[ -f $SQLITE_DB ]] && cp $SQLITE_DB $boxdir + + if [[ ! -z "$COMPILE_CMD" ]]; then + if [[ ! -z "$COMPILE_CMD_ISOLATE" ]]; then + COMPILE_CMD=$COMPILE_CMD_ISOLATE + unset COMPILE_CMD_ISOLATE + fi + + echo $COMPILE_CMD > $boxdir/compile + + echo "Compiling inside isolate." + set +e + isolate --cg -i /dev/null -t 15 -x 0 -w 20 -k 128000 -p120 --cg-timing --cg-mem=512000 -f 4096 \ + -E HOME=/tmp -E PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" \ + -E LANG -E LANGUAGE -E LC_ALL -d /etc:noexec --run -- /bin/bash compile + + if [[ $? != 0 ]]; then + if [[ $cleanup -eq 1 ]]; then + echo "Running isolate cleanup." + isolate --cg --cleanup + rm -rf $workdir || true + else + echo "Skipping cleanup after execution." + fi + exit -1 + fi + set -e + fi + + if [[ ! -z "$RUN_CMD_ISOLATE" ]]; then + RUN_CMD=$RUN_CMD_ISOLATE + unset RUN_CMD_ISOLATE + fi + + echo $RUN_CMD > $boxdir/run + echo "world" > $workdir/stdin + + echo "Running inside isolate." + + set +e + isolate --cg -t 5 -x 0.5 -w 5 -k 64000 -p60 --cg-timing --cg-mem=128000 -f 1024 \ + -E HOME=/tmp -E PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" \ + -E LANG -E LANGUAGE -E LC_ALL -d /etc:noexec --run -- /bin/bash run < $workdir/stdin + + if [[ ! $? -eq 0 ]]; then + exit_after_cleanup=true + fi + + if [[ $cleanup == 1 ]]; then + echo "Running isolate cleanup." + isolate --cg --cleanup + rm -rf $workdir || true + else + echo "Skipping cleanup after execution." + fi + + [[ $exit_after_cleanup == true ]] && exit -1 + + set -e + else + bash -c "$COMPILE_CMD" + echo "world" | bash -c "$RUN_CMD" + rm $(ls . | grep -v \.${SOURCE_FILE##*.} | grep -v $LANG_PROPERTIES_FILE | grep -v $SQLITE_DB) &> /dev/null || true + fi + + echo + done + popd + done + popd +done +popd \ No newline at end of file diff --git a/tests/bash/lang.properties b/tests/bash/lang.properties deleted file mode 100644 index 1ea2e00..0000000 --- a/tests/bash/lang.properties +++ /dev/null @@ -1,6 +0,0 @@ -VERSIONS="5.0.0" -NAME="Bash ($VERSION)" -SOURCE_FILE="script.sh" -BINARY_FILE="" -COMPILE_CMD="" -RUN_CMD="/usr/local/bash-${VERSION%.*}/bin/bash $SOURCE_FILE" \ No newline at end of file diff --git a/tests/bash/script.sh b/tests/bash/script.sh deleted file mode 100644 index 328982f..0000000 --- a/tests/bash/script.sh +++ /dev/null @@ -1,2 +0,0 @@ -read name -echo hello, $name \ No newline at end of file diff --git a/tests/clang++/lang.properties b/tests/clang++/lang.properties deleted file mode 100644 index 583a722..0000000 --- a/tests/clang++/lang.properties +++ /dev/null @@ -1,6 +0,0 @@ -VERSIONS="7.0.1" -NAME="C++ (Clang $VERSION)" -SOURCE_FILE="main.cpp" -BINARY_FILE="a.out" -COMPILE_CMD="/usr/bin/clang++-7 $ARGS $SOURCE_FILE" -RUN_CMD="./$BINARY_FILE" \ No newline at end of file diff --git a/tests/clang++/main.cpp b/tests/clang++/main.cpp deleted file mode 100644 index bf6330d..0000000 --- a/tests/clang++/main.cpp +++ /dev/null @@ -1,10 +0,0 @@ -#include -#include - -int main() -{ - std::string name; - std::cin >> name; - std::cout << "hello, " << name << '\n'; - return 0; -} \ No newline at end of file diff --git a/tests/clang/lang.properties b/tests/clang/lang.properties deleted file mode 100644 index 0f0dfe1..0000000 --- a/tests/clang/lang.properties +++ /dev/null @@ -1,6 +0,0 @@ -VERSIONS="7.0.1" -NAME="C (Clang $VERSION)" -SOURCE_FILE="main.c" -BINARY_FILE="a.out" -COMPILE_CMD="/usr/bin/clang-7 $ARGS $SOURCE_FILE" -RUN_CMD="./$BINARY_FILE" \ No newline at end of file diff --git a/tests/clang/main.c b/tests/clang/main.c deleted file mode 100644 index 01da7fa..0000000 --- a/tests/clang/main.c +++ /dev/null @@ -1,9 +0,0 @@ -#include - -int main() -{ - char name[10]; - scanf("%s", name); - printf("hello, %s\n", name); - return 0; -} \ No newline at end of file diff --git a/tests/clojure/lang.properties b/tests/clojure/lang.properties deleted file mode 100644 index 7ba1549..0000000 --- a/tests/clojure/lang.properties +++ /dev/null @@ -1,6 +0,0 @@ -VERSIONS="1.10.1" -NAME="Clojure ($VERSION)" -SOURCE_FILE="main.clj" -BINARY_FILE="" -COMPILE_CMD="" -RUN_CMD="/usr/local/bin/java -jar /usr/local/clojure-1.10.1/clojure.jar $SOURCE_FILE" \ No newline at end of file diff --git a/tests/clojure/main.clj b/tests/clojure/main.clj deleted file mode 100644 index 03e6b78..0000000 --- a/tests/clojure/main.clj +++ /dev/null @@ -1 +0,0 @@ -(println "hello, world") \ No newline at end of file diff --git a/tests/d/lang.properties b/tests/d/lang.properties deleted file mode 100644 index b36d7d7..0000000 --- a/tests/d/lang.properties +++ /dev/null @@ -1,6 +0,0 @@ -VERSIONS="2.089.1" -NAME="D (DMD $VERSION)" -SOURCE_FILE="main.d" -BINARY_FILE="main" -COMPILE_CMD="/usr/local/d-$VERSION/linux/bin64/dmd $ARGS $SOURCE_FILE" -RUN_CMD="./$BINARY_FILE" \ No newline at end of file diff --git a/tests/d/main.d b/tests/d/main.d deleted file mode 100644 index f4bb77f..0000000 --- a/tests/d/main.d +++ /dev/null @@ -1,6 +0,0 @@ -import std.stdio; - -void main() -{ - writeln("hello, world"); -} \ No newline at end of file diff --git a/tests/elixir/lang.properties b/tests/elixir/lang.properties deleted file mode 100644 index ed143a2..0000000 --- a/tests/elixir/lang.properties +++ /dev/null @@ -1,6 +0,0 @@ -VERSIONS="1.9.4" -NAME="Elixir ($VERSION)" -SOURCE_FILE="script.exs" -BINARY_FILE="" -COMPILE_CMD="" -RUN_CMD="/usr/local/elixir-$VERSION/bin/elixir $SOURCE_FILE" \ No newline at end of file diff --git a/tests/elixir/script.exs b/tests/elixir/script.exs deleted file mode 100644 index 99e7e1c..0000000 --- a/tests/elixir/script.exs +++ /dev/null @@ -1 +0,0 @@ -IO.puts "hello, world" diff --git a/tests/erlang/lang.properties b/tests/erlang/lang.properties deleted file mode 100644 index efa21bd..0000000 --- a/tests/erlang/lang.properties +++ /dev/null @@ -1,7 +0,0 @@ -VERSIONS="22.2" -NAME="Erlang (OTP $VERSION)" -SOURCE_FILE="main.erl" -BINARY_FILE="" -COMPILE_CMD="" -RUN_CMD="/usr/local/erlang-$VERSION/bin/escript $SOURCE_FILE" -RUN_CMD_ISOLATE="/bin/sed -i '1s/^/\\n/' $SOURCE_FILE && /usr/local/erlang-$VERSION/bin/escript $SOURCE_FILE" \ No newline at end of file diff --git a/tests/erlang/main.erl b/tests/erlang/main.erl deleted file mode 100644 index 6b4f2c6..0000000 --- a/tests/erlang/main.erl +++ /dev/null @@ -1,3 +0,0 @@ - -main(_) -> - io:fwrite("hello, world\n"). \ No newline at end of file diff --git a/tests/exe/a.out b/tests/exe/a.out deleted file mode 100755 index 1974d56..0000000 Binary files a/tests/exe/a.out and /dev/null differ diff --git a/tests/exe/lang.properties b/tests/exe/lang.properties deleted file mode 100644 index a78a6d9..0000000 --- a/tests/exe/lang.properties +++ /dev/null @@ -1,6 +0,0 @@ -VERSIONS="ignorable" -NAME="Executable" -SOURCE_FILE="a.out" -BINARY_FILE="" -COMPILE_CMD="" -RUN_CMD="/bin/chmod +x $SOURCE_FILE && ./$SOURCE_FILE" \ No newline at end of file diff --git a/tests/f#/lang.properties b/tests/f#/lang.properties deleted file mode 100644 index 785a0d0..0000000 --- a/tests/f#/lang.properties +++ /dev/null @@ -1,6 +0,0 @@ -VERSIONS="3.1.202" -NAME="F# (.NET Core SDK $VERSION)" -SOURCE_FILE="script.fsx" -BINARY_FILE="" -COMPILE_CMD="" -RUN_CMD="mkdir -p ~/.dotnet && touch ~/.dotnet/$VERSION.dotnetFirstUseSentinel && /usr/local/dotnet-sdk/dotnet fsi $SOURCE_FILE" \ No newline at end of file diff --git a/tests/fbc/lang.properties b/tests/fbc/lang.properties deleted file mode 100644 index 50490f5..0000000 --- a/tests/fbc/lang.properties +++ /dev/null @@ -1,6 +0,0 @@ -VERSIONS="1.07.1" -NAME="Basic (FBC $VERSION)" -SOURCE_FILE="main.bas" -BINARY_FILE="main" -COMPILE_CMD="/usr/local/fbc-$VERSION/bin/fbc $ARGS $SOURCE_FILE" -RUN_CMD="./$BINARY_FILE" \ No newline at end of file diff --git a/tests/fbc/main.bas b/tests/fbc/main.bas deleted file mode 100644 index c4de158..0000000 --- a/tests/fbc/main.bas +++ /dev/null @@ -1 +0,0 @@ -PRINT "hello, world" diff --git a/tests/fpc/lang.properties b/tests/fpc/lang.properties deleted file mode 100644 index 8e03058..0000000 --- a/tests/fpc/lang.properties +++ /dev/null @@ -1,6 +0,0 @@ -VERSIONS="3.0.4" -NAME="Pascal (FPC $VERSION)" -SOURCE_FILE="main.pas" -BINARY_FILE="main" -COMPILE_CMD="/usr/local/fpc-$VERSION/bin/fpc $ARGS $SOURCE_FILE" -RUN_CMD="./$BINARY_FILE" \ No newline at end of file diff --git a/tests/fpc/main.pas b/tests/fpc/main.pas deleted file mode 100644 index 294cd97..0000000 --- a/tests/fpc/main.pas +++ /dev/null @@ -1,6 +0,0 @@ -program Hello; -var name : String; -begin - readln(name); - writeln('hello, ', name); -end. \ No newline at end of file diff --git a/tests/g++/lang.properties b/tests/g++/lang.properties deleted file mode 100644 index fa183f5..0000000 --- a/tests/g++/lang.properties +++ /dev/null @@ -1,6 +0,0 @@ -VERSIONS="7.4.0 8.3.0 9.2.0" -NAME="C++ (GCC $VERSION)" -SOURCE_FILE="main.cpp" -BINARY_FILE="a.out" -COMPILE_CMD="/usr/local/gcc-$VERSION/bin/g++ $ARGS $SOURCE_FILE" -RUN_CMD="LD_LIBRARY_PATH=/usr/local/gcc-$VERSION/lib64 ./$BINARY_FILE" \ No newline at end of file diff --git a/tests/g++/main.cpp b/tests/g++/main.cpp deleted file mode 100644 index bf6330d..0000000 --- a/tests/g++/main.cpp +++ /dev/null @@ -1,10 +0,0 @@ -#include -#include - -int main() -{ - std::string name; - std::cin >> name; - std::cout << "hello, " << name << '\n'; - return 0; -} \ No newline at end of file diff --git a/tests/gcc/lang.properties b/tests/gcc/lang.properties deleted file mode 100644 index 7219430..0000000 --- a/tests/gcc/lang.properties +++ /dev/null @@ -1,6 +0,0 @@ -VERSIONS="7.4.0 8.3.0 9.2.0" -NAME="C (GCC $VERSION)" -SOURCE_FILE="main.c" -BINARY_FILE="a.out" -COMPILE_CMD="/usr/local/gcc-$VERSION/bin/gcc $ARGS $SOURCE_FILE" -RUN_CMD="./$BINARY_FILE" \ No newline at end of file diff --git a/tests/gcc/main.c b/tests/gcc/main.c deleted file mode 100644 index 01da7fa..0000000 --- a/tests/gcc/main.c +++ /dev/null @@ -1,9 +0,0 @@ -#include - -int main() -{ - char name[10]; - scanf("%s", name); - printf("hello, %s\n", name); - return 0; -} \ No newline at end of file diff --git a/tests/gfortran/lang.properties b/tests/gfortran/lang.properties deleted file mode 100644 index 0221afc..0000000 --- a/tests/gfortran/lang.properties +++ /dev/null @@ -1,6 +0,0 @@ -VERSIONS="9.2.0" -NAME="Fortran (GFortran $VERSION)" -SOURCE_FILE="main.f90" -BINARY_FILE="a.out" -COMPILE_CMD="/usr/local/gcc-$VERSION/bin/gfortran $ARGS $SOURCE_FILE" -RUN_CMD="LD_LIBRARY_PATH=/usr/local/gcc-$VERSION/lib64 ./$BINARY_FILE" \ No newline at end of file diff --git a/tests/gfortran/main.f90 b/tests/gfortran/main.f90 deleted file mode 100644 index 6c5b6c6..0000000 --- a/tests/gfortran/main.f90 +++ /dev/null @@ -1,5 +0,0 @@ -program main - character(5) :: name - read *, name - print *, "hello, ", name -end \ No newline at end of file diff --git a/tests/ghc/lang.properties b/tests/ghc/lang.properties deleted file mode 100644 index f8ff8b4..0000000 --- a/tests/ghc/lang.properties +++ /dev/null @@ -1,6 +0,0 @@ -VERSIONS="8.8.1" -NAME="Haskell (GHC $VERSION)" -SOURCE_FILE="main.hs" -BINARY_FILE="main" -COMPILE_CMD="/usr/local/ghc-$VERSION/bin/ghc $ARGS $SOURCE_FILE" -RUN_CMD="./$BINARY_FILE" \ No newline at end of file diff --git a/tests/ghc/main.hs b/tests/ghc/main.hs deleted file mode 100644 index 580b8d1..0000000 --- a/tests/ghc/main.hs +++ /dev/null @@ -1,5 +0,0 @@ -import System.IO -import Text.Printf -main = do - str <- getLine - printf "hello, %s\n" str \ No newline at end of file diff --git a/tests/gnucobol/lang.properties b/tests/gnucobol/lang.properties deleted file mode 100644 index e0af96b..0000000 --- a/tests/gnucobol/lang.properties +++ /dev/null @@ -1,6 +0,0 @@ -VERSIONS="2.2" -NAME="COBOL (GnuCOBOL $VERSION)" -SOURCE_FILE="main.cob" -BINARY_FILE="main" -COMPILE_CMD="/usr/local/gnucobol-$VERSION/bin/cobc -free -x $ARGS $SOURCE_FILE" -RUN_CMD="LD_LIBRARY_PATH=/usr/local/gnucobol-2.2/lib ./$BINARY_FILE" \ No newline at end of file diff --git a/tests/gnucobol/main.cob b/tests/gnucobol/main.cob deleted file mode 100644 index 66f0e6e..0000000 --- a/tests/gnucobol/main.cob +++ /dev/null @@ -1,5 +0,0 @@ -IDENTIFICATION DIVISION. -PROGRAM-ID. MAIN. -PROCEDURE DIVISION. -DISPLAY "hello, world". -STOP RUN. diff --git a/tests/go/lang.properties b/tests/go/lang.properties deleted file mode 100644 index 1febb30..0000000 --- a/tests/go/lang.properties +++ /dev/null @@ -1,7 +0,0 @@ -VERSIONS="1.13.5" -NAME="Go ($VERSION)" -SOURCE_FILE="main.go" -BINARY_FILE="main" -COMPILE_CMD="/usr/local/go-$VERSION/bin/go build $ARGS $SOURCE_FILE" -COMPILE_CMD_ISOLATE="GOCACHE=/tmp/.cache/go-build /usr/local/go-$VERSION/bin/go build $ARGS $SOURCE_FILE" -RUN_CMD="./$BINARY_FILE" \ No newline at end of file diff --git a/tests/go/main.go b/tests/go/main.go deleted file mode 100644 index b7f0407..0000000 --- a/tests/go/main.go +++ /dev/null @@ -1,7 +0,0 @@ -package main - -import "fmt" - -func main() { - fmt.Println("hello, world") -} diff --git a/tests/gprolog/lang.properties b/tests/gprolog/lang.properties deleted file mode 100644 index a947bd2..0000000 --- a/tests/gprolog/lang.properties +++ /dev/null @@ -1,7 +0,0 @@ -VERSIONS="1.4.5" -NAME="Prolog (GNU Prolog $VERSION)" -SOURCE_FILE="main.pro" -BINARY_FILE="main" -COMPILE_CMD="PATH=\"/usr/local/gprolog-$VERSION/gprolog-$VERSION/bin:\$PATH\" /usr/local/gprolog-$VERSION/gprolog-$VERSION/bin/gplc --no-top-level $ARGS $SOURCE_FILE" -COMPILE_CMD_ISOLATE="PATH=\"/usr/local/gprolog-$VERSION/gprolog-$VERSION/bin:\$PATH\" /usr/local/gprolog-$VERSION/gprolog-$VERSION/bin/gplc --no-top-level $ARGS $SOURCE_FILE" -RUN_CMD="./$BINARY_FILE" \ No newline at end of file diff --git a/tests/gprolog/main.pro b/tests/gprolog/main.pro deleted file mode 100644 index 7f87253..0000000 --- a/tests/gprolog/main.pro +++ /dev/null @@ -1,2 +0,0 @@ -:- initialization(main). -main :- write('hello, world\n'). \ No newline at end of file diff --git a/tests/groovy/lang.properties b/tests/groovy/lang.properties deleted file mode 100644 index 2ab9ba5..0000000 --- a/tests/groovy/lang.properties +++ /dev/null @@ -1,6 +0,0 @@ -VERSIONS="3.0.3" -NAME="Groovy ($VERSION)" -SOURCE_FILE="script.groovy" -BINARY_FILE="script" -COMPILE_CMD="/usr/local/groovy-$VERSION/bin/groovyc $ARGS $SOURCE_FILE" -RUN_CMD="/usr/local/bin/java -cp \".:/usr/local/groovy-$VERSION/lib/*\" $BINARY_FILE" \ No newline at end of file diff --git a/tests/groovy/script.groovy b/tests/groovy/script.groovy deleted file mode 100644 index f8c3e33..0000000 --- a/tests/groovy/script.groovy +++ /dev/null @@ -1 +0,0 @@ -println "hello, world" \ No newline at end of file diff --git a/tests/java/Main.java b/tests/java/Main.java deleted file mode 100644 index 9c135f2..0000000 --- a/tests/java/Main.java +++ /dev/null @@ -1,9 +0,0 @@ -import java.io.*; - -public class Main { - public static void main(String[] args) throws IOException { - BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); - String name = reader.readLine(); - System.out.printf("hello, %s\n", name); - } -} diff --git a/tests/java/lang.properties b/tests/java/lang.properties deleted file mode 100644 index dd0a295..0000000 --- a/tests/java/lang.properties +++ /dev/null @@ -1,6 +0,0 @@ -VERSIONS="13.0.1" -NAME="Java (OpenJDK $VERSION)" -SOURCE_FILE="Main.java" -BINARY_FILE="Main.class" -COMPILE_CMD="/usr/local/openjdk${VERSION%%.*}/bin/javac $ARGS $SOURCE_FILE" -RUN_CMD="/usr/local/openjdk${VERSION%%.*}/bin/java ${BINARY_FILE%.*}" \ No newline at end of file diff --git a/tests/julia/.skip b/tests/julia/.skip deleted file mode 100644 index e69de29..0000000 diff --git a/tests/julia/lang.properties b/tests/julia/lang.properties deleted file mode 100644 index d23470a..0000000 --- a/tests/julia/lang.properties +++ /dev/null @@ -1,6 +0,0 @@ -VERSIONS="1.3.0" -NAME="Julia ($VERSION)" -SOURCE_FILE="script.jl" -BINARY_FILE="" -COMPILE_CMD="" -RUN_CMD="/usr/local/julia-$VERSION/bin/julia $SOURCE_FILE" \ No newline at end of file diff --git a/tests/julia/script.jl b/tests/julia/script.jl deleted file mode 100644 index 9e9e167..0000000 --- a/tests/julia/script.jl +++ /dev/null @@ -1 +0,0 @@ -println("hello, world") \ No newline at end of file diff --git a/tests/kotlin/Main.kt b/tests/kotlin/Main.kt deleted file mode 100644 index 4695753..0000000 --- a/tests/kotlin/Main.kt +++ /dev/null @@ -1,4 +0,0 @@ -fun main() { - val name = readLine() - println("hello, $name") -} \ No newline at end of file diff --git a/tests/kotlin/lang.properties b/tests/kotlin/lang.properties deleted file mode 100644 index 11b28a5..0000000 --- a/tests/kotlin/lang.properties +++ /dev/null @@ -1,6 +0,0 @@ -VERSIONS="1.3.70" -NAME="Kotlin ($VERSION)" -SOURCE_FILE="Main.kt" -BINARY_FILE="MainKt" -COMPILE_CMD="/usr/local/kotlin-$VERSION/bin/kotlinc $ARGS $SOURCE_FILE" -RUN_CMD="/usr/local/kotlin-$VERSION/bin/kotlin $BINARY_FILE" \ No newline at end of file diff --git a/tests/lua/lang.properties b/tests/lua/lang.properties deleted file mode 100644 index cb52d90..0000000 --- a/tests/lua/lang.properties +++ /dev/null @@ -1,6 +0,0 @@ -VERSIONS="5.3.5" -NAME="Lua ($VERSION)" -SOURCE_FILE="script.lua" -BINARY_FILE="luac.out" -COMPILE_CMD="/usr/local/lua-$VERSION/luac53 $ARGS $SOURCE_FILE" -RUN_CMD="/usr/local/lua-$VERSION/lua53 ./$BINARY_FILE" \ No newline at end of file diff --git a/tests/lua/script.lua b/tests/lua/script.lua deleted file mode 100644 index bc63dc6..0000000 --- a/tests/lua/script.lua +++ /dev/null @@ -1 +0,0 @@ -print("hello, world") \ No newline at end of file diff --git a/tests/mono/lang.properties b/tests/mono/lang.properties deleted file mode 100644 index c4af041..0000000 --- a/tests/mono/lang.properties +++ /dev/null @@ -1,6 +0,0 @@ -VERSIONS="6.6.0.161" -NAME="C# (Mono $VERSION)" -SOURCE_FILE="Main.cs" -BINARY_FILE="Main.exe" -COMPILE_CMD="/usr/local/mono-$VERSION/bin/mcs $ARGS $SOURCE_FILE" -RUN_CMD="/usr/local/mono-$VERSION/bin/mono $BINARY_FILE" \ No newline at end of file diff --git a/tests/nasm/lang.properties b/tests/nasm/lang.properties deleted file mode 100644 index 6e8b31b..0000000 --- a/tests/nasm/lang.properties +++ /dev/null @@ -1,6 +0,0 @@ -VERSIONS="2.14.02" -NAME="Assembly (NASM $VERSION)" -SOURCE_FILE="main.asm" -BINARY_FILE="a.out" -COMPILE_CMD="/usr/local/nasm-$VERSION/bin/nasmld -f elf64 $ARGS main.asm" -RUN_CMD="./$BINARY_FILE" \ No newline at end of file diff --git a/tests/nasm/main.asm b/tests/nasm/main.asm deleted file mode 100644 index 814758e..0000000 --- a/tests/nasm/main.asm +++ /dev/null @@ -1,20 +0,0 @@ -section .text - global _start - -_start: - - xor eax, eax - lea edx, [rax+len] - mov al, 1 - mov esi, msg - mov edi, eax - syscall - - xor edi, edi - lea eax, [rdi+60] - syscall - -section .rodata - -msg db 'hello, world', 0xa -len equ $ - msg \ No newline at end of file diff --git a/tests/node/lang.properties b/tests/node/lang.properties deleted file mode 100644 index d9c1242..0000000 --- a/tests/node/lang.properties +++ /dev/null @@ -1,6 +0,0 @@ -VERSIONS="12.14.0" -NAME="JavaScript (Node.js $VERSION)" -SOURCE_FILE="script.js" -BINARY_FILE="" -COMPILE_CMD="" -RUN_CMD="/usr/local/node-$VERSION/bin/node $SOURCE_FILE" \ No newline at end of file diff --git a/tests/node/script.js b/tests/node/script.js deleted file mode 100644 index 97a6142..0000000 --- a/tests/node/script.js +++ /dev/null @@ -1,3 +0,0 @@ -process.stdin.on("data", function(data) { - console.log("hello, " + data); -}); \ No newline at end of file diff --git a/tests/objective-c/lang.properties b/tests/objective-c/lang.properties deleted file mode 100644 index 32cc17c..0000000 --- a/tests/objective-c/lang.properties +++ /dev/null @@ -1,6 +0,0 @@ -VERSIONS="7.0.1" -NAME="Objective-C (Clang $VERSION)" -SOURCE_FILE="main.m" -BINARY_FILE="a.out" -COMPILE_CMD="/usr/bin/clang-7 `gnustep-config --objc-flags | sed 's/-W[^ ]* //g'` `gnustep-config --base-libs | sed 's/-shared-libgcc//'` -I/usr/lib/gcc/x86_64-linux-gnu/8/include $SOURCE_FILE $ARGS" -RUN_CMD="./$BINARY_FILE" \ No newline at end of file diff --git a/tests/objective-c/main.m b/tests/objective-c/main.m deleted file mode 100644 index ad4e63d..0000000 --- a/tests/objective-c/main.m +++ /dev/null @@ -1,11 +0,0 @@ -#import - -int main() { - @autoreleasepool { - char name[10]; - scanf("%s", name); - NSString *message = [NSString stringWithFormat:@"hello, %s\n", name]; - printf("%s", message.UTF8String); - } - return 0; -} \ No newline at end of file diff --git a/tests/ocaml/lang.properties b/tests/ocaml/lang.properties deleted file mode 100644 index 8693992..0000000 --- a/tests/ocaml/lang.properties +++ /dev/null @@ -1,6 +0,0 @@ -VERSIONS="4.09.0" -NAME="OCaml ($VERSION)" -SOURCE_FILE="main.ml" -BINARY_FILE="a.out" -COMPILE_CMD="/usr/local/ocaml-$VERSION/bin/ocamlc $ARGS $SOURCE_FILE" -RUN_CMD="./$BINARY_FILE" \ No newline at end of file diff --git a/tests/ocaml/main.ml b/tests/ocaml/main.ml deleted file mode 100644 index 4d46b22..0000000 --- a/tests/ocaml/main.ml +++ /dev/null @@ -1 +0,0 @@ -print_endline "hello, world" \ No newline at end of file diff --git a/tests/octave/lang.properties b/tests/octave/lang.properties deleted file mode 100644 index 108f97b..0000000 --- a/tests/octave/lang.properties +++ /dev/null @@ -1,6 +0,0 @@ -VERSIONS="5.1.0" -NAME="Octave ($VERSION)" -SOURCE_FILE="script.m" -BINARY_FILE="" -COMPILE_CMD="" -RUN_CMD="/usr/local/octave-$VERSION/bin/octave-cli -q --no-gui --no-history $SOURCE_FILE" \ No newline at end of file diff --git a/tests/octave/script.m b/tests/octave/script.m deleted file mode 100644 index 41f296b..0000000 --- a/tests/octave/script.m +++ /dev/null @@ -1,2 +0,0 @@ -name = input("", "s"); -printf("hello, %s\n", name); \ No newline at end of file diff --git a/tests/perl/script.pl b/tests/perl/script.pl deleted file mode 100644 index 8939784..0000000 --- a/tests/perl/script.pl +++ /dev/null @@ -1,2 +0,0 @@ -my $name = ; -print "hello, $name"; \ No newline at end of file diff --git a/tests/php/lang.properties b/tests/php/lang.properties deleted file mode 100644 index 98b473d..0000000 --- a/tests/php/lang.properties +++ /dev/null @@ -1,6 +0,0 @@ -VERSIONS="7.4.1" -NAME="PHP ($VERSION)" -SOURCE_FILE="script.php" -BINARY_FILE="" -COMPILE_CMD="" -RUN_CMD="/usr/local/php-$VERSION/bin/php $SOURCE_FILE" \ No newline at end of file diff --git a/tests/php/script.php b/tests/php/script.php deleted file mode 100644 index 989f049..0000000 --- a/tests/php/script.php +++ /dev/null @@ -1,3 +0,0 @@ - \ No newline at end of file diff --git a/tests/python/lang.properties b/tests/python/lang.properties deleted file mode 100644 index 93c2493..0000000 --- a/tests/python/lang.properties +++ /dev/null @@ -1,6 +0,0 @@ -VERSIONS="2.7.17 3.8.1" -NAME="Python ($VERSION)" -SOURCE_FILE="script-$VERSION.py" -BINARY_FILE="" -COMPILE_CMD="" -RUN_CMD="/usr/local/python-$VERSION/bin/python${VERSION%%.*} $SOURCE_FILE" \ No newline at end of file diff --git a/tests/python/script-2.7.17.py b/tests/python/script-2.7.17.py deleted file mode 100644 index 008d207..0000000 --- a/tests/python/script-2.7.17.py +++ /dev/null @@ -1 +0,0 @@ -print "hello, " + raw_input() \ No newline at end of file diff --git a/tests/python/script-3.8.1.py b/tests/python/script-3.8.1.py deleted file mode 100644 index 85c887d..0000000 --- a/tests/python/script-3.8.1.py +++ /dev/null @@ -1 +0,0 @@ -print(f"hello, {input()}") \ No newline at end of file diff --git a/tests/r/lang.properties b/tests/r/lang.properties deleted file mode 100644 index e094271..0000000 --- a/tests/r/lang.properties +++ /dev/null @@ -1,6 +0,0 @@ -VERSIONS="4.0.0" -NAME="R ($VERSION)" -SOURCE_FILE="script.r" -BINARY_FILE="" -COMPILE_CMD="" -RUN_CMD="/usr/local/r-$VERSION/bin/Rscript $SOURCE_FILE" \ No newline at end of file diff --git a/tests/r/script.r b/tests/r/script.r deleted file mode 100644 index aef6682..0000000 --- a/tests/r/script.r +++ /dev/null @@ -1 +0,0 @@ -cat("hello, world\n") \ No newline at end of file diff --git a/tests/ruby/lang.properties b/tests/ruby/lang.properties deleted file mode 100644 index d40f575..0000000 --- a/tests/ruby/lang.properties +++ /dev/null @@ -1,6 +0,0 @@ -VERSIONS="2.7.0" -NAME="Ruby ($VERSION)" -SOURCE_FILE="script.rb" -BINARY_FILE="" -COMPILE_CMD="" -RUN_CMD="/usr/local/ruby-$VERSION/bin/ruby $SOURCE_FILE" \ No newline at end of file diff --git a/tests/ruby/script.rb b/tests/ruby/script.rb deleted file mode 100644 index f47b522..0000000 --- a/tests/ruby/script.rb +++ /dev/null @@ -1 +0,0 @@ -puts("hello, #{gets.chomp}") \ No newline at end of file diff --git a/tests/run b/tests/run deleted file mode 100755 index 70fb78f..0000000 --- a/tests/run +++ /dev/null @@ -1,137 +0,0 @@ -#!/bin/bash -set -e - -if [[ ! -f /.dockerenv ]]; then - echo "Tests should be run inside a Docker container. Use bin/run-tests script from the root of the project." - exit -1 -fi - -while [[ $# -gt 0 ]]; do - key="$1" - case $key in - -l|--language) - PREFERRED_LANGUAGE="$2" - shift - shift - ;; - --isolate) - ISOLATE=true - shift - ;; - --skip-cleanup) - SKIP_CLEANUP=true - shift - ;; - *) - echo "Unknown option $key" - echo "Usage: ./run [--language ] [--isolate]" - exit -1 - ;; - esac -done - -readonly LANG_PROPERTIES_FILE=lang.properties -readonly SKIP_FILE=.skip -readonly SQLITE_DB=db.sqlite - -for directory in *; do - [[ ! -d $directory ]] && continue - [[ -f $directory/$SKIP_FILE ]] && continue - - lang_properties=$directory/$LANG_PROPERTIES_FILE - [[ ! -f $lang_properties ]] && continue - - [[ -v PREFERRED_LANGUAGE && $PREFERRED_LANGUAGE != $directory ]] && continue - - source $lang_properties - for VERSION in $VERSIONS; do - source $lang_properties - - echo "--- $NAME ---" - cd $directory - - if [[ $ISOLATE == true ]]; then - echo "Initializing isolate box." - - set +e - workdir="$(isolate --cg --init)" - isolate_exit=$? - set -e - if [[ $isolate_exit != 0 ]]; then - echo "Sandbox not cleaned. Cleaning now." - isolate --cg --cleanup - workdir="$(isolate --cg --init)" - fi - - boxdir=$workdir/box - echo "Using box directory $boxdir" - - cp $SOURCE_FILE $boxdir - [[ -f $SQLITE_DB ]] && cp $SQLITE_DB $boxdir - - if [[ $COMPILE_CMD != "" ]]; then - if [[ $COMPILE_CMD_ISOLATE != "" ]]; then - COMPILE_CMD=$COMPILE_CMD_ISOLATE - unset COMPILE_CMD_ISOLATE - fi - echo $COMPILE_CMD > $boxdir/compile - - echo "Compiling inside isolate." - - set +e - isolate --cg -i /dev/null -t 15 -x 0 -w 20 -k 128000 -p120 --cg-timing --cg-mem=512000 -f 4096 \ - -E HOME=/tmp -E PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" \ - -E LANG -E LANGUAGE -E LC_ALL -d /etc:noexec --run -- /bin/bash compile - - if [[ $? != 0 ]]; then - if [[ $SKIP_CLEANUP != true ]]; then - echo "Running isolate cleanup." - isolate --cg --cleanup - rm -rf $workdir || true - else - echo "Skipping cleanup after execution." - fi - exit -1 - fi - - set -e - fi - - if [[ $RUN_CMD_ISOLATE != "" ]]; then - RUN_CMD=$RUN_CMD_ISOLATE - unset RUN_CMD_ISOLATE - fi - echo $RUN_CMD > $boxdir/run - echo "world" > $workdir/stdin - - echo "Running inside isolate." - - set +e - isolate --cg -t 5 -x 0.5 -w 5 -k 64000 -p60 --cg-timing --cg-mem=128000 -f 1024 \ - -E HOME=/tmp -E PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" \ - -E LANG -E LANGUAGE -E LC_ALL -d /etc:noexec --run -- /bin/bash run < $workdir/stdin - - if [[ $? != 0 ]]; then - exit_after_cleanup=true - fi - - if [[ $SKIP_CLEANUP != true ]]; then - echo "Running isolate cleanup." - isolate --cg --cleanup - rm -rf $workdir || true - else - echo "Skipping cleanup after execution." - fi - [[ $exit_after_cleanup == true ]] && exit -1 - - set -e - else - bash -c "$COMPILE_CMD" - echo "world" | bash -c "$RUN_CMD" - rm $(ls . | grep -v \.${SOURCE_FILE##*.} | grep -v $LANG_PROPERTIES_FILE | grep -v $SQLITE_DB) &> /dev/null || true - fi - - cd .. - echo - done -done diff --git a/tests/rust/lang.properties b/tests/rust/lang.properties deleted file mode 100644 index 88baa18..0000000 --- a/tests/rust/lang.properties +++ /dev/null @@ -1,6 +0,0 @@ -VERSIONS="1.40.0" -NAME="Rust ($VERSION)" -SOURCE_FILE="main.rs" -BINARY_FILE="main" -COMPILE_CMD="/usr/local/rust-$VERSION/bin/rustc $ARGS $SOURCE_FILE" -RUN_CMD="./$BINARY_FILE" \ No newline at end of file diff --git a/tests/rust/main.rs b/tests/rust/main.rs deleted file mode 100644 index e8e7787..0000000 --- a/tests/rust/main.rs +++ /dev/null @@ -1,3 +0,0 @@ -fn main() { - println!("hello, world"); -} \ No newline at end of file diff --git a/tests/sbcl/lang.properties b/tests/sbcl/lang.properties deleted file mode 100644 index f9359e8..0000000 --- a/tests/sbcl/lang.properties +++ /dev/null @@ -1,6 +0,0 @@ -VERSIONS="2.0.0" -NAME="Common Lisp (SBCL $VERSION)" -SOURCE_FILE="script.lisp" -BINARY_FILE="" -COMPILE_CMD="" -RUN_CMD="SBCL_HOME=/usr/local/sbcl-$VERSION/lib/sbcl /usr/local/sbcl-$VERSION/bin/sbcl --script $SOURCE_FILE" \ No newline at end of file diff --git a/tests/sbcl/script.lisp b/tests/sbcl/script.lisp deleted file mode 100644 index 2541f76..0000000 --- a/tests/sbcl/script.lisp +++ /dev/null @@ -1 +0,0 @@ -(write-line "hello, world") \ No newline at end of file diff --git a/tests/scala/Main.scala b/tests/scala/Main.scala deleted file mode 100644 index 1d5adff..0000000 --- a/tests/scala/Main.scala +++ /dev/null @@ -1,6 +0,0 @@ -object Main { - def main(args: Array[String]) = { - val name = scala.io.StdIn.readLine() - println("hello, "+ name) - } -} \ No newline at end of file diff --git a/tests/scala/lang.properties b/tests/scala/lang.properties deleted file mode 100644 index 43b4fdd..0000000 --- a/tests/scala/lang.properties +++ /dev/null @@ -1,6 +0,0 @@ -VERSIONS="2.13.2" -NAME="Scala ($VERSION)" -SOURCE_FILE="Main.scala" -BINARY_FILE="Main" -COMPILE_CMD="/usr/local/scala-$VERSION/bin/scalac $ARGS $SOURCE_FILE" -RUN_CMD="/usr/local/scala-$VERSION/bin/scala $BINARY_FILE" \ No newline at end of file diff --git a/tests/sqlite/db.sqlite b/tests/sqlite/db.sqlite deleted file mode 100644 index 38a98b3..0000000 Binary files a/tests/sqlite/db.sqlite and /dev/null differ diff --git a/tests/sqlite/lang.properties b/tests/sqlite/lang.properties deleted file mode 100644 index cd2cd5e..0000000 --- a/tests/sqlite/lang.properties +++ /dev/null @@ -1,6 +0,0 @@ -VERSIONS="3.27.2" -NAME="SQL (SQLite $VERSION)" -SOURCE_FILE="script.sql" -BINARY_FILE="" -COMPILE_CMD="" -RUN_CMD="/bin/cat $SOURCE_FILE | /usr/bin/sqlite3 db.sqlite" \ No newline at end of file diff --git a/tests/sqlite/script.sql b/tests/sqlite/script.sql deleted file mode 100644 index c500609..0000000 --- a/tests/sqlite/script.sql +++ /dev/null @@ -1,7 +0,0 @@ -SELECT - Name, COUNT(*) AS num_albums -FROM artists JOIN albums -ON albums.ArtistID = artists.ArtistID -GROUP BY Name -ORDER BY num_albums DESC -LIMIT 4; \ No newline at end of file diff --git a/tests/swift/Main.swift b/tests/swift/Main.swift deleted file mode 100644 index 14c2f69..0000000 --- a/tests/swift/Main.swift +++ /dev/null @@ -1,3 +0,0 @@ -import Foundation -let name = readLine() -print("hello, \(name!)") \ No newline at end of file diff --git a/tests/swift/lang.properties b/tests/swift/lang.properties deleted file mode 100644 index cab0955..0000000 --- a/tests/swift/lang.properties +++ /dev/null @@ -1,6 +0,0 @@ -VERSIONS="5.2.3" -NAME="Swift ($VERSION)" -SOURCE_FILE="Main.swift" -BINARY_FILE="Main" -COMPILE_CMD="/usr/local/swift-$VERSION/bin/swiftc $ARGS Main.swift" -RUN_CMD="./$BINARY_FILE" \ No newline at end of file diff --git a/tests/text/lang.properties b/tests/text/lang.properties deleted file mode 100644 index edb5f85..0000000 --- a/tests/text/lang.properties +++ /dev/null @@ -1,6 +0,0 @@ -VERSIONS="ignorable" -NAME="Plain Text" -SOURCE_FILE="text.txt" -BINARY_FILE="" -COMPILE_CMD="" -RUN_CMD="/bin/cat $SOURCE_FILE" \ No newline at end of file diff --git a/tests/text/text.txt b/tests/text/text.txt deleted file mode 100644 index 4b5fa63..0000000 --- a/tests/text/text.txt +++ /dev/null @@ -1 +0,0 @@ -hello, world diff --git a/tests/typescript/lang.properties b/tests/typescript/lang.properties deleted file mode 100644 index 04da188..0000000 --- a/tests/typescript/lang.properties +++ /dev/null @@ -1,6 +0,0 @@ -VERSIONS="3.7.4" -NAME="TypeScript ($VERSION)" -SOURCE_FILE="script.ts" -BINARY_FILE="script.js" -COMPILE_CMD="/usr/bin/tsc $ARGS $SOURCE_FILE" -RUN_CMD="/usr/local/node-12.14.0/bin/node $BINARY_FILE" \ No newline at end of file diff --git a/tests/typescript/script.ts b/tests/typescript/script.ts deleted file mode 100644 index 65e362e..0000000 --- a/tests/typescript/script.ts +++ /dev/null @@ -1 +0,0 @@ -console.log("hello, world");