Skip to content

Commit

Permalink
Merge pull request #11 from mcpt/DMOJ-merge
Browse files Browse the repository at this point in the history
Merge upstream. This is quite large because upstream merged the testsuite repository in.
  • Loading branch information
fluix-dev authored Feb 21, 2021
2 parents 3d41749 + 4a034cf commit 8130ff4
Show file tree
Hide file tree
Showing 405 changed files with 13,395 additions and 1,589 deletions.
21 changes: 11 additions & 10 deletions .docker/entry
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,19 @@ export PYTHONUNBUFFERED=1
export LANG=C.UTF-8
export PYTHONIOENCODING=utf8

cd /judge
cd /judge || exit
pip3 install -q -e .

if [ "$1" == "run" ]; then
command=dmoj
elif [ "$1" == "cli" ]; then
command=dmoj-cli
else
echo "Invalid command, must be one of [run, cli]" 1>&2
exit 1
fi
case "$1" in
run) command=(dmoj) ;;
cli) command=(dmoj-cli) ;;
test) command=(python3 -- -m dmoj.testsuite testsuite) ;;
*)
echo "Invalid command, must be one of [run, cli, test]" 1>&2
exit 1
;;
esac

shift
. ~judge/.profile
runuser -u judge "${command}" -- $@
runuser -u judge "${command[@]}" -- "$@"
2 changes: 1 addition & 1 deletion .docker/tier1/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
FROM dmoj/runtimes-tier1

ARG TAG=master
RUN mkdir /judge && cd /judge && \
RUN mkdir /judge /problems && cd /judge && \
curl -L https://github.com/DMOJ/judge-server/archive/"${TAG}".tar.gz | tar -xz --strip-components=1 && \
pip3 install -e . && \
. ~judge/.profile && \
Expand Down
3 changes: 2 additions & 1 deletion .docker/tier2/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
FROM dmoj/runtimes-tier2

ARG TAG=master
RUN mkdir /judge && cd /judge && \
RUN mkdir /judge /problems && cd /judge && \
curl -L https://github.com/DMOJ/judge-server/archive/"${TAG}".tar.gz | tar -xz --strip-components=1 && \
pip3 install -e . && \
sed -i 's/source "$HOME/. "\/home\/judge/' ~judge/.profile && \
. ~judge/.profile && \
runuser -u judge -w PATH -- dmoj-autoconf -V > /judge-runtime-paths.yml && \
echo ' crt_x86_in_lib32: true' >> /judge-runtime-paths.yml
Expand Down
3 changes: 2 additions & 1 deletion .docker/tier3/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
FROM dmoj/runtimes-tier3

ARG TAG=master
RUN mkdir /judge && cd /judge && \
RUN mkdir /judge /problems && cd /judge && \
curl -L https://github.com/DMOJ/judge-server/archive/"${TAG}".tar.gz | tar -xz --strip-components=1 && \
pip3 install -e . && \
sed -i 's/source "$HOME/. "\/home\/judge/' ~judge/.profile && \
. ~judge/.profile && \
runuser -u judge -w PATH -- dmoj-autoconf -V > /judge-runtime-paths.yml && \
echo ' crt_x86_in_lib32: true' >> /judge-runtime-paths.yml
Expand Down
3 changes: 3 additions & 0 deletions .freebsd.test.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,11 @@
'AWK',
'BF',
'C',
'C11',
'CPP03',
'CPP11',
'CPP14',
'CPP17',
'CLANG',
'CLANGX',
'JAVA8',
Expand Down
27 changes: 6 additions & 21 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:
- name: Verify mypy types
run: |
mypy --version
mypy .
mypy dmoj
test-sdist:
runs-on: ubuntu-latest
steps:
Expand Down Expand Up @@ -68,17 +68,8 @@ jobs:
run: docker pull dmoj/runtimes-tier3
- name: Install python
run: |
if [ "${{ matrix.python-version }}" != 3.8 ]; then
curl -L "https://github.com/DMOJ/runtimes-python/releases/latest/download/python${{ matrix.python-version }}-amd64.tar.gz" |
tar -xz
fi
- name: Download testsuite
run: |
git clone --depth 25 \
--single-branch \
--branch ${DMOJ_JUDGE_TESTSUITE_BRANCH:-master} \
https://github.com/${DMOJ_JUDGE_TESTSUITE_SLUG:-DMOJ/judge-testsuite} testsuite &&
git -C testsuite reset --hard ${DMOJ_JUDGE_TESTSUITE_COMMIT_SHA:-HEAD}
curl -L "https://github.com/DMOJ/runtimes-python/releases/latest/download/python${{ matrix.python-version }}-amd64.tar.gz" |
tar -xz
- name: Create docker scripts
run: |
cat > run <<'EOF'
Expand All @@ -87,17 +78,11 @@ jobs:
export LANG=C.UTF-8
export PYTHONIOENCODING=utf8
cd /code
if [ "${{ matrix.python-version }}" != 3.8 ]; then
PYTHON="/code/python${{ matrix.python-version }}/bin/python${{ matrix.python-version }}"
"$PYTHON" -m pip install --upgrade pip wheel
"$PYTHON" -m pip install cython coverage
else
PYTHON=/usr/bin/python3.8
pip3 install coverage
fi
export PYTHON="/code/python${{ matrix.python-version }}/bin/python${{ matrix.python-version }}"
"$PYTHON" -m pip install --upgrade pip wheel
"$PYTHON" -m pip install cython coverage
"$PYTHON" -m pip install -e .[test]
chmod o+w .
export PYTHON
runuser -u judge -w PATH /code/run-su
EOF
Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/update-syscalls.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
cd dmoj/cptbox/syscalls
python generate_linux.py
- name: Create pull request
uses: peter-evans/create-pull-request@v2
uses: peter-evans/create-pull-request@v3
with:
token: ${{ secrets.REPO_SCOPED_TOKEN }}
commit-message: 'cptbox: update Linux syscall list'
Expand All @@ -26,4 +26,3 @@ jobs:
labels: cptbox, security, enhancement
assignees: Xyene, quantum5
branch: update-syscalls

