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
Gwenaël Samain
cython
Commits
ce3e9f23
Commit
ce3e9f23
authored
Jan 18, 2014
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
remove redundant code from cygdb test and apply some safety fixes
parent
dfcaadb7
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
57 deletions
+20
-57
Cython/Debugger/Tests/TestLibCython.py
Cython/Debugger/Tests/TestLibCython.py
+20
-57
No files found.
Cython/Debugger/Tests/TestLibCython.py
View file @
ce3e9f23
...
@@ -234,63 +234,26 @@ class GdbDebuggerTestCase(DebuggerTestCase):
...
@@ -234,63 +234,26 @@ class GdbDebuggerTestCase(DebuggerTestCase):
os
.
path
.
abspath
(
Cython
.
__file__
))))
os
.
path
.
abspath
(
Cython
.
__file__
))))
env
=
dict
(
os
.
environ
,
PYTHONPATH
=
os
.
pathsep
.
join
(
paths
))
env
=
dict
(
os
.
environ
,
PYTHONPATH
=
os
.
pathsep
.
join
(
paths
))
try
:
self
.
p
=
subprocess
.
Popen
(
p
=
subprocess
.
Popen
([
'gdb'
,
'-v'
],
stdout
=
subprocess
.
PIPE
)
args
,
have_gdb
=
True
stdout
=
open
(
os
.
devnull
,
'w'
),
except
OSError
:
stderr
=
subprocess
.
PIPE
,
# gdb was not installed
env
=
env
)
have_gdb
=
False
else
:
gdb_version
=
p
.
stdout
.
read
().
decode
(
'ascii'
)
p
.
wait
()
p
.
stdout
.
close
()
if
have_gdb
:
# Based on Lib/test/test_gdb.py
regex
=
"^GNU gdb [^
\
d]*(
\
d+)
\
.(
\
d+)"
gdb_version_number
=
list
(
map
(
int
,
re
.
search
(
regex
,
gdb_version
).
groups
()))
if
gdb_version_number
>=
[
7
,
2
]:
python_version_script
=
tempfile
.
NamedTemporaryFile
(
mode
=
'w+'
)
python_version_script
.
write
(
'python import sys; print("%s %s" % sys.version_info[:2])'
)
python_version_script
.
flush
()
p
=
subprocess
.
Popen
([
'gdb'
,
'-batch'
,
'-x'
,
python_version_script
.
name
],
stdout
=
subprocess
.
PIPE
)
try
:
python_version
=
p
.
stdout
.
read
().
decode
(
'ascii'
)
p
.
wait
()
finally
:
p
.
stdout
.
close
()
try
:
python_version_number
=
list
(
map
(
int
,
python_version
.
split
()))
except
ValueError
:
have_gdb
=
False
# Be Python 3 compatible
if
(
not
have_gdb
or
gdb_version_number
<
[
7
,
2
]
or
python_version_number
<
[
2
,
6
]):
self
.
p
=
None
warnings
.
warn
(
'Skipping gdb tests, need gdb >= 7.2 with Python >= 2.6'
)
else
:
self
.
p
=
subprocess
.
Popen
(
args
,
stdout
=
open
(
os
.
devnull
,
'w'
),
stderr
=
subprocess
.
PIPE
,
env
=
env
)
def
tearDown
(
self
):
def
tearDown
(
self
):
if
not
test_gdb
():
if
not
test_gdb
():
return
return
super
(
GdbDebuggerTestCase
,
self
).
tearDown
()
try
:
if
self
.
p
:
super
(
GdbDebuggerTestCase
,
self
).
tearDown
()
self
.
p
.
stderr
.
close
()
if
self
.
p
:
self
.
p
.
wait
()
try
:
self
.
p
.
stdout
.
close
()
os
.
remove
(
self
.
gdb_command_file
)
except
:
pass
try
:
self
.
p
.
stderr
.
close
()
except
:
pass
self
.
p
.
wait
()
finally
:
os
.
remove
(
self
.
gdb_command_file
)
class
TestAll
(
GdbDebuggerTestCase
):
class
TestAll
(
GdbDebuggerTestCase
):
...
@@ -302,15 +265,15 @@ class TestAll(GdbDebuggerTestCase):
...
@@ -302,15 +265,15 @@ class TestAll(GdbDebuggerTestCase):
out
,
err
=
self
.
p
.
communicate
()
out
,
err
=
self
.
p
.
communicate
()
err
=
err
.
decode
(
'UTF-8'
)
err
=
err
.
decode
(
'UTF-8'
)
exit_status
=
self
.
p
.
wait
()
exit_status
=
self
.
p
.
returncode
if
exit_status
==
1
:
if
exit_status
==
1
:
sys
.
stderr
.
write
(
err
)
sys
.
stderr
.
write
(
err
)
elif
exit_status
>=
2
:
elif
exit_status
>=
2
:
border
=
'*'
*
30
border
=
u
'*'
*
30
start
=
'%s v INSIDE GDB v %s'
%
(
border
,
border
)
start
=
u
'%s v INSIDE GDB v %s'
%
(
border
,
border
)
end
=
'%s ^ INSIDE GDB ^ %s'
%
(
border
,
border
)
end
=
u
'%s ^ INSIDE GDB ^ %s'
%
(
border
,
border
)
errmsg
=
'
\
n
%s
\
n
%s%s'
%
(
start
,
err
,
end
)
errmsg
=
u
'
\
n
%s
\
n
%s%s'
%
(
start
,
err
,
end
)
sys
.
stderr
.
write
(
errmsg
)
sys
.
stderr
.
write
(
errmsg
)
...
...
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