Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cython
Commits
edb10a47
Commit
edb10a47
authored
Apr 24, 2014
by
Alok Singhal
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
better logic for C compile failure support in runtests.py
parent
d9b3c477
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
17 deletions
+20
-17
runtests.py
runtests.py
+19
-14
tests/errors/e_switch_transform.pyx
tests/errors/e_switch_transform.pyx
+1
-3
No files found.
runtests.py
View file @
edb10a47
...
...
@@ -399,7 +399,6 @@ class ErrorWriter(object):
def _collect(self, collect_errors, collect_warnings):
s = ''.join(self.output)
result = []
runtime_error = False
for line in s.split('
\
n
'):
match = self.match_error(line)
if match:
...
...
@@ -407,10 +406,8 @@ class ErrorWriter(object):
if (is_warning and collect_warnings) or
\
(not is_warning and collect_errors):
result.append( (int(line), int(column), message.strip()) )
elif 'runtime error' in line:
runtime_error = True
result.sort()
return [ "
%
d
:
%
d
:
%
s
" % values for values in result ]
, runtime_error
return [ "
%
d
:
%
d
:
%
s
" % values for values in result ]
def geterrors(self):
return self._collect(True, False)
...
...
@@ -696,15 +693,19 @@ class CythonCompileTestCase(unittest.TestCase):
if line.startswith("
_ERRORS
"):
out.close()
out = ErrorWriter()
elif line.startswith('_FAIL_C_COMPILE'):
out.close()
return '_FAIL_C_COMPILE'
else:
out.write(line)
finally:
source_and_output.close()
try:
geterrors = out.geterrors
except AttributeError:
out.close()
return []
, False
return []
else:
return geterrors()
...
...
@@ -825,7 +826,7 @@ class CythonCompileTestCase(unittest.TestCase):
expect_errors, annotate):
expected_errors = errors = ()
if expect_errors:
expected_errors
, runtime_error
= self.split_source_and_output(
expected_errors = self.split_source_and_output(
test_directory, module, workdir)
test_directory = workdir
...
...
@@ -834,11 +835,18 @@ class CythonCompileTestCase(unittest.TestCase):
try:
sys.stderr = ErrorWriter()
self.run_cython(test_directory, module, workdir, incdir, annotate)
errors
, _
= sys.stderr.geterrors()
errors = sys.stderr.geterrors()
finally:
sys.stderr = old_stderr
if errors or expected_errors:
if expected_errors == '_FAIL_C_COMPILE':
if errors:
print("
\
n
===
Expected
C
compile
error
===
")
print("
\
n
\
n
===
Got
Cython
errors
:
===
")
print('
\
n
'.join(errors))
print('
\
n
')
raise RuntimeError('should have generated extension code')
elif errors or expected_errors:
try:
for expected, error in zip(expected_errors, errors):
self.assertEquals(expected, error)
...
...
@@ -857,15 +865,12 @@ class CythonCompileTestCase(unittest.TestCase):
raise
return None
if self.cython_only:
so_path = None
else:
so_path = None
if not self.cython_only:
try:
so_path = self.run_distutils(test_directory, module, workdir, incdir)
except:
if runtime_error:
return None
else:
if expected_errors != '_FAIL_C_COMPILE':
raise
return so_path
...
...
tests/errors/e_switch_transform.pyx
View file @
edb10a47
...
...
@@ -11,6 +11,4 @@ cdef extern from "../run/includes/switch_transform_support.h":
def
is_not_one
(
int
i
):
return
i
!=
ONE
and
i
!=
ONE_AGAIN
_ERRORS
=
u'''
runtime error
'''
_FAIL_C_COMPILE
=
True
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