Skip to content
This repository has been archived by the owner on Jul 16, 2024. It is now read-only.

Commit

Permalink
Upgrade to 18.04. Fix RE bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
pzread committed Jul 27, 2019
1 parent 77aeff9 commit b79c3f7
Show file tree
Hide file tree
Showing 6 changed files with 89 additions and 46 deletions.
6 changes: 3 additions & 3 deletions build-container.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ cp -a /usr/bin/clang++ $1/usr/bin/clang++
cp /usr/bin/as $1/usr/bin/as
cp /usr/bin/ld $1/usr/bin/ld
cp /usr/bin/make $1/usr/bin/make
cp /usr/bin/python3.5 $1/usr/bin/python3.5
cp /usr/bin/python3.6 $1/usr/bin/python3.6
cp -a /usr/lib/x86_64-linux-gnu $1/usr/lib/x86_64-linux-gnu
cp -a /usr/lib/gcc $1/usr/lib/gcc
cp -a /usr/lib/llvm-3.8 $1/usr/lib/llvm-3.8
cp -a /usr/lib/python3.5 $1/usr/lib/python3.5
cp -a /usr/lib/llvm-6.0 $1/usr/lib/llvm-6.0
cp -a /usr/lib/python3.6 $1/usr/lib/python3.6
cp -a /usr/lib/locale $1/usr/lib/locale
cp -a /usr/include $1/usr/include
cp -a /lib/x86_64-linux-gnu $1/lib/x86_64-linux-gnu
Expand Down
10 changes: 5 additions & 5 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ It requires root permission to run. The host must have the full ``Linux namespac
Requirements
------------

- python3 >= 3.4
- python3 >= 3.6
- python3-pip
- gcc >= 5
- g++ >= 5
- clang >= 3.6
- gcc >= 7.4
- g++ >= 7.4
- clang >= 6.0
- cmake >= 2.8
- libcgroup-dev >= 0.41
- acl
Expand All @@ -27,7 +27,7 @@ Requirements
Installation
------------

build-container.sh is used to copy files from the host to create the container. Currently, it is designed for ``Ubuntu 15.10 x86_64``. You may need to modify it to fit your host's file system. Or you can install it in the docker (see `Use Docker`_).
build-container.sh is used to copy files from the host to create the container. Currently, it is designed for ``Ubuntu 18.04 x86_64``. You may need to modify it to fit your host's file system. Or you can install it in the docker (see `Use Docker`_).

.. code::
Expand Down
77 changes: 47 additions & 30 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,32 +1,49 @@
alabaster==0.7.7
argh==0.26.1
astroid==1.4.4
Babel==2.2.0
backports-abc==0.4
breathe==4.1.0
cffi==1.5.2
colorama==0.3.6
cpplint==1.0.1
docutils==0.12
hiredis==0.2.0
Jinja2==2.8
lazy-object-proxy==1.2.1
livereload==2.4.1
MarkupSafe==0.23
alabaster==0.7.12
argh==0.26.2
astroid==2.2.5
Babel==2.7.0
backports-abc==0.5
breathe==4.13.0.post0
certifi==2019.6.16
cffi==1.12.3
chardet==3.0.4
colorama==0.4.1
cpplint==1.4.4
docutils==0.15
hiredis==1.0.0
idna==2.8
imagesize==1.1.0
isort==4.3.21
Jinja2==2.10.1
lazy-object-proxy==1.4.1
livereload==2.6.1
MarkupSafe==1.1.1
mccabe==0.6.1
packaging==19.0
pathtools==0.1.2
pkg-resources==0.0.0
port-for==0.3.1
pycparser==2.14
Pygments==2.1.1
pylint==1.5.4
pytz==2015.7
PyYAML==3.11
redis==2.10.5
six==1.10.0
snowballstemmer==1.2.1
Sphinx==1.3.5
sphinx-autobuild==0.6.0
sphinx-rtd-theme==0.1.9
tornado==4.3
watchdog==0.8.3
wheel==0.29.0
wrapt==1.10.6
pycparser==2.19
Pygments==2.4.2
pylint==2.3.1
pyparsing==2.4.1.1
pytz==2019.1
PyYAML==5.1.1
redis==3.2.1
requests==2.22.0
six==1.12.0
snowballstemmer==1.9.0
Sphinx==2.1.2
sphinx-autobuild==0.7.1
sphinx-rtd-theme==0.4.3
sphinxcontrib-applehelp==1.0.1
sphinxcontrib-devhelp==1.0.1
sphinxcontrib-htmlhelp==1.0.2
sphinxcontrib-jsmath==1.0.1
sphinxcontrib-qthelp==1.0.2
sphinxcontrib-serializinghtml==1.1.3
tornado==4.5.3
typed-ast==1.4.0
urllib3==1.25.3
watchdog==0.9.0
wrapt==1.11.2
3 changes: 3 additions & 0 deletions src/sandbox.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -478,6 +478,9 @@ void Sandbox::update_state(siginfo_t *siginfo) {
terminate();
ptrace(PTRACE_CONT, child_pid, NULL, NULL);

} else if (siginfo->si_status == SIGSEGV) {
terminate();

} else {
// Passthrough other signals.
ptrace(PTRACE_CONT, child_pid, NULL, siginfo->si_status);
Expand Down
33 changes: 25 additions & 8 deletions tests/TestDiff.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from tornado.ioloop import IOLoop, PollIOLoop
import PyExt
import Privilege
from StdChal import StdChal, STATUS_AC
from StdChal import StdChal, STATUS_AC, STATUS_RE


class EvIOLoop(PollIOLoop):
Expand All @@ -19,13 +19,6 @@ def initialize(self, **kwargs):
class DiffJugeCase(testing.AsyncTestCase):
'''Run diff judge tests.'''

def __init__(self, *args):
Privilege.init()
PyExt.init()
StdChal.init()

super().__init__(*args)

def get_new_ioloop(self):
IOLoop.configure(EvIOLoop)
return IOLoop().instance()
Expand All @@ -50,3 +43,27 @@ def test_stdchal(self):
_, _, status, _ = result
self.assertEqual(status, STATUS_AC)

@testing.gen_test(timeout=60)
def test_runtime_error(self):
'''Test g++, Runtime Error.'''

chal = StdChal(2, 'tests/testdata/testre.cpp', 'g++', 'diff', \
'tests/testdata/res', \
[
{
'in': 'tests/testdata/res/testdata/0.in',
'ans': 'tests/testdata/res/testdata/0.out',
'timelimit': 10000,
'memlimit': 256 * 1024 * 1024,
}
] * 1, {})
result_list = yield chal.start()
self.assertEqual(len(result_list), 1)
for result in result_list:
_, _, status, _ = result
self.assertEqual(status, STATUS_RE)

def setUpModule():
Privilege.init()
PyExt.init()
StdChal.init()
6 changes: 6 additions & 0 deletions tests/testdata/testre.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#include <assert.h>

int main() {
assert(0);
return 0;
}

0 comments on commit b79c3f7

Please sign in to comment.