24 changes: 5 additions & 19 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,8 @@ jobs:
install:
- docker pull "$DOCKER_IMAGE"
- |
if [ "$PYTHON_VERSION" != 3.8 ]; then
curl -L "https://github.com/DMOJ/runtimes-python/releases/latest/download/python$PYTHON_VERSION-$ARCH.tar.gz" |
tar -xz
fi
- >
git clone --depth 25 \
--single-branch \
--branch ${DMOJ_JUDGE_TESTSUITE_BRANCH:-master} \
https://github.com/${DMOJ_JUDGE_TESTSUITE_SLUG:-DMOJ/judge-testsuite} testsuite &&
git -C testsuite reset --hard ${DMOJ_JUDGE_TESTSUITE_COMMIT_SHA:-HEAD}
curl -L "https://github.com/DMOJ/runtimes-python/releases/latest/download/python$PYTHON_VERSION-$ARCH.tar.gz" |
tar -xz
cache:
directories:
- /home/travis/.cache/pip
Expand All @@ -38,17 +30,11 @@ script:
export LANG=C.UTF-8
export PYTHONIOENCODING=utf8
cd /code
if [ "$PYTHON_VERSION" != 3.8 ]; then
PYTHON="/code/python$PYTHON_VERSION/bin/python$PYTHON_VERSION"
"$PYTHON" -m pip install --upgrade pip wheel
"$PYTHON" -m pip install cython coverage
else
PYTHON=/usr/bin/python3.8
pip3 install coverage
fi
export PYTHON="/code/python$PYTHON_VERSION/bin/python$PYTHON_VERSION"
"$PYTHON" -m pip install --upgrade pip wheel
"$PYTHON" -m pip install cython coverage
"$PYTHON" -m pip install -e .[test]
chmod o+w .
export PYTHON
runuser -u judge -w PATH /code/run-su
EOF
- |
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
DMOJ Judge [![Linux Build Status](https://img.shields.io/travis/DMOJ/judge-server.svg?logo=linux)](https://travis-ci.org/DMOJ/judge-server) [![FreeBSD Build Status](https://img.shields.io/jenkins/s/https/ci.dmoj.ca/job/dmoj-judge-freebsd.svg?logo=data%3Aimage%2Fsvg%2Bxml%3Bbase64%2CPHN2ZyB3aWR0aD0iMTQiIGhlaWdodD0iMTQiIHZpZXdCb3g9IjAgMCAyNTYgMjUyIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHByZXNlcnZlQXNwZWN0UmF0aW89InhNaWRZTWlkIj48ZyBmaWxsPSJ3aGl0ZSI%2BPHBhdGggZD0iTTI1Mi43MjMgNS4xMWMxMy41MDggMTMuNS0yMy45MzkgNzIuODQ4LTMwLjI3IDc5LjE4Mi02LjMzIDYuMzIxLTIyLjQwOS41MDUtMzUuOTEtMTMtMTMuNTA4LTEzLjUtMTkuMzI3LTI5LjU4My0xMi45OTYtMzUuOTE0IDYuMzI3LTYuMzMzIDY1LjY3MS00My43NzcgNzkuMTc2LTMwLjI2OU02My4zMDUgMTkuMzk0Yy0yMC42MjItMTEuNy00OS45NjYtMjQuNzE2LTU5LjMtMTUuMzgtOS40NTggOS40NTQgNC4wMzQgMzkuNDU4IDE1Ljg1OCA2MC4xMTdhMTI2LjgxMiAxMjYuODEyIDAgMCAxIDQzLjQ0Mi00NC43MzciLz48cGF0aCBkPSJNMjMyLjEyMyA3OS42MzZjMS44OTkgNi40NCAxLjU1OCAxMS43Ni0xLjUyMiAxNC44MzQtNy4xOTMgNy4xOTYtMjYuNjI0LS40NjQtNDQuMTQtMTcuMTM0YTg5LjM4MyA4OS4zODMgMCAwIDEtMy42MjctMy40MjhjLTYuMzM0LTYuMzM2LTExLjI2Mi0xMy4wOC0xNC40MTQtMTkuMjkxLTYuMTM1LTExLjAwNi03LjY3LTIwLjcyNi0zLjAzMy0yNS4zNjQgMi41MjctMi41MjQgNi41Ny0zLjIxMiAxMS41MDItMi4zMjUgMy4yMTYtMi4wMzQgNy4wMTMtNC4zIDExLjE3Ni02LjYyMS0xNi45MjktOC44My0zNi4xNzYtMTMuODE3LTU2LjU5My0xMy44MTdDNjMuNzUzIDYuNDkgOC44NTQgNjEuMzggOC44NTQgMTI5LjEwNWMwIDY3LjcxMyA1NC45IDEyMi42MSAxMjIuNjE4IDEyMi42MSA2Ny43MiAwIDEyMi42MTYtNTQuODk3IDEyMi42MTYtMTIyLjYxIDAtMjEuODctNS43NC00Mi4zNzctMTUuNzY3LTYwLjE1Ni0yLjE2NyAzLjk1NS00LjI3NCA3LjU3OC02LjE5OCAxMC42ODciLz48L2c%2BPC9zdmc%2B)](https://ci.dmoj.ca/job/dmoj-judge-freebsd/lastBuild/consoleFull) [![Coverage](https://img.shields.io/codecov/c/github/DMOJ/judge-server.svg)](https://codecov.io/gh/DMOJ/judge-server) [![Slack](https://slack.dmoj.ca/badge.svg)](https://slack.dmoj.ca)
DMOJ Judge [![amd64 Build Status](https://img.shields.io/github/workflow/status/DMOJ/judge-server/build?logo=github)](https://github.com/DMOJ/judge-server/actions?query=workflow%3Abuild) [![arm64 Build Status](https://img.shields.io/travis/DMOJ/judge-server/master?label=arm64&logo=travis)](https://travis-ci.org/github/DMOJ/judge-server) [![FreeBSD Build Status](https://img.shields.io/jenkins/build?jobUrl=https%3A%2F%2Fci.dmoj.ca%2Fview%2FDMOJ%2Fjob%2Fdmoj-judge-freebsd-py3%2F&logo=freebsd)](https://ci.dmoj.ca/view/DMOJ/job/dmoj-judge-freebsd-py3/) [![Coverage](https://img.shields.io/codecov/c/github/DMOJ/judge-server.svg)](https://codecov.io/gh/DMOJ/judge-server) [![Slack](https://slack.dmoj.ca/badge.svg)](https://slack.dmoj.ca)
=====

Python [AGPLv3](LICENSE) contest judge backend for the [DMOJ site](http://github.com/DMOJ/online-judge) interface. See it in action at [dmoj.ca](https://dmoj.ca/)!
Expand Down Expand Up @@ -33,9 +33,9 @@ Versions up to and including [v1.4.0](https://github.com/DMOJ/judge-server/relea
The DMOJ judge does **not** need a root user to run on Linux machines: it will run just fine under a normal user.

Supported languages include:
* C++ 11/14/17 (GCC and Clang)
* C++ 11/14/17/20 (GCC and Clang)
* C 99/11
* Java 8/9/10/11
* Java 8/9/10/11/15
* Python 2/3
* PyPy 2/3
* Pascal
Expand Down
3 changes: 2 additions & 1 deletion dmoj/cptbox/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from dmoj.cptbox._cptbox import PTBOX_ABI_ARM, PTBOX_ABI_ARM64, PTBOX_ABI_X32, PTBOX_ABI_X64, PTBOX_ABI_X86
from dmoj.cptbox.handlers import ALLOW, DISALLOW
from dmoj.cptbox.isolate import IsolateTracer
from dmoj.cptbox.syscalls import SYSCALL_COUNT
from dmoj.cptbox.tracer import PIPE, TracedPopen
from dmoj.cptbox.tracer import PIPE, TracedPopen, can_debug
22 changes: 15 additions & 7 deletions dmoj/cptbox/_cptbox.pyi
Original file line number Diff line number Diff line change
@@ -1,15 +1,23 @@
from typing import Any, Callable
from typing import Any, Callable, List

DEBUGGER_X86: int
DEBUGGER_X64: int
DEBUGGER_X86_ON_X64: int
DEBUGGER_X32: int
DEBUGGER_ARM: int
DEBUGGER_ARM64: int
PTBOX_ABI_X86: int
PTBOX_ABI_X64: int
PTBOX_ABI_X32: int
PTBOX_ABI_ARM: int
PTBOX_ABI_ARM64: int
PTBOX_ABI_FREEBSD_X64: int
PTBOX_ABI_INVALID: int
PTBOX_ABI_COUNT: int

ALL_ABIS: List[int]
SUPPORTED_ABIS: List[int]

Debugger: Any
Process: Any

AT_FDCWD: int
bsd_get_proc_cwd: Callable[[int], str]
bsd_get_proc_fdno: Callable[[int, int], str]

memory_fd_create: Callable[[], int]
memory_fd_seal: Callable[[int], None]
Loading

0 comments on commit 8130ff4

Please sign in to comment.