Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
cpython
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
cpython
Commits
329ca711
Kaydet (Commit)
329ca711
authored
Eyl 02, 2015
tarafından
Victor Stinner
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Sade Fark
Merge 3.4 (test_gdb)
üst
6732343a
5b6b4a8c
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
33 additions
and
17 deletions
+33
-17
test_gdb.py
Lib/test/test_gdb.py
+33
-17
No files found.
Lib/test/test_gdb.py
Dosyayı görüntüle @
329ca711
...
@@ -21,19 +21,32 @@ except ImportError:
...
@@ -21,19 +21,32 @@ except ImportError:
from
test
import
support
from
test
import
support
from
test.support
import
run_unittest
,
findfile
,
python_is_optimized
from
test.support
import
run_unittest
,
findfile
,
python_is_optimized
try
:
def
get_gdb_version
():
gdb_version
,
_
=
subprocess
.
Popen
([
"gdb"
,
"-nx"
,
"--version"
],
try
:
stdout
=
subprocess
.
PIPE
)
.
communicate
()
proc
=
subprocess
.
Popen
([
"gdb"
,
"-nx"
,
"--version"
],
except
OSError
:
stdout
=
subprocess
.
PIPE
,
# This is what "no gdb" looks like. There may, however, be other
universal_newlines
=
True
)
# errors that manifest this way too.
with
proc
:
raise
unittest
.
SkipTest
(
"Couldn't find gdb on the path"
)
version
=
proc
.
communicate
()[
0
]
gdb_version_number
=
re
.
search
(
b
"^GNU gdb [^
\
d]*(
\
d+)
\
.(
\
d)"
,
gdb_version
)
except
OSError
:
gdb_major_version
=
int
(
gdb_version_number
.
group
(
1
))
# This is what "no gdb" looks like. There may, however, be other
gdb_minor_version
=
int
(
gdb_version_number
.
group
(
2
))
# errors that manifest this way too.
raise
unittest
.
SkipTest
(
"Couldn't find gdb on the path"
)
# Regex to parse:
# 'GNU gdb (GDB; SUSE Linux Enterprise 12) 7.7\n' -> 7.7
# 'GNU gdb (GDB) Fedora 7.9.1-17.fc22\n' -> 7.9
match
=
re
.
search
(
"^GNU gdb .*? (
\
d+)
\
.(
\
d)"
,
version
)
if
match
is
None
:
raise
Exception
(
"unable to parse GDB version:
%
r"
%
version
)
return
(
version
,
int
(
match
.
group
(
1
)),
int
(
match
.
group
(
2
)))
gdb_version
,
gdb_major_version
,
gdb_minor_version
=
get_gdb_version
()
if
gdb_major_version
<
7
:
if
gdb_major_version
<
7
:
raise
unittest
.
SkipTest
(
"gdb versions before 7.0 didn't support python embedding"
raise
unittest
.
SkipTest
(
"gdb versions before 7.0 didn't support python "
" Saw:
\n
"
+
gdb_version
.
decode
(
'ascii'
,
'replace'
))
"embedding. Saw
%
s.
%
s:
\n
%
s"
%
(
gdb_major_version
,
gdb_minor_version
,
gdb_version
))
if
not
sysconfig
.
is_python_build
():
if
not
sysconfig
.
is_python_build
():
raise
unittest
.
SkipTest
(
"test_gdb only works on source builds at the moment."
)
raise
unittest
.
SkipTest
(
"test_gdb only works on source builds at the moment."
)
...
@@ -59,9 +72,12 @@ def run_gdb(*args, **env_vars):
...
@@ -59,9 +72,12 @@ def run_gdb(*args, **env_vars):
base_cmd
=
(
'gdb'
,
'--batch'
,
'-nx'
)
base_cmd
=
(
'gdb'
,
'--batch'
,
'-nx'
)
if
(
gdb_major_version
,
gdb_minor_version
)
>=
(
7
,
4
):
if
(
gdb_major_version
,
gdb_minor_version
)
>=
(
7
,
4
):
base_cmd
+=
(
'-iex'
,
'add-auto-load-safe-path '
+
checkout_hook_path
)
base_cmd
+=
(
'-iex'
,
'add-auto-load-safe-path '
+
checkout_hook_path
)
out
,
err
=
subprocess
.
Popen
(
base_cmd
+
args
,
proc
=
subprocess
.
Popen
(
base_cmd
+
args
,
stdout
=
subprocess
.
PIPE
,
stderr
=
subprocess
.
PIPE
,
env
=
env
,
stdout
=
subprocess
.
PIPE
,
)
.
communicate
()
stderr
=
subprocess
.
PIPE
,
env
=
env
)
with
proc
:
out
,
err
=
proc
.
communicate
()
return
out
.
decode
(
'utf-8'
,
'replace'
),
err
.
decode
(
'utf-8'
,
'replace'
)
return
out
.
decode
(
'utf-8'
,
'replace'
),
err
.
decode
(
'utf-8'
,
'replace'
)
# Verify that "gdb" was built with the embedded python support enabled:
# Verify that "gdb" was built with the embedded python support enabled:
...
@@ -880,8 +896,8 @@ class PyLocalsTests(DebuggerTests):
...
@@ -880,8 +896,8 @@ class PyLocalsTests(DebuggerTests):
def
test_main
():
def
test_main
():
if
support
.
verbose
:
if
support
.
verbose
:
print
(
"GDB version
:"
)
print
(
"GDB version
%
s.
%
s:"
%
(
gdb_major_version
,
gdb_minor_version
)
)
for
line
in
os
.
fsdecode
(
gdb_version
)
.
splitlines
():
for
line
in
gdb_version
.
splitlines
():
print
(
" "
*
4
+
line
)
print
(
" "
*
4
+
line
)
run_unittest
(
PrettyPrintTests
,
run_unittest
(
PrettyPrintTests
,
PyListTests
,
PyListTests
,
...
...
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