Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
codejail
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
codejail
Commits
3cd864ac
Commit
3cd864ac
authored
May 07, 2014
by
Ned Batchelder
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #22 from edx/ned/fix-temp-files
Fix temp file writing
parents
ff55f635
462d1df9
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
7 deletions
+12
-7
README.rst
+1
-1
codejail/tests/test_jail_code.py
+11
-6
No files found.
README.rst
View file @
3cd864ac
...
@@ -87,7 +87,7 @@ Other details here that depend on your configuration:
...
@@ -87,7 +87,7 @@ Other details here that depend on your configuration:
/the/path/to/your/sandbox-packages/** r,
/the/path/to/your/sandbox-packages/** r,
/tmp/codejail-*/ rix,
/tmp/codejail-*/ rix,
/tmp/codejail-*/** rix,
/tmp/codejail-*/**
w
rix,
}
}
6. Parse the profiles::
6. Parse the profiles::
...
...
codejail/tests/test_jail_code.py
View file @
3cd864ac
...
@@ -33,6 +33,8 @@ class JailCodeHelpers(object):
...
@@ -33,6 +33,8 @@ class JailCodeHelpers(object):
def
assertResultOk
(
self
,
res
):
def
assertResultOk
(
self
,
res
):
"""Assert that `res` exited well (0), and had no stderr output."""
"""Assert that `res` exited well (0), and had no stderr output."""
if
res
.
stderr
:
print
"---- stderr:
\n
%
s"
%
res
.
stderr
self
.
assertEqual
(
res
.
stderr
,
""
)
# pylint: disable=E1101
self
.
assertEqual
(
res
.
stderr
,
""
)
# pylint: disable=E1101
self
.
assertEqual
(
res
.
status
,
0
)
# pylint: disable=E1101
self
.
assertEqual
(
res
.
status
,
0
)
# pylint: disable=E1101
...
@@ -226,13 +228,16 @@ class TestLimits(JailCodeHelpers, unittest.TestCase):
...
@@ -226,13 +228,16 @@ class TestLimits(JailCodeHelpers, unittest.TestCase):
f, path = tempfile.mkstemp()
f, path = tempfile.mkstemp()
os.close(f)
os.close(f)
with open(path, "w") as f1:
with open(path, "w") as f1:
f1.write("hello"*250)
try:
with open(path) as f2:
f1.write(".".join("
%05
d"
%
i for i in xrange(1000)))
print "Got this:", f2.read()
except IOError as e:
print "Expected exception:
%
s"
%
e
else:
with open(path) as f2:
print "Got this:", f2.read()
"""
)
"""
)
self
.
assertNotEqual
(
res
.
status
,
0
)
self
.
assertResultOk
(
res
)
self
.
assertEqual
(
res
.
stdout
,
"Trying mkstemp
\n
"
)
self
.
assertIn
(
"Expected exception"
,
res
.
stdout
)
self
.
assertIn
(
"IOError"
,
res
.
stderr
)
def
test_cant_write_many_small_temp_files
(
self
):
def
test_cant_write_many_small_temp_files
(
self
):
# We would like this to fail, but there's nothing that checks total
# We would like this to fail, but there's nothing that checks total
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment